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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Greg Kroah-Hartman 2012-04-23 17:27:48 -07:00
Родитель 493f7d410c
Коммит 17122545d7
1 изменённых файлов: 61 добавлений и 39 удалений

Просмотреть файл

@ -185,7 +185,7 @@ static void deregister_from_lirc(struct sasem_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 "%s: unable to deregister from lirc (%d)\n",
__func__, retval); __func__, retval);
else else
printk(KERN_INFO "Deregistered Sasem driver (minor:%d)\n", printk(KERN_INFO "Deregistered Sasem driver (minor:%d)\n",
@ -210,16 +210,18 @@ static int vfd_open(struct inode *inode, struct file *file)
subminor = iminor(inode); subminor = iminor(inode);
interface = usb_find_interface(&sasem_driver, subminor); interface = usb_find_interface(&sasem_driver, subminor);
if (!interface) { if (!interface) {
err("%s: could not find interface for minor %d", printk(KERN_ERR KBUILD_MODNAME
__func__, subminor); ": %s: could not find interface for minor %d\n",
__func__, subminor);
retval = -ENODEV; retval = -ENODEV;
goto exit; goto exit;
} }
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,
__func__, subminor); "%s: no context found for minor %d\n",
__func__, subminor);
retval = -ENODEV; retval = -ENODEV;
goto exit; goto exit;
} }
@ -227,12 +229,13 @@ static int vfd_open(struct inode *inode, struct file *file)
mutex_lock(&context->ctx_lock); mutex_lock(&context->ctx_lock);
if (context->vfd_isopen) { 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; retval = -EBUSY;
} else { } else {
context->vfd_isopen = 1; context->vfd_isopen = 1;
file->private_data = context; file->private_data = context;
printk(KERN_INFO "VFD port opened\n"); dev_info(&interface->dev, "VFD port opened\n");
} }
mutex_unlock(&context->ctx_lock); 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; context = (struct sasem_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;
} }
@ -287,14 +291,15 @@ static int vfd_close(struct inode *inode, struct file *file)
context = (struct sasem_context *) file->private_data; context = (struct sasem_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->vfd_isopen) { 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; retval = -EIO;
} else { } else {
context->vfd_isopen = 0; 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); 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->dev->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);
@ -348,7 +354,9 @@ static int send_packet(struct sasem_context *context)
retval = context->tx.status; retval = context->tx.status;
if (retval) 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; return retval;
@ -369,20 +377,23 @@ static ssize_t vfd_write(struct file *file, const char *buf,
context = (struct sasem_context *) file->private_data; context = (struct sasem_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 Sasem device present", __func__); printk(KERN_ERR KBUILD_MODNAME
": %s: no Sasem device present\n", __func__);
retval = -ENODEV; retval = -ENODEV;
goto exit; goto exit;
} }
if (n_bytes <= 0 || n_bytes > SASEM_DATA_BUF_SZ) { 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; retval = -EINVAL;
goto exit; goto exit;
} }
@ -440,9 +451,9 @@ static ssize_t vfd_write(struct file *file, const char *buf,
} }
retval = send_packet(context); retval = send_packet(context);
if (retval) { if (retval) {
dev_err(&context->dev->dev,
err("%s: send packet failed for packet #%d", "%s: send packet failed for packet #%d\n",
__func__, i); __func__, i);
goto exit; goto exit;
} }
} }
@ -492,7 +503,8 @@ static int ir_open(void *data)
mutex_lock(&context->ctx_lock); mutex_lock(&context->ctx_lock);
if (context->ir_isopen) { 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; retval = -EBUSY;
goto exit; goto exit;
} }
@ -506,8 +518,9 @@ static int ir_open(void *data)
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 ir_open (%d)", dev_err(&context->dev->dev,
__func__, retval); "%s: usb_submit_urb failed for ir_open (%d)\n",
__func__, retval);
else { else {
context->ir_isopen = 1; context->ir_isopen = 1;
printk(KERN_INFO "IR port opened\n"); printk(KERN_INFO "IR port opened\n");
@ -529,7 +542,8 @@ static void ir_close(void *data)
context = (struct sasem_context *)data; context = (struct sasem_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;
} }
@ -687,7 +701,7 @@ static int sasem_probe(struct usb_interface *interface,
struct sasem_context *context = NULL; struct sasem_context *context = NULL;
int i; 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)); dev = usb_get_dev(interface_to_usbdev(interface));
@ -719,8 +733,8 @@ static int sasem_probe(struct usb_interface *interface,
rx_endpoint = ep; rx_endpoint = ep;
ir_ep_found = 1; ir_ep_found = 1;
if (debug) if (debug)
printk(KERN_INFO "%s: found IR endpoint\n", dev_info(&interface->dev,
__func__); "%s: found IR endpoint\n", __func__);
} else if (!vfd_ep_found && } else if (!vfd_ep_found &&
ep_dir == USB_DIR_OUT && ep_dir == USB_DIR_OUT &&
@ -729,22 +743,23 @@ static int sasem_probe(struct usb_interface *interface,
tx_endpoint = ep; tx_endpoint = ep;
vfd_ep_found = 1; vfd_ep_found = 1;
if (debug) if (debug)
printk(KERN_INFO "%s: found VFD endpoint\n", dev_info(&interface->dev,
__func__); "%s: found VFD endpoint\n", __func__);
} }
} }
/* Input endpoint is mandatory */ /* Input endpoint is mandatory */
if (!ir_ep_found) { if (!ir_ep_found) {
dev_err(&interface->dev,
err("%s: no valid input (IR) endpoint found.", __func__); "%s: no valid input (IR) endpoint found.\n", __func__);
retval = -ENODEV; retval = -ENODEV;
goto exit; goto exit;
} }
if (!vfd_ep_found) if (!vfd_ep_found)
printk(KERN_INFO "%s: no valid output (VFD) endpoint found.\n", dev_info(&interface->dev,
__func__); "%s: no valid output (VFD) endpoint found.\n",
__func__);
/* Allocate memory */ /* Allocate memory */
@ -752,38 +767,44 @@ static int sasem_probe(struct usb_interface *interface,
context = kzalloc(sizeof(struct sasem_context), GFP_KERNEL); context = kzalloc(sizeof(struct sasem_context), GFP_KERNEL);
if (!context) { if (!context) {
err("%s: kzalloc failed for context", __func__); dev_err(&interface->dev,
"%s: kzalloc failed for context\n", __func__);
alloc_status = 1; alloc_status = 1;
goto alloc_status_switch; goto alloc_status_switch;
} }
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(&interface->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(&interface->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(&interface->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(&interface->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;
} }
if (vfd_ep_found) { if (vfd_ep_found) {
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 VFD urb", dev_err(&interface->dev,
__func__); "%s: usb_alloc_urb failed for VFD urb",
__func__);
alloc_status = 6; alloc_status = 6;
goto alloc_status_switch; goto alloc_status_switch;
} }
@ -807,7 +828,8 @@ static int sasem_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(&interface->dev,
"%s: lirc_register_driver failed\n", __func__);
alloc_status = 7; alloc_status = 7;
retval = lirc_minor; retval = lirc_minor;
goto unlock; goto unlock;