aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-23 20:14:54 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-23 20:14:54 -0400
commite0ebe945c598563db0b4d0033fbe3c419dfbe3aa (patch)
tree40d426a564cd64e4d51f4b339ab4b4587675a31e
parentdfcf931a94f660c677c08f9cc23e0ffc7ccca4f3 (diff)
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>
-rw-r--r--drivers/staging/media/lirc/lirc_imon.c80
1 files changed, 49 insertions, 31 deletions
diff --git a/drivers/staging/media/lirc/lirc_imon.c b/drivers/staging/media/lirc/lirc_imon.c
index 5f7f8cd3a661..d7cf5ef076a5 100644
--- a/drivers/staging/media/lirc/lirc_imon.c
+++ b/drivers/staging/media/lirc/lirc_imon.c
@@ -209,8 +209,9 @@ static void deregister_from_lirc(struct imon_context *context)
209 209
210 retval = lirc_unregister_driver(minor); 210 retval = lirc_unregister_driver(minor);
211 if (retval) 211 if (retval)
212 err("%s: unable to deregister from lirc(%d)", 212 printk(KERN_ERR KBUILD_MODNAME
213 __func__, retval); 213 ": %s: unable to deregister from lirc(%d)",
214 __func__, retval);
214 else 215 else
215 printk(KERN_INFO MOD_NAME ": Deregistered iMON driver " 216 printk(KERN_INFO MOD_NAME ": Deregistered iMON driver "
216 "(minor:%d)\n", minor); 217 "(minor:%d)\n", minor);
@@ -234,16 +235,18 @@ static int display_open(struct inode *inode, struct file *file)
234 subminor = iminor(inode); 235 subminor = iminor(inode);
235 interface = usb_find_interface(&imon_driver, subminor); 236 interface = usb_find_interface(&imon_driver, subminor);
236 if (!interface) { 237 if (!interface) {
237 err("%s: could not find interface for minor %d", 238 printk(KERN_ERR KBUILD_MODNAME
238 __func__, subminor); 239 ": %s: could not find interface for minor %d\n",
240 __func__, subminor);
239 retval = -ENODEV; 241 retval = -ENODEV;
240 goto exit; 242 goto exit;
241 } 243 }
242 context = usb_get_intfdata(interface); 244 context = usb_get_intfdata(interface);
243 245
244 if (!context) { 246 if (!context) {
245 err("%s: no context found for minor %d", 247 dev_err(&interface->dev,
246 __func__, subminor); 248 "%s: no context found for minor %d\n",
249 __func__, subminor);
247 retval = -ENODEV; 250 retval = -ENODEV;
248 goto exit; 251 goto exit;
249 } 252 }
@@ -251,10 +254,12 @@ static int display_open(struct inode *inode, struct file *file)
251 mutex_lock(&context->ctx_lock); 254 mutex_lock(&context->ctx_lock);
252 255
253 if (!context->display) { 256 if (!context->display) {
254 err("%s: display not supported by device", __func__); 257 dev_err(&interface->dev,
258 "%s: display not supported by device\n", __func__);
255 retval = -ENODEV; 259 retval = -ENODEV;
256 } else if (context->display_isopen) { 260 } else if (context->display_isopen) {
257 err("%s: display port is already open", __func__); 261 dev_err(&interface->dev,
262 "%s: display port is already open\n", __func__);
258 retval = -EBUSY; 263 retval = -EBUSY;
259 } else { 264 } else {
260 context->display_isopen = 1; 265 context->display_isopen = 1;
@@ -281,17 +286,20 @@ static int display_close(struct inode *inode, struct file *file)
281 context = file->private_data; 286 context = file->private_data;
282 287
283 if (!context) { 288 if (!context) {
284 err("%s: no context for device", __func__); 289 printk(KERN_ERR KBUILD_MODNAME
290 "%s: no context for device\n", __func__);
285 return -ENODEV; 291 return -ENODEV;
286 } 292 }
287 293
288 mutex_lock(&context->ctx_lock); 294 mutex_lock(&context->ctx_lock);
289 295
290 if (!context->display) { 296 if (!context->display) {
291 err("%s: display not supported by device", __func__); 297 dev_err(&context->usbdev->dev,
298 "%s: display not supported by device\n", __func__);
292 retval = -ENODEV; 299 retval = -ENODEV;
293 } else if (!context->display_isopen) { 300 } else if (!context->display_isopen) {
294 err("%s: display is not open", __func__); 301 dev_err(&context->usbdev->dev,
302 "%s: display is not open\n", __func__);
295 retval = -EIO; 303 retval = -EIO;
296 } else { 304 } else {
297 context->display_isopen = 0; 305 context->display_isopen = 0;
@@ -340,19 +348,23 @@ static int send_packet(struct imon_context *context)
340 retval = usb_submit_urb(context->tx_urb, GFP_KERNEL); 348 retval = usb_submit_urb(context->tx_urb, GFP_KERNEL);
341 if (retval) { 349 if (retval) {
342 atomic_set(&(context->tx.busy), 0); 350 atomic_set(&(context->tx.busy), 0);
343 err("%s: error submitting urb(%d)", __func__, retval); 351 dev_err(&context->usbdev->dev,
352 "%s: error submitting urb(%d)\n", __func__, retval);
344 } else { 353 } else {
345 /* Wait for transmission to complete (or abort) */ 354 /* Wait for transmission to complete (or abort) */
346 mutex_unlock(&context->ctx_lock); 355 mutex_unlock(&context->ctx_lock);
347 retval = wait_for_completion_interruptible( 356 retval = wait_for_completion_interruptible(
348 &context->tx.finished); 357 &context->tx.finished);
349 if (retval) 358 if (retval)
350 err("%s: task interrupted", __func__); 359 dev_err(&context->usbdev->dev,
360 "%s: task interrupted\n", __func__);
351 mutex_lock(&context->ctx_lock); 361 mutex_lock(&context->ctx_lock);
352 362
353 retval = context->tx.status; 363 retval = context->tx.status;
354 if (retval) 364 if (retval)
355 err("%s: packet tx failed (%d)", __func__, retval); 365 dev_err(&context->usbdev->dev,
366 "%s: packet tx failed (%d)\n",
367 __func__, retval);
356 } 368 }
357 369
358 return retval; 370 return retval;
@@ -383,20 +395,23 @@ static ssize_t vfd_write(struct file *file, const char __user *buf,
383 395
384 context = file->private_data; 396 context = file->private_data;
385 if (!context) { 397 if (!context) {
386 err("%s: no context for device", __func__); 398 printk(KERN_ERR KBUILD_MODNAME
399 "%s: no context for device\n", __func__);
387 return -ENODEV; 400 return -ENODEV;
388 } 401 }
389 402
390 mutex_lock(&context->ctx_lock); 403 mutex_lock(&context->ctx_lock);
391 404
392 if (!context->dev_present) { 405 if (!context->dev_present) {
393 err("%s: no iMON device present", __func__); 406 dev_err(&context->usbdev->dev,
407 "%s: no iMON device present\n", __func__);
394 retval = -ENODEV; 408 retval = -ENODEV;
395 goto exit; 409 goto exit;
396 } 410 }
397 411
398 if (n_bytes <= 0 || n_bytes > IMON_DATA_BUF_SZ - 3) { 412 if (n_bytes <= 0 || n_bytes > IMON_DATA_BUF_SZ - 3) {
399 err("%s: invalid payload size", __func__); 413 dev_err(&context->usbdev->dev,
414 "%s: invalid payload size\n", __func__);
400 retval = -EINVAL; 415 retval = -EINVAL;
401 goto exit; 416 goto exit;
402 } 417 }
@@ -425,8 +440,9 @@ static ssize_t vfd_write(struct file *file, const char __user *buf,
425 440
426 retval = send_packet(context); 441 retval = send_packet(context);
427 if (retval) { 442 if (retval) {
428 err("%s: send packet failed for packet #%d", 443 dev_err(&context->usbdev->dev,
429 __func__, seq/2); 444 "%s: send packet failed for packet #%d\n",
445 __func__, seq/2);
430 goto exit; 446 goto exit;
431 } else { 447 } else {
432 seq += 2; 448 seq += 2;
@@ -441,7 +457,8 @@ static ssize_t vfd_write(struct file *file, const char __user *buf,
441 context->usb_tx_buf[7] = (unsigned char) seq; 457 context->usb_tx_buf[7] = (unsigned char) seq;
442 retval = send_packet(context); 458 retval = send_packet(context);
443 if (retval) 459 if (retval)
444 err("%s: send packet failed for packet #%d", 460 dev_err(&context->usbdev->dev,
461 "%s: send packet failed for packet #%d\n",
445 __func__, seq/2); 462 __func__, seq/2);
446 } 463 }
447 464
@@ -508,7 +525,8 @@ static void ir_close(void *data)
508 525
509 context = (struct imon_context *)data; 526 context = (struct imon_context *)data;
510 if (!context) { 527 if (!context) {
511 err("%s: no context for device", __func__); 528 printk(KERN_ERR KBUILD_MODNAME
529 "%s: no context for device\n", __func__);
512 return; 530 return;
513 } 531 }
514 532
@@ -732,7 +750,7 @@ static int imon_probe(struct usb_interface *interface,
732 750
733 context = kzalloc(sizeof(struct imon_context), GFP_KERNEL); 751 context = kzalloc(sizeof(struct imon_context), GFP_KERNEL);
734 if (!context) { 752 if (!context) {
735 err("%s: kzalloc failed for context", __func__); 753 dev_err(dev, "%s: kzalloc failed for context\n", __func__);
736 alloc_status = 1; 754 alloc_status = 1;
737 goto alloc_status_switch; 755 goto alloc_status_switch;
738 } 756 }
@@ -797,7 +815,7 @@ static int imon_probe(struct usb_interface *interface,
797 815
798 /* Input endpoint is mandatory */ 816 /* Input endpoint is mandatory */
799 if (!ir_ep_found) { 817 if (!ir_ep_found) {
800 err("%s: no valid input (IR) endpoint found.", __func__); 818 dev_err(dev, "%s: no valid input (IR) endpoint found.\n", __func__);
801 retval = -ENODEV; 819 retval = -ENODEV;
802 alloc_status = 2; 820 alloc_status = 2;
803 goto alloc_status_switch; 821 goto alloc_status_switch;
@@ -814,30 +832,30 @@ static int imon_probe(struct usb_interface *interface,
814 832
815 driver = kzalloc(sizeof(struct lirc_driver), GFP_KERNEL); 833 driver = kzalloc(sizeof(struct lirc_driver), GFP_KERNEL);
816 if (!driver) { 834 if (!driver) {
817 err("%s: kzalloc failed for lirc_driver", __func__); 835 dev_err(dev, "%s: kzalloc failed for lirc_driver\n", __func__);
818 alloc_status = 2; 836 alloc_status = 2;
819 goto alloc_status_switch; 837 goto alloc_status_switch;
820 } 838 }
821 rbuf = kmalloc(sizeof(struct lirc_buffer), GFP_KERNEL); 839 rbuf = kmalloc(sizeof(struct lirc_buffer), GFP_KERNEL);
822 if (!rbuf) { 840 if (!rbuf) {
823 err("%s: kmalloc failed for lirc_buffer", __func__); 841 dev_err(dev, "%s: kmalloc failed for lirc_buffer\n", __func__);
824 alloc_status = 3; 842 alloc_status = 3;
825 goto alloc_status_switch; 843 goto alloc_status_switch;
826 } 844 }
827 if (lirc_buffer_init(rbuf, BUF_CHUNK_SIZE, BUF_SIZE)) { 845 if (lirc_buffer_init(rbuf, BUF_CHUNK_SIZE, BUF_SIZE)) {
828 err("%s: lirc_buffer_init failed", __func__); 846 dev_err(dev, "%s: lirc_buffer_init failed\n", __func__);
829 alloc_status = 4; 847 alloc_status = 4;
830 goto alloc_status_switch; 848 goto alloc_status_switch;
831 } 849 }
832 rx_urb = usb_alloc_urb(0, GFP_KERNEL); 850 rx_urb = usb_alloc_urb(0, GFP_KERNEL);
833 if (!rx_urb) { 851 if (!rx_urb) {
834 err("%s: usb_alloc_urb failed for IR urb", __func__); 852 dev_err(dev, "%s: usb_alloc_urb failed for IR urb\n", __func__);
835 alloc_status = 5; 853 alloc_status = 5;
836 goto alloc_status_switch; 854 goto alloc_status_switch;
837 } 855 }
838 tx_urb = usb_alloc_urb(0, GFP_KERNEL); 856 tx_urb = usb_alloc_urb(0, GFP_KERNEL);
839 if (!tx_urb) { 857 if (!tx_urb) {
840 err("%s: usb_alloc_urb failed for display urb", 858 dev_err(dev, "%s: usb_alloc_urb failed for display urb\n",
841 __func__); 859 __func__);
842 alloc_status = 6; 860 alloc_status = 6;
843 goto alloc_status_switch; 861 goto alloc_status_switch;
@@ -865,7 +883,7 @@ static int imon_probe(struct usb_interface *interface,
865 883
866 lirc_minor = lirc_register_driver(driver); 884 lirc_minor = lirc_register_driver(driver);
867 if (lirc_minor < 0) { 885 if (lirc_minor < 0) {
868 err("%s: lirc_register_driver failed", __func__); 886 dev_err(dev, "%s: lirc_register_driver failed\n", __func__);
869 alloc_status = 7; 887 alloc_status = 7;
870 goto unlock; 888 goto unlock;
871 } else 889 } else
@@ -900,8 +918,8 @@ static int imon_probe(struct usb_interface *interface,
900 retval = usb_submit_urb(context->rx_urb, GFP_KERNEL); 918 retval = usb_submit_urb(context->rx_urb, GFP_KERNEL);
901 919
902 if (retval) { 920 if (retval) {
903 err("%s: usb_submit_urb failed for intf0 (%d)", 921 dev_err(dev, "%s: usb_submit_urb failed for intf0 (%d)\n",
904 __func__, retval); 922 __func__, retval);
905 mutex_unlock(&context->ctx_lock); 923 mutex_unlock(&context->ctx_lock);
906 goto exit; 924 goto exit;
907 } 925 }