All of lore.kernel.org
 help / color / mirror / Atom feed
From: Haneen Mohammed <hamohammed.sa@gmail.com>
To: outreachy-kernel@googlegroups.com
Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
Subject: [PATCH 3/7] Staging: iio: Clean dev_err() logging
Date: Thu,  5 Mar 2015 22:37:10 +0300	[thread overview]
Message-ID: <1425584230-28217-1-git-send-email-hamohammed.sa@gmail.com> (raw)
In-Reply-To: <1425583768-27996-1-git-send-email-hamohammed.sa@gmail.com>

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;
expression  msg;
@@

dev_err(E, msg, __func__);

@script:python b@git rebae -i
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;
identifier  b.y;
@@

- dev_err(E, msg, __func__);
+ dev_err(E, y);

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
---
 drivers/staging/iio/light/tsl2x7x_core.c | 38 +++++++++++---------------------
 1 file changed, 13 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/iio/light/tsl2x7x_core.c b/drivers/staging/iio/light/tsl2x7x_core.c
index 4a5dc26..1222a57 100644
--- a/drivers/staging/iio/light/tsl2x7x_core.c
+++ b/drivers/staging/iio/light/tsl2x7x_core.c
@@ -350,8 +350,7 @@ static int tsl2x7x_get_lux(struct iio_dev *indio_dev)
 
 	if (chip->tsl2x7x_chip_status != TSL2X7X_CHIP_WORKING) {
 		/* device is not enabled */
-		dev_err(&chip->client->dev, "%s: device is not enabled\n",
-				__func__);
+		dev_err(&chip->client->dev, "device is not enabled\n");
 		ret = -EBUSY;
 		goto out_unlock;
 	}
@@ -359,14 +358,12 @@ static int tsl2x7x_get_lux(struct iio_dev *indio_dev)
 	ret = tsl2x7x_i2c_read(chip->client,
 		(TSL2X7X_CMD_REG | TSL2X7X_STATUS), &buf[0]);
 	if (ret < 0) {
-		dev_err(&chip->client->dev,
-			"%s: Failed to read STATUS Reg\n", __func__);
+		dev_err(&chip->client->dev, "Failed to read STATUS Reg\n");
 		goto out_unlock;
 	}
 	/* is data new & valid */
 	if (!(buf[0] & TSL2X7X_STA_ADC_VALID)) {
-		dev_err(&chip->client->dev,
-			"%s: data not valid yet\n", __func__);
+		dev_err(&chip->client->dev, "data not valid yet\n");
 		ret = chip->als_cur_info.lux; /* return LAST VALUE */
 		goto out_unlock;
 	}
@@ -485,8 +482,7 @@ static int tsl2x7x_get_prox(struct iio_dev *indio_dev)
 	struct tsl2X7X_chip *chip = iio_priv(indio_dev);
 
 	if (mutex_trylock(&chip->prox_mutex) == 0) {
-		dev_err(&chip->client->dev,
-			"%s: Can't get prox mutex\n", __func__);
+		dev_err(&chip->client->dev, "Can't get prox mutex\n");
 		return -EBUSY;
 	}
 
@@ -591,8 +587,7 @@ static int tsl2x7x_als_calibrate(struct iio_dev *indio_dev)
 	reg_val = i2c_smbus_read_byte(chip->client);
 	if ((reg_val & (TSL2X7X_CNTL_ADC_ENBL | TSL2X7X_CNTL_PWR_ON))
 		!= (TSL2X7X_CNTL_ADC_ENBL | TSL2X7X_CNTL_PWR_ON)) {
-		dev_err(&chip->client->dev,
-			"%s: failed: ADC not enabled\n", __func__);
+		dev_err(&chip->client->dev, "failed: ADC not enabled\n");
 		return -1;
 	}
 
@@ -608,14 +603,13 @@ static int tsl2x7x_als_calibrate(struct iio_dev *indio_dev)
 	reg_val = i2c_smbus_read_byte(chip->client);
 	if ((reg_val & TSL2X7X_STA_ADC_VALID) != TSL2X7X_STA_ADC_VALID) {
 		dev_err(&chip->client->dev,
-			"%s: failed: STATUS - ADC not valid.\n", __func__);
+			"failed: STATUS - ADC not valid.\n");
 		return -ENODATA;
 	}
 
 	lux_val = tsl2x7x_get_lux(indio_dev);
 	if (lux_val < 0) {
-		dev_err(&chip->client->dev,
-		"%s: failed to get lux\n", __func__);
+		dev_err(&chip->client->dev, "failed to get lux\n");
 		return lux_val;
 	}
 
@@ -707,8 +701,7 @@ static int tsl2x7x_chip_on(struct iio_dev *indio_dev)
 	ret = i2c_smbus_write_byte_data(chip->client,
 		TSL2X7X_CMD_REG | TSL2X7X_CNTRL, utmp);
 	if (ret < 0) {
-		dev_err(&chip->client->dev,
-			"%s: failed on CNTRL reg.\n", __func__);
+		dev_err(&chip->client->dev, "failed on CNTRL reg.\n");
 		return ret;
 	}
 
