From: Uwe Hermann Date: Wed, 24 Oct 2012 10:11:31 +0000 (+0200) Subject: new-driver: Logging helper fixes. X-Git-Url: https://sigrok.org/gitweb/?p=sigrok-util.git;a=commitdiff_plain;h=f3f6a56101d98c180b0e62027da1969b16decc6a new-driver: Logging helper fixes. Keep the sr_err() instead of SR_ERR() name in the #defines, otherwise we conflict with the SR_ERR integer. --- diff --git a/source/drv-api.c b/source/drv-api.c index 16f5f6d..671149b 100644 --- a/source/drv-api.c +++ b/source/drv-api.c @@ -56,7 +56,7 @@ static int hw_init(void) struct drv_context *drvc; if (!(drvc = g_try_malloc0(sizeof(struct drv_context)))) { - SR_ERR("Driver context malloc failed."); + sr_err("Driver context malloc failed."); return SR_ERR; } @@ -121,7 +121,7 @@ static int hw_info_get(int info_id, const void **data, switch (info_id) { /* TODO */ default: - SR_ERR("Unknown info_id: %d.", info_id); + sr_err("Unknown info_id: %d.", info_id); return SR_ERR_ARG; } @@ -134,7 +134,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, int ret; if (sdi->status != SR_ST_ACTIVE) { - SR_ERR("Device inactive, can't set config options."); + sr_err("Device inactive, can't set config options."); return SR_ERR; } @@ -142,7 +142,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, switch (hwcap) { /* TODO */ default: - SR_ERR("Unknown hardware capability: %d.", hwcap); + sr_err("Unknown hardware capability: %d.", hwcap); ret = SR_ERR_ARG; } diff --git a/source/drv-protocol.h b/source/drv-protocol.h index 082ecfc..ec14a71 100644 --- a/source/drv-protocol.h +++ b/source/drv-protocol.h @@ -26,12 +26,12 @@ /* Message logging helpers with driver-specific prefix string. */ #define DRIVER_LOG_DOMAIN "${short}: " -#define SR_LOG(l, s, args...) sr_log(l, DRIVER_LOG_DOMAIN s, ## args) -#define SR_SPEW(s, args...) sr_spew(DRIVER_LOG_DOMAIN s, ## args) -#define SR_DBG(s, args...) sr_dbg(DRIVER_LOG_DOMAIN s, ## args) -#define SR_INFO(s, args...) sr_info(DRIVER_LOG_DOMAIN s, ## args) -#define SR_WARN(s, args...) sr_warn(DRIVER_LOG_DOMAIN s, ## args) -#define SR_ERR(s, args...) sr_err(DRIVER_LOG_DOMAIN s, ## args) +#define sr_log(l, s, args...) sr_log(l, DRIVER_LOG_DOMAIN s, ## args) +#define sr_spew(s, args...) sr_spew(DRIVER_LOG_DOMAIN s, ## args) +#define sr_dbg(s, args...) sr_dbg(DRIVER_LOG_DOMAIN s, ## args) +#define sr_info(s, args...) sr_info(DRIVER_LOG_DOMAIN s, ## args) +#define sr_warn(s, args...) sr_warn(DRIVER_LOG_DOMAIN s, ## args) +#define sr_err(s, args...) sr_err(DRIVER_LOG_DOMAIN s, ## args) /** Private, per-device-instance driver context. */ struct dev_context {