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

USB: Staging: media: lirc: lirc_sasem: 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: Andrew Miller <amiller@amilx.com>
Cc: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 493f7d41
......@@ -185,7 +185,7 @@ static void deregister_from_lirc(struct sasem_context *context)
retval = lirc_unregister_driver(minor);
if (retval)
err("%s: unable to deregister from lirc (%d)",
printk(KERN_ERR "%s: unable to deregister from lirc (%d)\n",
__func__, retval);
else
printk(KERN_INFO "Deregistered Sasem driver (minor:%d)\n",
......@@ -210,7 +210,8 @@ static int vfd_open(struct inode *inode, struct file *file)
subminor = iminor(inode);
interface = usb_find_interface(&sasem_driver, subminor);
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);
retval = -ENODEV;
goto exit;
......@@ -218,7 +219,8 @@ static int vfd_open(struct inode *inode, struct file *file)
context = usb_get_intfdata(interface);
if (!context) {
err("%s: no context found for minor %d",
dev_err(&interface->dev,
"%s: no context found for minor %d\n",
__func__, subminor);
retval = -ENODEV;
goto exit;
......@@ -227,12 +229,13 @@ static int vfd_open(struct inode *inode, struct file *file)
mutex_lock(&context->ctx_lock);
if (context->vfd_isopen) {
err("%s: VFD port is already open", __func__);
dev_err(&interface->dev,
"%s: VFD port is already open", __func__);
retval = -EBUSY;
} else {
context->vfd_isopen = 1;
file->private_data = context;
printk(KERN_INFO "VFD port opened\n");
dev_info(&interface->dev, "VFD port opened\n");
}
mutex_unlock(&context->ctx_lock);
......@@ -253,7 +256,8 @@ static long vfd_ioctl(struct file *file, unsigned cmd, unsigned long arg)
context = (struct sasem_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;
}
......@@ -287,14 +291,15 @@ static int vfd_close(struct inode *inode, struct file *file)
context = (struct sasem_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->vfd_isopen) {
err("%s: VFD is not open", __func__);
dev_err(&context->dev->dev, "%s: VFD is not open\n", __func__);
retval = -EIO;
} else {
context->vfd_isopen = 0;
......@@ -339,7 +344,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);
err("%s: error submitting urb (%d)", __func__, retval);
dev_err(&context->dev->dev, "%s: error submitting urb (%d)\n",
__func__, retval);
} else {
/* Wait for transmission to complete (or abort) */
mutex_unlock(&context->ctx_lock);
......@@ -348,7 +354,9 @@ static int send_packet(struct sasem_context *context)
retval = context->tx.status;
if (retval)
err("%s: packet tx failed (%d)", __func__, retval);
dev_err(&context->dev->dev,
"%s: packet tx failed (%d)\n",
__func__, retval);
}
return retval;
......@@ -369,20 +377,23 @@ static ssize_t vfd_write(struct file *file, const char *buf,
context = (struct sasem_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 Sasem device present", __func__);
printk(KERN_ERR KBUILD_MODNAME
": %s: no Sasem device present\n", __func__);
retval = -ENODEV;
goto exit;
}
if (n_bytes <= 0 || n_bytes > SASEM_DATA_BUF_SZ) {
err("%s: invalid payload size", __func__);
dev_err(&context->dev->dev, "%s: invalid payload size\n",
__func__);
retval = -EINVAL;
goto exit;
}
......@@ -440,8 +451,8 @@ static ssize_t vfd_write(struct file *file, const char *buf,
}
retval = send_packet(context);
if (retval) {
err("%s: send packet failed for packet #%d",
dev_err(&context->dev->dev,
"%s: send packet failed for packet #%d\n",
__func__, i);
goto exit;
}
......@@ -492,7 +503,8 @@ static int ir_open(void *data)
mutex_lock(&context->ctx_lock);
if (context->ir_isopen) {
err("%s: IR port is already open", __func__);
dev_err(&context->dev->dev, "%s: IR port is already open\n",
__func__);
retval = -EBUSY;
goto exit;
}
......@@ -506,7 +518,8 @@ static int ir_open(void *data)
retval = usb_submit_urb(context->rx_urb, GFP_KERNEL);
if (retval)
err("%s: usb_submit_urb failed for ir_open (%d)",
dev_err(&context->dev->dev,
"%s: usb_submit_urb failed for ir_open (%d)\n",
__func__, retval);
else {
context->ir_isopen = 1;
......@@ -529,7 +542,8 @@ static void ir_close(void *data)
context = (struct sasem_context *)data;
if (!context) {
err("%s: no context for device", __func__);
printk(KERN_ERR KBUILD_MODNAME
": %s: no context for device\n", __func__);
return;
}
......@@ -687,7 +701,7 @@ static int sasem_probe(struct usb_interface *interface,
struct sasem_context *context = NULL;
int i;
printk(KERN_INFO "%s: found Sasem device\n", __func__);
dev_info(&interface->dev, "%s: found Sasem device\n", __func__);
dev = usb_get_dev(interface_to_usbdev(interface));
......@@ -719,8 +733,8 @@ static int sasem_probe(struct usb_interface *interface,
rx_endpoint = ep;
ir_ep_found = 1;
if (debug)
printk(KERN_INFO "%s: found IR endpoint\n",
__func__);
dev_info(&interface->dev,
"%s: found IR endpoint\n", __func__);
} else if (!vfd_ep_found &&
ep_dir == USB_DIR_OUT &&
......@@ -729,21 +743,22 @@ static int sasem_probe(struct usb_interface *interface,
tx_endpoint = ep;
vfd_ep_found = 1;
if (debug)
printk(KERN_INFO "%s: found VFD endpoint\n",
__func__);
dev_info(&interface->dev,
"%s: found VFD endpoint\n", __func__);
}
}
/* Input endpoint is mandatory */
if (!ir_ep_found) {
err("%s: no valid input (IR) endpoint found.", __func__);
dev_err(&interface->dev,
"%s: no valid input (IR) endpoint found.\n", __func__);
retval = -ENODEV;
goto exit;
}
if (!vfd_ep_found)
printk(KERN_INFO "%s: no valid output (VFD) endpoint found.\n",
dev_info(&interface->dev,
"%s: no valid output (VFD) endpoint found.\n",
__func__);
......@@ -752,37 +767,43 @@ static int sasem_probe(struct usb_interface *interface,
context = kzalloc(sizeof(struct sasem_context), GFP_KERNEL);
if (!context) {
err("%s: kzalloc failed for context", __func__);
dev_err(&interface->dev,
"%s: kzalloc failed for context\n", __func__);
alloc_status = 1;
goto alloc_status_switch;
}
driver = kzalloc(sizeof(struct lirc_driver), GFP_KERNEL);
if (!driver) {
err("%s: kzalloc failed for lirc_driver", __func__);
dev_err(&interface->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(&interface->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(&interface->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(&interface->dev,
"%s: usb_alloc_urb failed for IR urb\n", __func__);
alloc_status = 5;
goto alloc_status_switch;
}
if (vfd_ep_found) {
tx_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!tx_urb) {
err("%s: usb_alloc_urb failed for VFD urb",
dev_err(&interface->dev,
"%s: usb_alloc_urb failed for VFD urb",
__func__);
alloc_status = 6;
goto alloc_status_switch;
......@@ -807,7 +828,8 @@ static int sasem_probe(struct usb_interface *interface,
lirc_minor = lirc_register_driver(driver);
if (lirc_minor < 0) {
err("%s: lirc_register_driver failed", __func__);
dev_err(&interface->dev,
"%s: lirc_register_driver failed\n", __func__);
alloc_status = 7;
retval = lirc_minor;
goto unlock;
......
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