Commit e0ebe945 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Staging: media: lirc: lirc_imon: remove err() usage

err() was a very old USB-specific macro that I thought had
gone away.  This patch removes it from being used in the
driver and uses dev_err() instead.

Cc: Jarod Wilson <jarod@wilsonet.com>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent dfcf931a
...@@ -209,7 +209,8 @@ static void deregister_from_lirc(struct imon_context *context) ...@@ -209,7 +209,8 @@ static void deregister_from_lirc(struct imon_context *context)
retval = lirc_unregister_driver(minor); retval = lirc_unregister_driver(minor);
if (retval) if (retval)
err("%s: unable to deregister from lirc(%d)", printk(KERN_ERR KBUILD_MODNAME
": %s: unable to deregister from lirc(%d)",
__func__, retval); __func__, retval);
else else
printk(KERN_INFO MOD_NAME ": Deregistered iMON driver " printk(KERN_INFO MOD_NAME ": Deregistered iMON driver "
...@@ -234,7 +235,8 @@ static int display_open(struct inode *inode, struct file *file) ...@@ -234,7 +235,8 @@ 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", printk(KERN_ERR KBUILD_MODNAME
": %s: could not find interface for minor %d\n",
__func__, subminor); __func__, subminor);
retval = -ENODEV; retval = -ENODEV;
goto exit; goto exit;
...@@ -242,7 +244,8 @@ static int display_open(struct inode *inode, struct file *file) ...@@ -242,7 +244,8 @@ static int display_open(struct inode *inode, struct file *file)
context = usb_get_intfdata(interface); context = usb_get_intfdata(interface);
if (!context) { if (!context) {
err("%s: no context found for minor %d", dev_err(&interface->dev,
"%s: no context found for minor %d\n",
__func__, subminor); __func__, subminor);
retval = -ENODEV; retval = -ENODEV;
goto exit; goto exit;
...@@ -251,10 +254,12 @@ static int display_open(struct inode *inode, struct file *file) ...@@ -251,10 +254,12 @@ static int display_open(struct inode *inode, struct file *file)
mutex_lock(&context->ctx_lock); mutex_lock(&context->ctx_lock);
if (!context->display) { if (!context->display) {
err("%s: display not supported by device", __func__); dev_err(&interface->dev,
"%s: display not supported by device\n", __func__);
retval = -ENODEV; retval = -ENODEV;
} else if (context->display_isopen) { } else if (context->display_isopen) {
err("%s: display port is already open", __func__); dev_err(&interface->dev,
"%s: display port is already open\n", __func__);
retval = -EBUSY; retval = -EBUSY;
} else { } else {
context->display_isopen = 1; context->display_isopen = 1;
...@@ -281,17 +286,20 @@ static int display_close(struct inode *inode, struct file *file) ...@@ -281,17 +286,20 @@ static int display_close(struct inode *inode, struct file *file)
context = file->private_data; context = file->private_data;
if (!context) { if (!context) {
err("%s: no context for device", __func__); printk(KERN_ERR KBUILD_MODNAME
"%s: no context for device\n", __func__);
return -ENODEV; return -ENODEV;
} }
mutex_lock(&context->ctx_lock); mutex_lock(&context->ctx_lock);
if (!context->display) { if (!context->display) {
err("%s: display not supported by device", __func__); dev_err(&context->usbdev->dev,
"%s: display not supported by device\n", __func__);
retval = -ENODEV; retval = -ENODEV;
} else if (!context->display_isopen) { } else if (!context->display_isopen) {
err("%s: display is not open", __func__); dev_err(&context->usbdev->dev,
"%s: display is not open\n", __func__);
retval = -EIO; retval = -EIO;
} else { } else {
context->display_isopen = 0; context->display_isopen = 0;
...@@ -340,19 +348,23 @@ static int send_packet(struct imon_context *context) ...@@ -340,19 +348,23 @@ static int send_packet(struct imon_context *context)
retval = usb_submit_urb(context->tx_urb, GFP_KERNEL); retval = usb_submit_urb(context->tx_urb, GFP_KERNEL);
if (retval) { if (retval) {
atomic_set(&(context->tx.busy), 0); atomic_set(&(context->tx.busy), 0);
err("%s: error submitting urb(%d)", __func__, retval); dev_err(&context->usbdev->dev,
"%s: error submitting urb(%d)\n", __func__, retval);
} else { } else {
/* Wait for transmission to complete (or abort) */ /* Wait for transmission to complete (or abort) */
mutex_unlock(&context->ctx_lock); mutex_unlock(&context->ctx_lock);
retval = wait_for_completion_interruptible( retval = wait_for_completion_interruptible(
&context->tx.finished); &context->tx.finished);
if (retval) if (retval)
err("%s: task interrupted", __func__); dev_err(&context->usbdev->dev,
"%s: task interrupted\n", __func__);
mutex_lock(&context->ctx_lock); mutex_lock(&context->ctx_lock);
retval = context->tx.status; retval = context->tx.status;
if (retval) if (retval)
err("%s: packet tx failed (%d)", __func__, retval); dev_err(&context->usbdev->dev,
"%s: packet tx failed (%d)\n",
__func__, retval);
} }
return retval; return retval;
...@@ -383,20 +395,23 @@ static ssize_t vfd_write(struct file *file, const char __user *buf, ...@@ -383,20 +395,23 @@ static ssize_t vfd_write(struct file *file, const char __user *buf,
context = file->private_data; context = file->private_data;
if (!context) { if (!context) {
err("%s: no context for device", __func__); printk(KERN_ERR KBUILD_MODNAME
"%s: no context for device\n", __func__);
return -ENODEV; return -ENODEV;
} }
mutex_lock(&context->ctx_lock); mutex_lock(&context->ctx_lock);
if (!context->dev_present) { if (!context->dev_present) {
err("%s: no iMON device present", __func__); dev_err(&context->usbdev->dev,
"%s: no iMON device present\n", __func__);
retval = -ENODEV; retval = -ENODEV;
goto exit; goto exit;
} }
if (n_bytes <= 0 || n_bytes > IMON_DATA_BUF_SZ - 3) { if (n_bytes <= 0 || n_bytes > IMON_DATA_BUF_SZ - 3) {
err("%s: invalid payload size", __func__); dev_err(&context->usbdev->dev,
"%s: invalid payload size\n", __func__);
retval = -EINVAL; retval = -EINVAL;
goto exit; goto exit;
} }
...@@ -425,7 +440,8 @@ static ssize_t vfd_write(struct file *file, const char __user *buf, ...@@ -425,7 +440,8 @@ static ssize_t vfd_write(struct file *file, const char __user *buf,
retval = send_packet(context); retval = send_packet(context);
if (retval) { if (retval) {
err("%s: send packet failed for packet #%d", dev_err(&context->usbdev->dev,
"%s: send packet failed for packet #%d\n",
__func__, seq/2); __func__, seq/2);
goto exit; goto exit;
} else { } else {
...@@ -441,7 +457,8 @@ static ssize_t vfd_write(struct file *file, const char __user *buf, ...@@ -441,7 +457,8 @@ static ssize_t vfd_write(struct file *file, const char __user *buf,
context->usb_tx_buf[7] = (unsigned char) seq; context->usb_tx_buf[7] = (unsigned char) seq;
retval = send_packet(context); retval = send_packet(context);
if (retval) if (retval)
err("%s: send packet failed for packet #%d", dev_err(&context->usbdev->dev,
"%s: send packet failed for packet #%d\n",
__func__, seq/2); __func__, seq/2);
} }
...@@ -508,7 +525,8 @@ static void ir_close(void *data) ...@@ -508,7 +525,8 @@ static void ir_close(void *data)
context = (struct imon_context *)data; context = (struct imon_context *)data;
if (!context) { if (!context) {
err("%s: no context for device", __func__); printk(KERN_ERR KBUILD_MODNAME
"%s: no context for device\n", __func__);
return; return;
} }
...@@ -732,7 +750,7 @@ static int imon_probe(struct usb_interface *interface, ...@@ -732,7 +750,7 @@ static int imon_probe(struct usb_interface *interface,
context = kzalloc(sizeof(struct imon_context), GFP_KERNEL); context = kzalloc(sizeof(struct imon_context), GFP_KERNEL);
if (!context) { if (!context) {
err("%s: kzalloc failed for context", __func__); dev_err(dev, "%s: kzalloc failed for context\n", __func__);
alloc_status = 1; alloc_status = 1;
goto alloc_status_switch; goto alloc_status_switch;
} }
...@@ -797,7 +815,7 @@ static int imon_probe(struct usb_interface *interface, ...@@ -797,7 +815,7 @@ static int imon_probe(struct usb_interface *interface,
/* 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__); dev_err(dev, "%s: no valid input (IR) endpoint found.\n", __func__);
retval = -ENODEV; retval = -ENODEV;
alloc_status = 2; alloc_status = 2;
goto alloc_status_switch; goto alloc_status_switch;
...@@ -814,30 +832,30 @@ static int imon_probe(struct usb_interface *interface, ...@@ -814,30 +832,30 @@ static int imon_probe(struct usb_interface *interface,
driver = kzalloc(sizeof(struct lirc_driver), GFP_KERNEL); driver = kzalloc(sizeof(struct lirc_driver), GFP_KERNEL);
if (!driver) { if (!driver) {
err("%s: kzalloc failed for lirc_driver", __func__); dev_err(dev, "%s: kzalloc failed for lirc_driver\n", __func__);
alloc_status = 2; alloc_status = 2;
goto alloc_status_switch; goto alloc_status_switch;
} }
rbuf = kmalloc(sizeof(struct lirc_buffer), GFP_KERNEL); rbuf = kmalloc(sizeof(struct lirc_buffer), GFP_KERNEL);
if (!rbuf) { if (!rbuf) {
err("%s: kmalloc failed for lirc_buffer", __func__); dev_err(dev, "%s: kmalloc failed for lirc_buffer\n", __func__);
alloc_status = 3; alloc_status = 3;
goto alloc_status_switch; goto alloc_status_switch;
} }
if (lirc_buffer_init(rbuf, BUF_CHUNK_SIZE, BUF_SIZE)) { if (lirc_buffer_init(rbuf, BUF_CHUNK_SIZE, BUF_SIZE)) {
err("%s: lirc_buffer_init failed", __func__); dev_err(dev, "%s: lirc_buffer_init failed\n", __func__);
alloc_status = 4; alloc_status = 4;
goto alloc_status_switch; goto alloc_status_switch;
} }
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__); dev_err(dev, "%s: usb_alloc_urb failed for IR urb\n", __func__);
alloc_status = 5; alloc_status = 5;
goto alloc_status_switch; goto alloc_status_switch;
} }
tx_urb = usb_alloc_urb(0, GFP_KERNEL); tx_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!tx_urb) { if (!tx_urb) {
err("%s: usb_alloc_urb failed for display urb", dev_err(dev, "%s: usb_alloc_urb failed for display urb\n",
__func__); __func__);
alloc_status = 6; alloc_status = 6;
goto alloc_status_switch; goto alloc_status_switch;
...@@ -865,7 +883,7 @@ static int imon_probe(struct usb_interface *interface, ...@@ -865,7 +883,7 @@ static int imon_probe(struct usb_interface *interface,
lirc_minor = lirc_register_driver(driver); lirc_minor = lirc_register_driver(driver);
if (lirc_minor < 0) { if (lirc_minor < 0) {
err("%s: lirc_register_driver failed", __func__); dev_err(dev, "%s: lirc_register_driver failed\n", __func__);
alloc_status = 7; alloc_status = 7;
goto unlock; goto unlock;
} else } else
...@@ -900,7 +918,7 @@ static int imon_probe(struct usb_interface *interface, ...@@ -900,7 +918,7 @@ static int imon_probe(struct usb_interface *interface,
retval = usb_submit_urb(context->rx_urb, GFP_KERNEL); retval = usb_submit_urb(context->rx_urb, GFP_KERNEL);
if (retval) { if (retval) {
err("%s: usb_submit_urb failed for intf0 (%d)", dev_err(dev, "%s: usb_submit_urb failed for intf0 (%d)\n",
__func__, retval); __func__, retval);
mutex_unlock(&context->ctx_lock); mutex_unlock(&context->ctx_lock);
goto exit; goto exit;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment