diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-04-23 20:27:48 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-04-23 20:27:48 -0400 |
commit | 437c06cb4670faa3b22864ccf51a99ce198e4494 (patch) | |
tree | 177733cc3edeba0e87eb2e9f4895b8fb8c4ee5c3 | |
parent | e0ebe945c598563db0b4d0033fbe3c419dfbe3aa (diff) |
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>
-rw-r--r-- | drivers/staging/media/lirc/lirc_sasem.c | 100 |
1 files changed, 61 insertions, 39 deletions
diff --git a/drivers/staging/media/lirc/lirc_sasem.c b/drivers/staging/media/lirc/lirc_sasem.c index 74421043b954..352a20229ca2 100644 --- a/drivers/staging/media/lirc/lirc_sasem.c +++ b/drivers/staging/media/lirc/lirc_sasem.c | |||
@@ -185,7 +185,7 @@ static void deregister_from_lirc(struct sasem_context *context) | |||
185 | 185 | ||
186 | retval = lirc_unregister_driver(minor); | 186 | retval = lirc_unregister_driver(minor); |
187 | if (retval) | 187 | if (retval) |
188 | err("%s: unable to deregister from lirc (%d)", | 188 | printk(KERN_ERR "%s: unable to deregister from lirc (%d)\n", |
189 | __func__, retval); | 189 | __func__, retval); |
190 | else | 190 | else |
191 | printk(KERN_INFO "Deregistered Sasem driver (minor:%d)\n", | 191 | printk(KERN_INFO "Deregistered Sasem driver (minor:%d)\n", |
@@ -210,16 +210,18 @@ static int vfd_open(struct inode *inode, struct file *file) | |||
210 | subminor = iminor(inode); | 210 | subminor = iminor(inode); |
211 | interface = usb_find_interface(&sasem_driver, subminor); | 211 | interface = usb_find_interface(&sasem_driver, subminor); |
212 | if (!interface) { | 212 | if (!interface) { |
213 | err("%s: could not find interface for minor %d", | 213 | printk(KERN_ERR KBUILD_MODNAME |
214 | __func__, subminor); | 214 | ": %s: could not find interface for minor %d\n", |
215 | __func__, subminor); | ||
215 | retval = -ENODEV; | 216 | retval = -ENODEV; |
216 | goto exit; | 217 | goto exit; |
217 | } | 218 | } |
218 | context = usb_get_intfdata(interface); | 219 | context = usb_get_intfdata(interface); |
219 | 220 | ||
220 | if (!context) { | 221 | if (!context) { |
221 | err("%s: no context found for minor %d", | 222 | dev_err(&interface->dev, |
222 | __func__, subminor); | 223 | "%s: no context found for minor %d\n", |
224 | __func__, subminor); | ||
223 | retval = -ENODEV; | 225 | retval = -ENODEV; |
224 | goto exit; | 226 | goto exit; |
225 | } | 227 | } |
@@ -227,12 +229,13 @@ static int vfd_open(struct inode *inode, struct file *file) | |||
227 | mutex_lock(&context->ctx_lock); | 229 | mutex_lock(&context->ctx_lock); |
228 | 230 | ||
229 | if (context->vfd_isopen) { | 231 | if (context->vfd_isopen) { |
230 | err("%s: VFD port is already open", __func__); | 232 | dev_err(&interface->dev, |
233 | "%s: VFD port is already open", __func__); | ||
231 | retval = -EBUSY; | 234 | retval = -EBUSY; |
232 | } else { | 235 | } else { |
233 | context->vfd_isopen = 1; | 236 | context->vfd_isopen = 1; |
234 | file->private_data = context; | 237 | file->private_data = context; |
235 | printk(KERN_INFO "VFD port opened\n"); | 238 | dev_info(&interface->dev, "VFD port opened\n"); |
236 | } | 239 | } |
237 | 240 | ||
238 | mutex_unlock(&context->ctx_lock); | 241 | mutex_unlock(&context->ctx_lock); |
@@ -253,7 +256,8 @@ static long vfd_ioctl(struct file *file, unsigned cmd, unsigned long arg) | |||
253 | context = (struct sasem_context *) file->private_data; | 256 | context = (struct sasem_context *) file->private_data; |
254 | 257 | ||
255 | if (!context) { | 258 | if (!context) { |
256 | err("%s: no context for device", __func__); | 259 | printk(KERN_ERR KBUILD_MODNAME |
260 | ": %s: no context for device\n", __func__); | ||
257 | return -ENODEV; | 261 | return -ENODEV; |
258 | } | 262 | } |
259 | 263 | ||
@@ -287,14 +291,15 @@ static int vfd_close(struct inode *inode, struct file *file) | |||
287 | context = (struct sasem_context *) file->private_data; | 291 | context = (struct sasem_context *) file->private_data; |
288 | 292 | ||
289 | if (!context) { | 293 | if (!context) { |
290 | err("%s: no context for device", __func__); | 294 | printk(KERN_ERR KBUILD_MODNAME |
295 | ": %s: no context for device\n", __func__); | ||
291 | return -ENODEV; | 296 | return -ENODEV; |
292 | } | 297 | } |
293 | 298 | ||
294 | mutex_lock(&context->ctx_lock); | 299 | mutex_lock(&context->ctx_lock); |
295 | 300 | ||
296 | if (!context->vfd_isopen) { | 301 | if (!context->vfd_isopen) { |
297 | err("%s: VFD is not open", __func__); | 302 | dev_err(&context->dev->dev, "%s: VFD is not open\n", __func__); |
298 | retval = -EIO; | 303 | retval = -EIO; |
299 | } else { | 304 | } else { |
300 | context->vfd_isopen = 0; | 305 | context->vfd_isopen = 0; |
@@ -339,7 +344,8 @@ static int send_packet(struct sasem_context *context) | |||
339 | retval = usb_submit_urb(context->tx_urb, GFP_KERNEL); | 344 | retval = usb_submit_urb(context->tx_urb, GFP_KERNEL); |
340 | if (retval) { | 345 | if (retval) { |
341 | atomic_set(&(context->tx.busy), 0); | 346 | atomic_set(&(context->tx.busy), 0); |
342 | err("%s: error submitting urb (%d)", __func__, retval); | 347 | dev_err(&context->dev->dev, "%s: error submitting urb (%d)\n", |
348 | __func__, retval); | ||
343 | } else { | 349 | } else { |
344 | /* Wait for transmission to complete (or abort) */ | 350 | /* Wait for transmission to complete (or abort) */ |
345 | mutex_unlock(&context->ctx_lock); | 351 | mutex_unlock(&context->ctx_lock); |
@@ -348,7 +354,9 @@ static int send_packet(struct sasem_context *context) | |||
348 | 354 | ||
349 | retval = context->tx.status; | 355 | retval = context->tx.status; |
350 | if (retval) | 356 | if (retval) |
351 | err("%s: packet tx failed (%d)", __func__, retval); | 357 | dev_err(&context->dev->dev, |
358 | "%s: packet tx failed (%d)\n", | ||
359 | __func__, retval); | ||
352 | } | 360 | } |
353 | 361 | ||
354 | return retval; | 362 | return retval; |
@@ -369,20 +377,23 @@ static ssize_t vfd_write(struct file *file, const char *buf, | |||
369 | 377 | ||
370 | context = (struct sasem_context *) file->private_data; | 378 | context = (struct sasem_context *) file->private_data; |
371 | if (!context) { | 379 | if (!context) { |
372 | err("%s: no context for device", __func__); | 380 | printk(KERN_ERR KBUILD_MODNAME |
381 | ": %s: no context for device\n", __func__); | ||
373 | return -ENODEV; | 382 | return -ENODEV; |
374 | } | 383 | } |
375 | 384 | ||
376 | mutex_lock(&context->ctx_lock); | 385 | mutex_lock(&context->ctx_lock); |
377 | 386 | ||
378 | if (!context->dev_present) { | 387 | if (!context->dev_present) { |
379 | err("%s: no Sasem device present", __func__); | 388 | printk(KERN_ERR KBUILD_MODNAME |
389 | ": %s: no Sasem device present\n", __func__); | ||
380 | retval = -ENODEV; | 390 | retval = -ENODEV; |
381 | goto exit; | 391 | goto exit; |
382 | } | 392 | } |
383 | 393 | ||
384 | if (n_bytes <= 0 || n_bytes > SASEM_DATA_BUF_SZ) { | 394 | if (n_bytes <= 0 || n_bytes > SASEM_DATA_BUF_SZ) { |
385 | err("%s: invalid payload size", __func__); | 395 | dev_err(&context->dev->dev, "%s: invalid payload size\n", |
396 | __func__); | ||
386 | retval = -EINVAL; | 397 | retval = -EINVAL; |
387 | goto exit; | 398 | goto exit; |
388 | } | 399 | } |
@@ -440,9 +451,9 @@ static ssize_t vfd_write(struct file *file, const char *buf, | |||
440 | } | 451 | } |
441 | retval = send_packet(context); | 452 | retval = send_packet(context); |
442 | if (retval) { | 453 | if (retval) { |
443 | 454 | dev_err(&context->dev->dev, | |
444 | err("%s: send packet failed for packet #%d", | 455 | "%s: send packet failed for packet #%d\n", |
445 | __func__, i); | 456 | __func__, i); |
446 | goto exit; | 457 | goto exit; |
447 | } | 458 | } |
448 | } | 459 | } |
@@ -492,7 +503,8 @@ static int ir_open(void *data) | |||
492 | mutex_lock(&context->ctx_lock); | 503 | mutex_lock(&context->ctx_lock); |
493 | 504 | ||
494 | if (context->ir_isopen) { | 505 | if (context->ir_isopen) { |
495 | err("%s: IR port is already open", __func__); | 506 | dev_err(&context->dev->dev, "%s: IR port is already open\n", |
507 | __func__); | ||
496 | retval = -EBUSY; | 508 | retval = -EBUSY; |
497 | goto exit; | 509 | goto exit; |
498 | } | 510 | } |
@@ -506,8 +518,9 @@ static int ir_open(void *data) | |||
506 | retval = usb_submit_urb(context->rx_urb, GFP_KERNEL); | 518 | retval = usb_submit_urb(context->rx_urb, GFP_KERNEL); |
507 | 519 | ||
508 | if (retval) | 520 | if (retval) |
509 | err("%s: usb_submit_urb failed for ir_open (%d)", | 521 | dev_err(&context->dev->dev, |
510 | __func__, retval); | 522 | "%s: usb_submit_urb failed for ir_open (%d)\n", |
523 | __func__, retval); | ||
511 | else { | 524 | else { |
512 | context->ir_isopen = 1; | 525 | context->ir_isopen = 1; |
513 | printk(KERN_INFO "IR port opened\n"); | 526 | printk(KERN_INFO "IR port opened\n"); |
@@ -529,7 +542,8 @@ static void ir_close(void *data) | |||
529 | 542 | ||
530 | context = (struct sasem_context *)data; | 543 | context = (struct sasem_context *)data; |
531 | if (!context) { | 544 | if (!context) { |
532 | err("%s: no context for device", __func__); | 545 | printk(KERN_ERR KBUILD_MODNAME |
546 | ": %s: no context for device\n", __func__); | ||
533 | return; | 547 | return; |
534 | } | 548 | } |
535 | 549 | ||
@@ -687,7 +701,7 @@ static int sasem_probe(struct usb_interface *interface, | |||
687 | struct sasem_context *context = NULL; | 701 | struct sasem_context *context = NULL; |
688 | int i; | 702 | int i; |
689 | 703 | ||
690 | printk(KERN_INFO "%s: found Sasem device\n", __func__); | 704 | dev_info(&interface->dev, "%s: found Sasem device\n", __func__); |
691 | 705 | ||
692 | 706 | ||
693 | dev = usb_get_dev(interface_to_usbdev(interface)); | 707 | dev = usb_get_dev(interface_to_usbdev(interface)); |
@@ -719,8 +733,8 @@ static int sasem_probe(struct usb_interface *interface, | |||
719 | rx_endpoint = ep; | 733 | rx_endpoint = ep; |
720 | ir_ep_found = 1; | 734 | ir_ep_found = 1; |
721 | if (debug) | 735 | if (debug) |
722 | printk(KERN_INFO "%s: found IR endpoint\n", | 736 | dev_info(&interface->dev, |
723 | __func__); | 737 | "%s: found IR endpoint\n", __func__); |
724 | 738 | ||
725 | } else if (!vfd_ep_found && | 739 | } else if (!vfd_ep_found && |
726 | ep_dir == USB_DIR_OUT && | 740 | ep_dir == USB_DIR_OUT && |
@@ -729,22 +743,23 @@ static int sasem_probe(struct usb_interface *interface, | |||
729 | tx_endpoint = ep; | 743 | tx_endpoint = ep; |
730 | vfd_ep_found = 1; | 744 | vfd_ep_found = 1; |
731 | if (debug) | 745 | if (debug) |
732 | printk(KERN_INFO "%s: found VFD endpoint\n", | 746 | dev_info(&interface->dev, |
733 | __func__); | 747 | "%s: found VFD endpoint\n", __func__); |
734 | } | 748 | } |
735 | } | 749 | } |
736 | 750 | ||
737 | /* Input endpoint is mandatory */ | 751 | /* Input endpoint is mandatory */ |
738 | if (!ir_ep_found) { | 752 | if (!ir_ep_found) { |
739 | 753 | dev_err(&interface->dev, | |
740 | err("%s: no valid input (IR) endpoint found.", __func__); | 754 | "%s: no valid input (IR) endpoint found.\n", __func__); |
741 | retval = -ENODEV; | 755 | retval = -ENODEV; |
742 | goto exit; | 756 | goto exit; |
743 | } | 757 | } |
744 | 758 | ||
745 | if (!vfd_ep_found) | 759 | if (!vfd_ep_found) |
746 | printk(KERN_INFO "%s: no valid output (VFD) endpoint found.\n", | 760 | dev_info(&interface->dev, |
747 | __func__); | 761 | "%s: no valid output (VFD) endpoint found.\n", |
762 | __func__); | ||
748 | 763 | ||
749 | 764 | ||
750 | /* Allocate memory */ | 765 | /* Allocate memory */ |
@@ -752,38 +767,44 @@ static int sasem_probe(struct usb_interface *interface, | |||
752 | 767 | ||
753 | context = kzalloc(sizeof(struct sasem_context), GFP_KERNEL); | 768 | context = kzalloc(sizeof(struct sasem_context), GFP_KERNEL); |
754 | if (!context) { | 769 | if (!context) { |
755 | err("%s: kzalloc failed for context", __func__); | 770 | dev_err(&interface->dev, |
771 | "%s: kzalloc failed for context\n", __func__); | ||
756 | alloc_status = 1; | 772 | alloc_status = 1; |
757 | goto alloc_status_switch; | 773 | goto alloc_status_switch; |
758 | } | 774 | } |
759 | driver = kzalloc(sizeof(struct lirc_driver), GFP_KERNEL); | 775 | driver = kzalloc(sizeof(struct lirc_driver), GFP_KERNEL); |
760 | if (!driver) { | 776 | if (!driver) { |
761 | err("%s: kzalloc failed for lirc_driver", __func__); | 777 | dev_err(&interface->dev, |
778 | "%s: kzalloc failed for lirc_driver\n", __func__); | ||
762 | alloc_status = 2; | 779 | alloc_status = 2; |
763 | goto alloc_status_switch; | 780 | goto alloc_status_switch; |
764 | } | 781 | } |
765 | rbuf = kmalloc(sizeof(struct lirc_buffer), GFP_KERNEL); | 782 | rbuf = kmalloc(sizeof(struct lirc_buffer), GFP_KERNEL); |
766 | if (!rbuf) { | 783 | if (!rbuf) { |
767 | err("%s: kmalloc failed for lirc_buffer", __func__); | 784 | dev_err(&interface->dev, |
785 | "%s: kmalloc failed for lirc_buffer\n", __func__); | ||
768 | alloc_status = 3; | 786 | alloc_status = 3; |
769 | goto alloc_status_switch; | 787 | goto alloc_status_switch; |
770 | } | 788 | } |
771 | if (lirc_buffer_init(rbuf, BUF_CHUNK_SIZE, BUF_SIZE)) { | 789 | if (lirc_buffer_init(rbuf, BUF_CHUNK_SIZE, BUF_SIZE)) { |
772 | err("%s: lirc_buffer_init failed", __func__); | 790 | dev_err(&interface->dev, |
791 | "%s: lirc_buffer_init failed\n", __func__); | ||
773 | alloc_status = 4; | 792 | alloc_status = 4; |
774 | goto alloc_status_switch; | 793 | goto alloc_status_switch; |
775 | } | 794 | } |
776 | rx_urb = usb_alloc_urb(0, GFP_KERNEL); | 795 | rx_urb = usb_alloc_urb(0, GFP_KERNEL); |
777 | if (!rx_urb) { | 796 | if (!rx_urb) { |
778 | err("%s: usb_alloc_urb failed for IR urb", __func__); | 797 | dev_err(&interface->dev, |
798 | "%s: usb_alloc_urb failed for IR urb\n", __func__); | ||
779 | alloc_status = 5; | 799 | alloc_status = 5; |
780 | goto alloc_status_switch; | 800 | goto alloc_status_switch; |
781 | } | 801 | } |
782 | if (vfd_ep_found) { | 802 | if (vfd_ep_found) { |
783 | tx_urb = usb_alloc_urb(0, GFP_KERNEL); | 803 | tx_urb = usb_alloc_urb(0, GFP_KERNEL); |
784 | if (!tx_urb) { | 804 | if (!tx_urb) { |
785 | err("%s: usb_alloc_urb failed for VFD urb", | 805 | dev_err(&interface->dev, |
786 | __func__); | 806 | "%s: usb_alloc_urb failed for VFD urb", |
807 | __func__); | ||
787 | alloc_status = 6; | 808 | alloc_status = 6; |
788 | goto alloc_status_switch; | 809 | goto alloc_status_switch; |
789 | } | 810 | } |
@@ -807,7 +828,8 @@ static int sasem_probe(struct usb_interface *interface, | |||
807 | 828 | ||
808 | lirc_minor = lirc_register_driver(driver); | 829 | lirc_minor = lirc_register_driver(driver); |
809 | if (lirc_minor < 0) { | 830 | if (lirc_minor < 0) { |
810 | err("%s: lirc_register_driver failed", __func__); | 831 | dev_err(&interface->dev, |
832 | "%s: lirc_register_driver failed\n", __func__); | ||
811 | alloc_status = 7; | 833 | alloc_status = 7; |
812 | retval = lirc_minor; | 834 | retval = lirc_minor; |
813 | goto unlock; | 835 | goto unlock; |