[media] drivers/media/IR/imon.c: Use pr_err instead of err

Use the standard error logging mechanisms.
Add #define pr_fmt(fmt) KBUILD_MODNAME ":%s" fmt, __func__
Remove __func__ from err calls, add '\n', rename to pr_err

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Joe Perches 2010-06-20 04:20:46 -03:00 committed by Mauro Carvalho Chehab
parent 3074fc8432
commit e2302501c3
1 changed files with 34 additions and 39 deletions

View File

@ -26,6 +26,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
@ -371,15 +373,14 @@ static int display_open(struct inode *inode, struct file *file)
subminor = iminor(inode); subminor = iminor(inode);
interface = usb_find_interface(&imon_driver, subminor); interface = usb_find_interface(&imon_driver, subminor);
if (!interface) { if (!interface) {
err("%s: could not find interface for minor %d", pr_err("could not find interface for minor %d\n", subminor);
__func__, subminor);
retval = -ENODEV; retval = -ENODEV;
goto exit; goto exit;
} }
ictx = usb_get_intfdata(interface); ictx = usb_get_intfdata(interface);
if (!ictx) { if (!ictx) {
err("%s: no context found for minor %d", __func__, subminor); pr_err("no context found for minor %d\n", subminor);
retval = -ENODEV; retval = -ENODEV;
goto exit; goto exit;
} }
@ -387,10 +388,10 @@ static int display_open(struct inode *inode, struct file *file)
mutex_lock(&ictx->lock); mutex_lock(&ictx->lock);
if (!ictx->display_supported) { if (!ictx->display_supported) {
err("%s: display not supported by device", __func__); pr_err("display not supported by device\n");
retval = -ENODEV; retval = -ENODEV;
} else if (ictx->display_isopen) { } else if (ictx->display_isopen) {
err("%s: display port is already open", __func__); pr_err("display port is already open\n");
retval = -EBUSY; retval = -EBUSY;
} else { } else {
ictx->display_isopen = true; ictx->display_isopen = true;
@ -417,17 +418,17 @@ static int display_close(struct inode *inode, struct file *file)
ictx = file->private_data; ictx = file->private_data;
if (!ictx) { if (!ictx) {
err("%s: no context for device", __func__); pr_err("no context for device\n");
return -ENODEV; return -ENODEV;
} }
mutex_lock(&ictx->lock); mutex_lock(&ictx->lock);
if (!ictx->display_supported) { if (!ictx->display_supported) {
err("%s: display not supported by device", __func__); pr_err("display not supported by device\n");
retval = -ENODEV; retval = -ENODEV;
} else if (!ictx->display_isopen) { } else if (!ictx->display_isopen) {
err("%s: display is not open", __func__); pr_err("display is not open\n");
retval = -EIO; retval = -EIO;
} else { } else {
ictx->display_isopen = false; ictx->display_isopen = false;
@ -506,19 +507,19 @@ static int send_packet(struct imon_context *ictx)
if (retval) { if (retval) {
ictx->tx.busy = false; ictx->tx.busy = false;
smp_rmb(); /* ensure later readers know we're not busy */ smp_rmb(); /* ensure later readers know we're not busy */
err("%s: error submitting urb(%d)", __func__, retval); pr_err("error submitting urb(%d)\n", retval);
} else { } else {
/* Wait for transmission to complete (or abort) */ /* Wait for transmission to complete (or abort) */
mutex_unlock(&ictx->lock); mutex_unlock(&ictx->lock);
retval = wait_for_completion_interruptible( retval = wait_for_completion_interruptible(
&ictx->tx.finished); &ictx->tx.finished);
if (retval) if (retval)
err("%s: task interrupted", __func__); pr_err("task interrupted\n");
mutex_lock(&ictx->lock); mutex_lock(&ictx->lock);
retval = ictx->tx.status; retval = ictx->tx.status;
if (retval) if (retval)
err("%s: packet tx failed (%d)", __func__, retval); pr_err("packet tx failed (%d)\n", retval);
} }
kfree(control_req); kfree(control_req);
@ -550,12 +551,12 @@ static int send_associate_24g(struct imon_context *ictx)
0x00, 0x00, 0x00, 0x20 }; 0x00, 0x00, 0x00, 0x20 };
if (!ictx) { if (!ictx) {
err("%s: no context for device", __func__); pr_err("no context for device\n");
return -ENODEV; return -ENODEV;
} }
if (!ictx->dev_present_intf0) { if (!ictx->dev_present_intf0) {
err("%s: no iMON device present", __func__); pr_err("no iMON device present\n");
return -ENODEV; return -ENODEV;
} }
@ -583,7 +584,7 @@ static int send_set_imon_clock(struct imon_context *ictx,
int i; int i;
if (!ictx) { if (!ictx) {
err("%s: no context for device", __func__); pr_err("no context for device\n");
return -ENODEV; return -ENODEV;
} }
@ -644,8 +645,7 @@ static int send_set_imon_clock(struct imon_context *ictx,
memcpy(ictx->usb_tx_buf, clock_enable_pkt[i], 8); memcpy(ictx->usb_tx_buf, clock_enable_pkt[i], 8);
retval = send_packet(ictx); retval = send_packet(ictx);
if (retval) { if (retval) {
err("%s: send_packet failed for packet %d", pr_err("send_packet failed for packet %d\n", i);
__func__, i);
break; break;
} }
} }
@ -821,20 +821,20 @@ static ssize_t vfd_write(struct file *file, const char *buf,
ictx = file->private_data; ictx = file->private_data;
if (!ictx) { if (!ictx) {
err("%s: no context for device", __func__); pr_err("no context for device\n");
return -ENODEV; return -ENODEV;
} }
mutex_lock(&ictx->lock); mutex_lock(&ictx->lock);
if (!ictx->dev_present_intf0) { if (!ictx->dev_present_intf0) {
err("%s: no iMON device present", __func__); pr_err("no iMON device present\n");
retval = -ENODEV; retval = -ENODEV;
goto exit; goto exit;
} }
if (n_bytes <= 0 || n_bytes > 32) { if (n_bytes <= 0 || n_bytes > 32) {
err("%s: invalid payload size", __func__); pr_err("invalid payload size\n");
retval = -EINVAL; retval = -EINVAL;
goto exit; goto exit;
} }
@ -860,8 +860,7 @@ static ssize_t vfd_write(struct file *file, const char *buf,
retval = send_packet(ictx); retval = send_packet(ictx);
if (retval) { if (retval) {
err("%s: send packet failed for packet #%d", pr_err("send packet failed for packet #%d\n", seq / 2);
__func__, seq/2);
goto exit; goto exit;
} else { } else {
seq += 2; seq += 2;
@ -875,8 +874,7 @@ static ssize_t vfd_write(struct file *file, const char *buf,
ictx->usb_tx_buf[7] = (unsigned char) seq; ictx->usb_tx_buf[7] = (unsigned char) seq;
retval = send_packet(ictx); retval = send_packet(ictx);
if (retval) if (retval)
err("%s: send packet failed for packet #%d", pr_err("send packet failed for packet #%d\n", seq / 2);
__func__, seq / 2);
exit: exit:
mutex_unlock(&ictx->lock); mutex_unlock(&ictx->lock);
@ -905,21 +903,20 @@ static ssize_t lcd_write(struct file *file, const char *buf,
ictx = file->private_data; ictx = file->private_data;
if (!ictx) { if (!ictx) {
err("%s: no context for device", __func__); pr_err("no context for device\n");
return -ENODEV; return -ENODEV;
} }
mutex_lock(&ictx->lock); mutex_lock(&ictx->lock);
if (!ictx->display_supported) { if (!ictx->display_supported) {
err("%s: no iMON display present", __func__); pr_err("no iMON display present\n");
retval = -ENODEV; retval = -ENODEV;
goto exit; goto exit;
} }
if (n_bytes != 8) { if (n_bytes != 8) {
err("%s: invalid payload size: %d (expecting 8)", pr_err("invalid payload size: %d (expected 8)\n", (int)n_bytes);
__func__, (int) n_bytes);
retval = -EINVAL; retval = -EINVAL;
goto exit; goto exit;
} }
@ -931,7 +928,7 @@ static ssize_t lcd_write(struct file *file, const char *buf,
retval = send_packet(ictx); retval = send_packet(ictx);
if (retval) { if (retval) {
err("%s: send packet failed!", __func__); pr_err("send packet failed!\n");
goto exit; goto exit;
} else { } else {
dev_dbg(ictx->dev, "%s: write %d bytes to LCD\n", dev_dbg(ictx->dev, "%s: write %d bytes to LCD\n",
@ -2065,7 +2062,7 @@ static bool imon_find_endpoints(struct imon_context *ictx,
/* Input endpoint is mandatory */ /* Input endpoint is mandatory */
if (!ir_ep_found) if (!ir_ep_found)
err("%s: no valid input (IR) endpoint found.", __func__); pr_err("no valid input (IR) endpoint found\n");
ictx->tx_control = tx_control; ictx->tx_control = tx_control;
@ -2144,8 +2141,7 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf)
ret = usb_submit_urb(ictx->rx_urb_intf0, GFP_KERNEL); ret = usb_submit_urb(ictx->rx_urb_intf0, GFP_KERNEL);
if (ret) { if (ret) {
err("%s: usb_submit_urb failed for intf0 (%d)", pr_err("usb_submit_urb failed for intf0 (%d)\n", ret);
__func__, ret);
goto urb_submit_failed; goto urb_submit_failed;
} }
@ -2178,7 +2174,7 @@ static struct imon_context *imon_init_intf1(struct usb_interface *intf,
rx_urb = usb_alloc_urb(0, GFP_KERNEL); rx_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!rx_urb) { if (!rx_urb) {
err("%s: usb_alloc_urb failed for IR urb", __func__); pr_err("usb_alloc_urb failed for IR urb\n");
goto rx_urb_alloc_failed; goto rx_urb_alloc_failed;
} }
@ -2216,8 +2212,7 @@ static struct imon_context *imon_init_intf1(struct usb_interface *intf,
ret = usb_submit_urb(ictx->rx_urb_intf1, GFP_KERNEL); ret = usb_submit_urb(ictx->rx_urb_intf1, GFP_KERNEL);
if (ret) { if (ret) {
err("%s: usb_submit_urb failed for intf1 (%d)", pr_err("usb_submit_urb failed for intf1 (%d)\n", ret);
__func__, ret);
goto urb_submit_failed; goto urb_submit_failed;
} }
@ -2297,7 +2292,7 @@ static int __devinit imon_probe(struct usb_interface *interface,
if (ifnum == 0) { if (ifnum == 0) {
ictx = imon_init_intf0(interface); ictx = imon_init_intf0(interface);
if (!ictx) { if (!ictx) {
err("%s: failed to initialize context!\n", __func__); pr_err("failed to initialize context!\n");
ret = -ENODEV; ret = -ENODEV;
goto fail; goto fail;
} }
@ -2306,7 +2301,7 @@ static int __devinit imon_probe(struct usb_interface *interface,
/* this is the secondary interface on the device */ /* this is the secondary interface on the device */
ictx = imon_init_intf1(interface, first_if_ctx); ictx = imon_init_intf1(interface, first_if_ctx);
if (!ictx) { if (!ictx) {
err("%s: failed to attach to context!\n", __func__); pr_err("failed to attach to context!\n");
ret = -ENODEV; ret = -ENODEV;
goto fail; goto fail;
} }
@ -2320,8 +2315,8 @@ static int __devinit imon_probe(struct usb_interface *interface,
sysfs_err = sysfs_create_group(&interface->dev.kobj, sysfs_err = sysfs_create_group(&interface->dev.kobj,
&imon_rf_attribute_group); &imon_rf_attribute_group);
if (sysfs_err) if (sysfs_err)
err("%s: Could not create RF sysfs entries(%d)", pr_err("Could not create RF sysfs entries(%d)\n",
__func__, sysfs_err); sysfs_err);
} }
if (ictx->display_supported) if (ictx->display_supported)
@ -2469,7 +2464,7 @@ static int __init imon_init(void)
rc = usb_register(&imon_driver); rc = usb_register(&imon_driver);
if (rc) { if (rc) {
err("%s: usb register failed(%d)", __func__, rc); pr_err("usb register failed(%d)\n", rc);
rc = -ENODEV; rc = -ENODEV;
} }