From 3daf9df3bab88a14135b5b83713c64d5a58af60d Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Fri, 6 Mar 2015 22:03:53 +0300 Subject: [PATCH] Staging: iio: clean dev_err logging This patch removes __func__ from dev_err. dev_err includes information about: (devcice, driver, specific instance of device, etc) in the log printout. This was done using Coccinelle, with the following semantic patch: @a@ expression E, R; expression msg; @@ dev_err(E, msg, __func__, R); @script:python b@ e << a.msg; y; @@ if(e.find("%s: ") == True): m = e.replace("%s: ", "", 1); coccinelle.y = m; elif(e.find("%s ") == True): m = e.replace("%s ", "", 1); coccinelle.y = m; elif(e.find("%s:") == True): m = e.replace("%s:", "", 1); coccinelle.y = m; else: m = e.replace("%s", "",1); coccinelle.y = m; @c@ expression a.E, a.msg, a.R; identifier b.y; @@ - dev_err(E, msg, __func__, R); + dev_err(E, y, R); Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/light/isl29028.c | 8 +++--- drivers/staging/iio/light/tsl2x7x_core.c | 34 ++++++++++-------------- 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/drivers/staging/iio/light/isl29028.c b/drivers/staging/iio/light/isl29028.c index 6440e3b293ca..e5b2fdc2334b 100644 --- a/drivers/staging/iio/light/isl29028.c +++ b/drivers/staging/iio/light/isl29028.c @@ -441,15 +441,15 @@ static int isl29028_chip_init(struct isl29028_chip *chip) ret = isl29028_set_proxim_sampling(chip, chip->prox_sampling); if (ret < 0) { - dev_err(chip->dev, "%s(): setting the proximity, err = %d\n", - __func__, ret); + dev_err(chip->dev, "setting the proximity, err = %d\n", + ret); return ret; } ret = isl29028_set_als_scale(chip, chip->lux_scale); if (ret < 0) - dev_err(chip->dev, "%s(): setting als scale failed, err = %d\n", - __func__, ret); + dev_err(chip->dev, + "setting als scale failed, err = %d\n", ret); return ret; } diff --git a/drivers/staging/iio/light/tsl2x7x_core.c b/drivers/staging/iio/light/tsl2x7x_core.c index 4a5dc26fed4c..52f4e65fcdf1 100644 --- a/drivers/staging/iio/light/tsl2x7x_core.c +++ b/drivers/staging/iio/light/tsl2x7x_core.c @@ -301,8 +301,7 @@ tsl2x7x_i2c_read(struct i2c_client *client, u8 reg, u8 *val) /* select register to write */ ret = i2c_smbus_write_byte(client, (TSL2X7X_CMD_REG | reg)); if (ret < 0) { - dev_err(&client->dev, "%s: failed to write register %x\n" - , __func__, reg); + dev_err(&client->dev, "failed to write register %x\n", reg); return ret; } @@ -311,8 +310,7 @@ tsl2x7x_i2c_read(struct i2c_client *client, u8 reg, u8 *val) if (ret >= 0) *val = (u8)ret; else - dev_err(&client->dev, "%s: failed to read register %x\n" - , __func__, reg); + dev_err(&client->dev, "failed to read register %x\n", reg); return ret; } @@ -377,7 +375,7 @@ static int tsl2x7x_get_lux(struct iio_dev *indio_dev) &buf[i]); if (ret < 0) { dev_err(&chip->client->dev, - "%s: failed to read. err=%x\n", __func__, ret); + "failed to read. err=%x\n", ret); goto out_unlock; } } @@ -389,8 +387,7 @@ static int tsl2x7x_get_lux(struct iio_dev *indio_dev) TSL2X7X_CMD_ALS_INT_CLR)); if (ret < 0) { dev_err(&chip->client->dev, - "%s: i2c_write_command failed - err = %d\n", - __func__, ret); + "i2c_write_command failed - err = %d\n", ret); goto out_unlock; /* have no data, so return failure */ } @@ -493,8 +490,7 @@ static int tsl2x7x_get_prox(struct iio_dev *indio_dev) ret = tsl2x7x_i2c_read(chip->client, (TSL2X7X_CMD_REG | TSL2X7X_STATUS), &status); if (ret < 0) { - dev_err(&chip->client->dev, - "%s: i2c err=%d\n", __func__, ret); + dev_err(&chip->client->dev, "i2c err=%d\n", ret); goto prox_poll_err; } @@ -583,8 +579,7 @@ static int tsl2x7x_als_calibrate(struct iio_dev *indio_dev) (TSL2X7X_CMD_REG | TSL2X7X_CNTRL)); if (ret < 0) { dev_err(&chip->client->dev, - "%s: failed to write CNTRL register, ret=%d\n", - __func__, ret); + "failed to write CNTRL register, ret=%d\n", ret); return ret; } @@ -600,8 +595,7 @@ static int tsl2x7x_als_calibrate(struct iio_dev *indio_dev) (TSL2X7X_CMD_REG | TSL2X7X_CNTRL)); if (ret < 0) { dev_err(&chip->client->dev, - "%s: failed to write ctrl reg: ret=%d\n", - __func__, ret); + "failed to write ctrl reg: ret=%d\n", ret); return ret; } @@ -720,7 +714,7 @@ static int tsl2x7x_chip_on(struct iio_dev *indio_dev) TSL2X7X_CMD_REG + i, *dev_reg++); if (ret < 0) { dev_err(&chip->client->dev, - "%s: failed on write to reg %d.\n", __func__, i); + "failed on write to reg %d.\n", i); return ret; } } @@ -871,8 +865,8 @@ static void tsl2x7x_prox_cal(struct iio_dev *indio_dev) if (chip->tsl2x7x_settings.prox_max_samples_cal > MAX_SAMPLES_CAL) { dev_err(&chip->client->dev, - "%s: max prox samples cal is too big: %d\n", - __func__, chip->tsl2x7x_settings.prox_max_samples_cal); + "max prox samples cal is too big: %d\n", + chip->tsl2x7x_settings.prox_max_samples_cal); chip->tsl2x7x_settings.prox_max_samples_cal = MAX_SAMPLES_CAL; } @@ -1563,8 +1557,8 @@ static irqreturn_t tsl2x7x_event_handler(int irq, void *private) TSL2X7X_CMD_PROXALS_INT_CLR); if (ret < 0) dev_err(&chip->client->dev, - "%s: Failed to clear irq from event handler. err = %d\n", - __func__, ret); + "Failed to clear irq from event handler. err = %d\n", + ret); return IRQ_HANDLED; } @@ -1893,8 +1887,8 @@ static int tsl2x7x_probe(struct i2c_client *clientp, ret = i2c_smbus_write_byte(clientp, (TSL2X7X_CMD_REG | TSL2X7X_CNTRL)); if (ret < 0) { - dev_err(&clientp->dev, "%s: write to cmd reg failed. err = %d\n", - __func__, ret); + dev_err(&clientp->dev, "write to cmd reg failed. err = %d\n", + ret); return ret; } -- 2.39.5