Staging: comedi: clean dev_err logging
authorHaneen Mohammed <hamohammed.sa@gmail.com>
Fri, 6 Mar 2015 19:01:38 +0000 (22:01 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Mar 2015 23:55:36 +0000 (15:55 -0800)
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 <hamohammed.sa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/ni_mio_common.c
drivers/staging/comedi/drivers/usbduxsigma.c

index 176b64a6b567d50c1863ea1918461d64026e0e39..97728d25da53fd74a520b368c55e88aa29b83e32 100644 (file)
@@ -670,8 +670,8 @@ static inline void ni_set_bitfield(struct comedi_device *dev, int reg,
                ni_writeb(dev, devpriv->g0_g1_select_reg, G0_G1_Select);
                break;
        default:
-               dev_err(dev->class_dev,
-                       "%s called with invalid register %d\n", __func__, reg);
+               dev_err(dev->class_dev, "called with invalid register %d\n",
+                       reg);
                break;
        }
        mmiowb();
index 394969b7458c19df240d52cb1ad83bd2b61e1c7b..f50cf8a8dada58d5715e827e0aa6a3f678881ebd 100644 (file)
@@ -243,9 +243,8 @@ static void usbduxsigma_ai_handle_urb(struct comedi_device *dev,
                urb->dev = comedi_to_usb_dev(dev);
                ret = usb_submit_urb(urb, GFP_ATOMIC);
                if (ret < 0) {
-                       dev_err(dev->class_dev,
-                               "%s: urb resubmit failed (%d)\n",
-                               __func__, ret);
+                       dev_err(dev->class_dev, "urb resubmit failed (%d)\n",
+                               ret);
                        if (ret == -EL2NSYNC)
                                dev_err(dev->class_dev,
                                        "buggy USB host controller or bug in IRQ handler\n");
@@ -292,8 +291,8 @@ static void usbduxsigma_ai_urb_complete(struct urb *urb)
 
        default:
                /* a real error */
-               dev_err(dev->class_dev, "%s: non-zero urb status (%d)\n",
-                       __func__, urb->status);
+               dev_err(dev->class_dev, "non-zero urb status (%d)\n",
+                       urb->status);
                async->events |= COMEDI_CB_ERROR;
                break;
        }
@@ -386,9 +385,8 @@ static void usbduxsigma_ao_handle_urb(struct comedi_device *dev,
                urb->iso_frame_desc[0].status = 0;
                ret = usb_submit_urb(urb, GFP_ATOMIC);
                if (ret < 0) {
-                       dev_err(dev->class_dev,
-                               "%s: urb resubmit failed (%d)\n",
-                               __func__, ret);
+                       dev_err(dev->class_dev, "urb resubmit failed (%d)\n",
+                               ret);
                        if (ret == -EL2NSYNC)
                                dev_err(dev->class_dev,
                                        "buggy USB host controller or bug in IRQ handler\n");
@@ -423,8 +421,8 @@ static void usbduxsigma_ao_urb_complete(struct urb *urb)
 
        default:
                /* a real error */
-               dev_err(dev->class_dev, "%s: non-zero urb status (%d)\n",
-                       __func__, urb->status);
+               dev_err(dev->class_dev, "non-zero urb status (%d)\n",
+                       urb->status);
                async->events |= COMEDI_CB_ERROR;
                break;
        }
@@ -1071,9 +1069,8 @@ static void usbduxsigma_pwm_urb_complete(struct urb *urb)
        default:
                /* a real error */
                if (devpriv->pwm_cmd_running) {
-                       dev_err(dev->class_dev,
-                               "%s: non-zero urb status (%d)\n",
-                               __func__, urb->status);
+                       dev_err(dev->class_dev, "non-zero urb status (%d)\n",
+                               urb->status);
                        usbduxsigma_pwm_stop(dev, 0);   /* w/o unlink */
                }
                return;
@@ -1087,8 +1084,7 @@ static void usbduxsigma_pwm_urb_complete(struct urb *urb)
        urb->status = 0;
        ret = usb_submit_urb(urb, GFP_ATOMIC);
        if (ret < 0) {
-               dev_err(dev->class_dev, "%s: urb resubmit failed (%d)\n",
-                       __func__, ret);
+               dev_err(dev->class_dev, "urb resubmit failed (%d)\n", ret);
                if (ret == -EL2NSYNC)
                        dev_err(dev->class_dev,
                                "buggy USB host controller or bug in IRQ handler\n");