forked from Minki/linux
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
dfcf931a94
commit
e0ebe945c5
@ -209,8 +209,9 @@ static void deregister_from_lirc(struct imon_context *context)
|
||||
|
||||
retval = lirc_unregister_driver(minor);
|
||||
if (retval)
|
||||
err("%s: unable to deregister from lirc(%d)",
|
||||
__func__, retval);
|
||||
printk(KERN_ERR KBUILD_MODNAME
|
||||
": %s: unable to deregister from lirc(%d)",
|
||||
__func__, retval);
|
||||
else
|
||||
printk(KERN_INFO MOD_NAME ": Deregistered iMON driver "
|
||||
"(minor:%d)\n", minor);
|
||||
@ -234,16 +235,18 @@ static int display_open(struct inode *inode, struct file *file)
|
||||
subminor = iminor(inode);
|
||||
interface = usb_find_interface(&imon_driver, subminor);
|
||||
if (!interface) {
|
||||
err("%s: could not find interface for minor %d",
|
||||
__func__, subminor);
|
||||
printk(KERN_ERR KBUILD_MODNAME
|
||||
": %s: could not find interface for minor %d\n",
|
||||
__func__, subminor);
|
||||
retval = -ENODEV;
|
||||
goto exit;
|
||||
}
|
||||
context = usb_get_intfdata(interface);
|
||||
|
||||
if (!context) {
|
||||
err("%s: no context found for minor %d",
|
||||
__func__, subminor);
|
||||
dev_err(&interface->dev,
|
||||
"%s: no context found for minor %d\n",
|
||||
__func__, subminor);
|
||||
retval = -ENODEV;
|
||||
goto exit;
|
||||
}
|
||||
@ -251,10 +254,12 @@ static int display_open(struct inode *inode, struct file *file)
|
||||
mutex_lock(&context->ctx_lock);
|
||||
|
||||
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;
|
||||
} 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;
|
||||
} else {
|
||||
context->display_isopen = 1;
|
||||
@ -281,17 +286,20 @@ static int display_close(struct inode *inode, struct file *file)
|
||||
context = file->private_data;
|
||||
|
||||
if (!context) {
|
||||
err("%s: no context for device", __func__);
|
||||
printk(KERN_ERR KBUILD_MODNAME
|
||||
"%s: no context for device\n", __func__);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
mutex_lock(&context->ctx_lock);
|
||||
|
||||
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;
|
||||
} 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;
|
||||
} else {
|
||||
context->display_isopen = 0;
|
||||
@ -340,19 +348,23 @@ 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);
|
||||
err("%s: error submitting urb(%d)", __func__, retval);
|
||||
dev_err(&context->usbdev->dev,
|
||||
"%s: error submitting urb(%d)\n", __func__, retval);
|
||||
} else {
|
||||
/* Wait for transmission to complete (or abort) */
|
||||
mutex_unlock(&context->ctx_lock);
|
||||
retval = wait_for_completion_interruptible(
|
||||
&context->tx.finished);
|
||||
if (retval)
|
||||
err("%s: task interrupted", __func__);
|
||||
dev_err(&context->usbdev->dev,
|
||||
"%s: task interrupted\n", __func__);
|
||||
mutex_lock(&context->ctx_lock);
|
||||
|
||||
retval = context->tx.status;
|
||||
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;
|
||||
@ -383,20 +395,23 @@ static ssize_t vfd_write(struct file *file, const char __user *buf,
|
||||
|
||||
context = file->private_data;
|
||||
if (!context) {
|
||||
err("%s: no context for device", __func__);
|
||||
printk(KERN_ERR KBUILD_MODNAME
|
||||
"%s: no context for device\n", __func__);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
mutex_lock(&context->ctx_lock);
|
||||
|
||||
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;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
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;
|
||||
goto exit;
|
||||
}
|
||||
@ -425,8 +440,9 @@ static ssize_t vfd_write(struct file *file, const char __user *buf,
|
||||
|
||||
retval = send_packet(context);
|
||||
if (retval) {
|
||||
err("%s: send packet failed for packet #%d",
|
||||
__func__, seq/2);
|
||||
dev_err(&context->usbdev->dev,
|
||||
"%s: send packet failed for packet #%d\n",
|
||||
__func__, seq/2);
|
||||
goto exit;
|
||||
} else {
|
||||
seq += 2;
|
||||
@ -441,7 +457,8 @@ static ssize_t vfd_write(struct file *file, const char __user *buf,
|
||||
context->usb_tx_buf[7] = (unsigned char) seq;
|
||||
retval = send_packet(context);
|
||||
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);
|
||||
}
|
||||
|
||||
@ -508,7 +525,8 @@ static void ir_close(void *data)
|
||||
|
||||
context = (struct imon_context *)data;
|
||||
if (!context) {
|
||||
err("%s: no context for device", __func__);
|
||||
printk(KERN_ERR KBUILD_MODNAME
|
||||
"%s: no context for device\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -732,7 +750,7 @@ static int imon_probe(struct usb_interface *interface,
|
||||
|
||||
context = kzalloc(sizeof(struct imon_context), GFP_KERNEL);
|
||||
if (!context) {
|
||||
err("%s: kzalloc failed for context", __func__);
|
||||
dev_err(dev, "%s: kzalloc failed for context\n", __func__);
|
||||
alloc_status = 1;
|
||||
goto alloc_status_switch;
|
||||
}
|
||||
@ -797,7 +815,7 @@ static int imon_probe(struct usb_interface *interface,
|
||||
|
||||
/* Input endpoint is mandatory */
|
||||
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;
|
||||
alloc_status = 2;
|
||||
goto alloc_status_switch;
|
||||
@ -814,30 +832,30 @@ static int imon_probe(struct usb_interface *interface,
|
||||
|
||||
driver = kzalloc(sizeof(struct lirc_driver), GFP_KERNEL);
|
||||
if (!driver) {
|
||||
err("%s: kzalloc failed for lirc_driver", __func__);
|
||||
dev_err(dev, "%s: kzalloc failed for lirc_driver\n", __func__);
|
||||
alloc_status = 2;
|
||||
goto alloc_status_switch;
|
||||
}
|
||||
rbuf = kmalloc(sizeof(struct lirc_buffer), GFP_KERNEL);
|
||||
if (!rbuf) {
|
||||
err("%s: kmalloc failed for lirc_buffer", __func__);
|
||||
dev_err(dev, "%s: kmalloc failed for lirc_buffer\n", __func__);
|
||||
alloc_status = 3;
|
||||
goto alloc_status_switch;
|
||||
}
|
||||
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;
|
||||
goto alloc_status_switch;
|
||||
}
|
||||
rx_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
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;
|
||||
goto alloc_status_switch;
|
||||
}
|
||||
tx_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
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__);
|
||||
alloc_status = 6;
|
||||
goto alloc_status_switch;
|
||||
@ -865,7 +883,7 @@ static int imon_probe(struct usb_interface *interface,
|
||||
|
||||
lirc_minor = lirc_register_driver(driver);
|
||||
if (lirc_minor < 0) {
|
||||
err("%s: lirc_register_driver failed", __func__);
|
||||
dev_err(dev, "%s: lirc_register_driver failed\n", __func__);
|
||||
alloc_status = 7;
|
||||
goto unlock;
|
||||
} else
|
||||
@ -900,8 +918,8 @@ static int imon_probe(struct usb_interface *interface,
|
||||
retval = usb_submit_urb(context->rx_urb, GFP_KERNEL);
|
||||
|
||||
if (retval) {
|
||||
err("%s: usb_submit_urb failed for intf0 (%d)",
|
||||
__func__, retval);
|
||||
dev_err(dev, "%s: usb_submit_urb failed for intf0 (%d)\n",
|
||||
__func__, retval);
|
||||
mutex_unlock(&context->ctx_lock);
|
||||
goto exit;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user