Staging: media: clean dev_err logging
authorHaneen Mohammed <hamohammed.sa@gmail.com>
Fri, 6 Mar 2015 19:00:10 +0000 (22:00 +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/media/lirc/lirc_imon.c
drivers/staging/media/lirc/lirc_sasem.c
drivers/staging/media/omap4iss/iss.c
drivers/staging/media/omap4iss/iss_video.c

index 9ce7d9990e3e86981e7bd1bbd63b2ae0aae5a927..2e883e9457db97a50f908fca8fef1028bfdfe544 100644 (file)
@@ -208,8 +208,7 @@ static void deregister_from_lirc(struct imon_context *context)
        retval = lirc_unregister_driver(minor);
        if (retval)
                dev_err(&context->usbdev->dev,
-                       ": %s: unable to deregister from lirc(%d)",
-                       __func__, retval);
+                       "unable to deregister from lirc(%d)", retval);
        else
                dev_info(&context->usbdev->dev,
                         "Deregistered iMON driver (minor:%d)\n", minor);
@@ -241,9 +240,8 @@ static int display_open(struct inode *inode, struct file *file)
        context = usb_get_intfdata(interface);
 
        if (!context) {
-               dev_err(&interface->dev,
-                       "%s: no context found for minor %d\n",
-                       __func__, subminor);
+               dev_err(&interface->dev, "no context found for minor %d\n",
+                       subminor);
                retval = -ENODEV;
                goto exit;
        }
@@ -344,8 +342,8 @@ static int send_packet(struct imon_context *context)
        retval = usb_submit_urb(context->tx_urb, GFP_KERNEL);
        if (retval) {
                atomic_set(&(context->tx.busy), 0);
-               dev_err(&context->usbdev->dev,
-                       "%s: error submitting urb(%d)\n", __func__, retval);
+               dev_err(&context->usbdev->dev, "error submitting urb(%d)\n",
+                       retval);
        } else {
                /* Wait for transmission to complete (or abort) */
                mutex_unlock(&context->ctx_lock);
@@ -359,8 +357,7 @@ static int send_packet(struct imon_context *context)
                retval = context->tx.status;
                if (retval)
                        dev_err(&context->usbdev->dev,
-                               "%s: packet tx failed (%d)\n",
-                               __func__, retval);
+                               "packet tx failed (%d)\n", retval);
        }
 
        return retval;
@@ -437,8 +434,8 @@ static ssize_t vfd_write(struct file *file, const char __user *buf,
                retval = send_packet(context);
                if (retval) {
                        dev_err(&context->usbdev->dev,
-                               "%s: send packet failed for packet #%d\n",
-                               __func__, seq/2);
+                               "send packet failed for packet #%d\n",
+                               seq / 2);
                        goto exit;
                } else {
                        seq += 2;
@@ -454,8 +451,8 @@ static ssize_t vfd_write(struct file *file, const char __user *buf,
                retval = send_packet(context);
                if (retval)
                        dev_err(&context->usbdev->dev,
-                               "%s: send packet failed for packet #%d\n",
-                                       __func__, seq/2);
+                               "send packet failed for packet #%d\n",
+                               seq / 2);
        }
 
 exit:
@@ -877,8 +874,7 @@ static int imon_probe(struct usb_interface *interface,
        retval = usb_submit_urb(context->rx_urb, GFP_KERNEL);
 
        if (retval) {
-               dev_err(dev, "%s: usb_submit_urb failed for intf0 (%d)\n",
-                       __func__, retval);
+               dev_err(dev, "usb_submit_urb failed for intf0 (%d)\n", retval);
                alloc_status = 8;
                goto unlock;
        }
index 4a268200cbf55ce8d5d2cf3633697fc8fdaa8647..9944af1ba4d3249216f9f57632ce5077c3756a44 100644 (file)
@@ -214,9 +214,8 @@ static int vfd_open(struct inode *inode, struct file *file)
        context = usb_get_intfdata(interface);
 
        if (!context) {
-               dev_err(&interface->dev,
-                       "%s: no context found for minor %d\n",
-                       __func__, subminor);
+               dev_err(&interface->dev, "no context found for minor %d\n",
+                       subminor);
                retval = -ENODEV;
                goto exit;
        }
@@ -337,8 +336,8 @@ static int send_packet(struct sasem_context *context)
        retval =  usb_submit_urb(context->tx_urb, GFP_KERNEL);
        if (retval) {
                atomic_set(&(context->tx.busy), 0);
-               dev_err(&context->dev->dev, "%s: error submitting urb (%d)\n",
-                       __func__, retval);
+               dev_err(&context->dev->dev, "error submitting urb (%d)\n",
+                       retval);
        } else {
                /* Wait for transmission to complete (or abort) */
                mutex_unlock(&context->ctx_lock);
@@ -348,8 +347,7 @@ static int send_packet(struct sasem_context *context)
                retval = context->tx.status;
                if (retval)
                        dev_err(&context->dev->dev,
-                               "%s: packet tx failed (%d)\n",
-                               __func__, retval);
+                               "packet tx failed (%d)\n", retval);
        }
 
        return retval;
