From 6fc3ac83717169a4e73906824fd4e4102f4358ba Mon Sep 17 00:00:00 2001 From: Bas Stottelaar Date: Fri, 23 Oct 2020 00:47:28 +0200 Subject: [PATCH] drivers/*: remove unneeded ENABLE_DEBUG --- drivers/itg320x/itg320x.c | 22 +++++++--------------- drivers/pca9685/pca9685.c | 8 -------- drivers/tps6274x/tps6274x.c | 11 ++++------- 3 files changed, 11 insertions(+), 30 deletions(-) diff --git a/drivers/itg320x/itg320x.c b/drivers/itg320x/itg320x.c index 147463899d..d82b002e35 100644 --- a/drivers/itg320x/itg320x.c +++ b/drivers/itg320x/itg320x.c @@ -28,18 +28,10 @@ #define ENABLE_DEBUG 0 #include "debug.h" -#if ENABLE_DEBUG - #define DEBUG_DEV(f, d, ...) \ DEBUG("[itg320x] %s i2c dev=%d addr=%02x: " f "\n", \ __func__, d->params.dev, d->params.addr, ## __VA_ARGS__); -#else /* ENABLE_DEBUG */ - -#define DEBUG_DEV(f, d, ...) - -#endif /* ENABLE_DEBUG */ - #define ERROR_DEV(f, d, ...) \ do { \ LOG_ERROR("[itg320x] %s i2c dev=%d addr=%02x: " f "\n", \ @@ -322,14 +314,14 @@ static int _reg_read(const itg320x_t *dev, uint8_t reg, uint8_t *data, uint16_t return ITG320X_ERROR_I2C; } -#if ENABLE_DEBUG - printf("[itg320x] %s i2c dev=%d addr=%02x: read %d bytes from reg 0x%02x: ", - __func__, dev->params.dev, dev->params.addr, len, reg); - for (int i = 0; i < len; i++) { - printf("%02x ", data[i]); + if (IS_ACTIVE(ENABLE_DEBUG)) { + printf("[itg320x] %s i2c dev=%d addr=%02x: read %d bytes from reg 0x%02x: ", + __func__, dev->params.dev, dev->params.addr, len, reg); + for (unsigned i = 0; i < len; i++) { + printf("%02x ", data[i]); + } + printf("\n"); } - printf("\n"); -#endif return ITG320X_OK; } diff --git a/drivers/pca9685/pca9685.c b/drivers/pca9685/pca9685.c index 61fcbd05fe..9030062f39 100644 --- a/drivers/pca9685/pca9685.c +++ b/drivers/pca9685/pca9685.c @@ -29,8 +29,6 @@ #define ENABLE_DEBUG 0 #include "debug.h" -#if ENABLE_DEBUG - #define ASSERT_PARAM(cond) \ do { \ if (!(cond)) { \ @@ -44,12 +42,6 @@ DEBUG("[pca9685] %s i2c dev=%d addr=%02x: " f "\n", \ __func__, d->params.i2c_dev, dev->params.i2c_addr, ## __VA_ARGS__) -#else /* ENABLE_DEBUG */ - -#define ASSERT_PARAM(cond) assert(cond) -#define DEBUG_DEV(f, d, ...) - -#endif /* ENABLE_DEBUG */ #define ERROR_DEV(f, d, ...) \ LOG_ERROR("[pca9685] %s i2c dev=%d addr=%02x: " f "\n", \ __func__, d->params.i2c_dev, dev->params.i2c_addr, ## __VA_ARGS__) diff --git a/drivers/tps6274x/tps6274x.c b/drivers/tps6274x/tps6274x.c index 48b0fa5579..065fafd382 100644 --- a/drivers/tps6274x/tps6274x.c +++ b/drivers/tps6274x/tps6274x.c @@ -63,12 +63,10 @@ uint16_t tps6274x_switch_voltage(tps6274x_t *dev, uint16_t voltage) /* mark pins that could and had to be set */ vsel_set |= vsel & (1 << i); } -#if ENABLE_DEBUG else { - printf("[tps6274x] Pin vsel%u is not connected but is required for \ - selected voltage level\n", i + 1); + DEBUG("[tps6274x] Pin vsel%u is not connected but is required for " + "selected voltage level\n", i + 1); } -#endif } return ((uint16_t)vsel_set) * 100 + 1800; } @@ -78,9 +76,8 @@ void tps6274x_load_ctrl(tps6274x_t *dev, int status) if (gpio_is_valid(dev->params.ctrl_pin)) { gpio_write(dev->params.ctrl_pin, status); } -#if ENABLE_DEBUG else { - printf("[TPS6274x] CTRL Pin not defined, no load activation possible\n"); + DEBUG("[tps6274x] CTRL Pin not defined, no load activation " + "possible\n"); } -#endif }