@@ -735,8 +728,7 @@ static int tsl2x7x_chip_on(struct iio_dev *indio_dev)
 	ret = i2c_smbus_write_byte_data(chip->client,
 			TSL2X7X_CMD_REG | TSL2X7X_CNTRL, utmp);
 	if (ret < 0) {
-		dev_err(&chip->client->dev,
-			"%s: failed on 2nd CTRL reg.\n", __func__);
+		dev_err(&chip->client->dev, "failed on 2nd CTRL reg.\n");
 		return ret;
 	}
 
@@ -755,8 +747,7 @@ static int tsl2x7x_chip_on(struct iio_dev *indio_dev)
 			(TSL2X7X_CMD_REG | TSL2X7X_CNTRL), reg_val);
 		if (ret < 0)
 			dev_err(&chip->client->dev,
-				"%s: failed in tsl2x7x_IOCTL_INT_SET.\n",
-				__func__);
+				"failed in tsl2x7x_IOCTL_INT_SET.\n");
 
 		/* Clear out any initial interrupts  */
 		ret = i2c_smbus_write_byte(chip->client,
@@ -764,8 +755,7 @@ static int tsl2x7x_chip_on(struct iio_dev *indio_dev)
 			TSL2X7X_CMD_PROXALS_INT_CLR);
 		if (ret < 0) {
 			dev_err(&chip->client->dev,
-				"%s: Failed to clear Int status\n",
-				__func__);
+				"Failed to clear Int status\n");
 		return ret;
 		}
 	}
@@ -1925,8 +1915,7 @@ static int tsl2x7x_probe(struct i2c_client *clientp,
 						"TSL2X7X_event",
 						indio_dev);
 		if (ret) {
-			dev_err(&clientp->dev,
-				"%s: irq request failed", __func__);
+			dev_err(&clientp->dev, "irq request failed");
 			return ret;
 		}
 	}
@@ -1938,8 +1927,7 @@ static int tsl2x7x_probe(struct i2c_client *clientp,
 
 	ret = iio_device_register(indio_dev);
 	if (ret) {
-		dev_err(&clientp->dev,
-			"%s: iio registration failed\n", __func__);
+		dev_err(&clientp->dev, "iio registration failed\n");
 		return ret;
 	}
 
-- 
1.9.1



  parent reply	other threads:[~2015-03-05 19:37 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-05 19:29 [PATCH 0/7] Staging: clean de_err() loging Haneen Mohammed
2015-03-05 19:31 ` [PATCH 1/7] Staging: media: Clean dev_err() logging Haneen Mohammed
2015-03-05 19:35 ` [PATCH 2/7] Staging: fbtft: " Haneen Mohammed
2015-03-05 19:37 ` Haneen Mohammed [this message]
2015-03-05 19:38 ` [PATCH 4/7] Staging: octeon-usb: " Haneen Mohammed
2015-03-05 19:38 ` [PATCH 5/7] Staging: slicoss: " Haneen Mohammed
2015-03-05 19:42 ` [PATCH 6/7] Staging: gdm72xx: " Haneen Mohammed
2015-03-05 19:43 ` [PATCH 7/7] Staging: ste_rmi4: " Haneen Mohammed
2015-03-05 20:40   ` [Outreachy kernel] " Julia Lawall
2015-03-05 21:02     ` Haneen Mohammed
2015-03-05 21:29 ` [PATCH v2 0/7] Staging: clean de_err() loging Haneen Mohammed
2015-03-05 21:36 ` [PATCH v3 0/7]Staging: " Haneen Mohammed
2015-03-05 21:42 ` [PATCH v3 1/7] Staging: media: Clean dev_err() logging Haneen Mohammed
2015-03-06 23:52   ` [Outreachy kernel] " Greg KH
2015-03-05 21:44 ` [PATCH v3 2/7] Staging: fbtft: " Haneen Mohammed
2015-03-05 21:46 ` [PATCH v3 3/7] Staging: iio: " Haneen Mohammed
2015-03-05 21:48 ` [PATCH v3 4/7] Staging: octeon-usb: " Haneen Mohammed
2015-03-05 21:50 ` [PATCH v3 5/7] Staging: slicoss: " Haneen Mohammed
2015-03-05 21:52 ` [PATCH v3 6/7] Staging: gdm72xx: " Haneen Mohammed
2015-03-05 21:55 ` [PATCH v3 7/7] Staging: ste_rmi4: " Haneen Mohammed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1425584230-28217-1-git-send-email-hamohammed.sa@gmail.com \
    --to=hamohammed.sa@gmail.com \
    --cc=outreachy-kernel@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.