@@ -444,8 +442,7 @@ static ssize_t vfd_write(struct file *file, const char __user *buf,
                retval = send_packet(context);
                if (retval) {
                        dev_err(&context->dev->dev,
-                               "%s: send packet failed for packet #%d\n",
-                               __func__, i);
+                               "send packet failed for packet #%d\n", i);
                        goto exit;
                }
        }
@@ -509,8 +506,7 @@ static int ir_open(void *data)
 
        if (retval)
                dev_err(&context->dev->dev,
-                       "%s: usb_submit_urb failed for ir_open (%d)\n",
-                       __func__, retval);
+                       "usb_submit_urb failed for ir_open (%d)\n", retval);
        else {
                context->ir_isopen = 1;
                dev_info(&context->dev->dev, "IR port opened\n");
index 44b81a2c8b6f651a09d49c0c4da16019a52eabce..e0ad5e520e2d26705f43d1862de128ea428f20a6 100644 (file)
@@ -1160,8 +1160,8 @@ iss_register_subdev_group(struct iss_device *iss,
                subdev = v4l2_i2c_new_subdev_board(&iss->v4l2_dev, adapter,
                                board_info->board_info, NULL);
                if (subdev == NULL) {
-                       dev_err(iss->dev, "%s: Unable to register subdev %s\n",
-                               __func__, board_info->board_info->type);
+                       dev_err(iss->dev, "Unable to register subdev %s\n",
+                               board_info->board_info->type);
                        continue;
                }
 
@@ -1185,16 +1185,16 @@ static int iss_register_entities(struct iss_device *iss)
        iss->media_dev.link_notify = iss_pipeline_link_notify;
        ret = media_device_register(&iss->media_dev);
        if (ret < 0) {
-               dev_err(iss->dev, "%s: Media device registration failed (%d)\n",
-                       __func__, ret);
+               dev_err(iss->dev, "Media device registration failed (%d)\n",
+                       ret);
                return ret;
        }
 
        iss->v4l2_dev.mdev = &iss->media_dev;
        ret = v4l2_device_register(iss->dev, &iss->v4l2_dev);
        if (ret < 0) {
-               dev_err(iss->dev, "%s: V4L2 device registration failed (%d)\n",
-                       __func__, ret);
+               dev_err(iss->dev, "V4L2 device registration failed (%d)\n",
+                       ret);
                goto done;
        }
 
@@ -1252,8 +1252,8 @@ static int iss_register_entities(struct iss_device *iss)
                        break;
 
                default:
-                       dev_err(iss->dev, "%s: invalid interface type %u\n",
-                               __func__, subdevs->interface);
+                       dev_err(iss->dev, "invalid interface type %u\n",
+                               subdevs->interface);
                        ret = -EINVAL;
                        goto done;
                }
index 69550445a341ff6f39a571a9c72c37ecab435a04..55938cccde7f0114c395e03e8d39ddc060a9de56 100644 (file)
@@ -1221,8 +1221,7 @@ int omap4iss_video_register(struct iss_video *video, struct v4l2_device *vdev)
        ret = video_register_device(&video->video, VFL_TYPE_GRABBER, -1);
        if (ret < 0)
                dev_err(video->iss->dev,
-                       "%s: could not register video device (%d)\n",
-                       __func__, ret);
+                       "could not register video device (%d)\n", ret);
 
        return ret;
 }