aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2010-06-20 03:20:46 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-10-22 21:33:31 -0400
commite2302501c32a0e7e34b7077f10da03b72dd91570 (patch)
tree79776b9789936628e09b712596d79e9cf9f0675e /drivers/media
parent3074fc8432223937985e138bde1270a03fc75628 (diff)
[media] drivers/media/IR/imon.c: Use pr_err instead of err
Use the standard error logging mechanisms. Add #define pr_fmt(fmt) KBUILD_MODNAME ":%s" fmt, __func__ Remove __func__ from err calls, add '\n', rename to pr_err Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/IR/imon.c73
1 files changed, 34 insertions, 39 deletions
diff --git a/drivers/media/IR/imon.c b/drivers/media/IR/imon.c
index 7a971764ba44..0391c3b86975 100644
--- a/drivers/media/IR/imon.c
+++ b/drivers/media/IR/imon.c
@@ -26,6 +26,8 @@
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 */ 27 */
28 28
29#define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__
30
29#include <linux/errno.h> 31#include <linux/errno.h>
30#include <linux/init.h> 32#include <linux/init.h>
31#include <linux/kernel.h> 33#include <linux/kernel.h>
@@ -371,15 +373,14 @@ static int display_open(struct inode *inode, struct file *file)
371 subminor = iminor(inode); 373 subminor = iminor(inode);
372 interface = usb_find_interface(&imon_driver, subminor); 374 interface = usb_find_interface(&imon_driver, subminor);
373 if (!interface) { 375 if (!interface) {
374 err("%s: could not find interface for minor %d", 376 pr_err("could not find interface for minor %d\n", subminor);
375 __func__, subminor);
376 retval = -ENODEV; 377 retval = -ENODEV;
377 goto exit; 378 goto exit;
378 } 379 }
379 ictx = usb_get_intfdata(interface); 380 ictx = usb_get_intfdata(interface);
380 381
381 if (!ictx) { 382 if (!ictx) {
382 err("%s: no context found for minor %d", __func__, subminor); 383 pr_err("no context found for minor %d\n", subminor);
383 retval = -ENODEV; 384 retval = -ENODEV;
384 goto exit; 385 goto exit;
385 } 386 }
@@ -387,10 +388,10 @@ static int display_open(struct inode *inode, struct file *file)
387 mutex_lock(&ictx->lock); 388 mutex_lock(&ictx->lock);
388 389
389 if (!ictx->display_supported) { 390 if (!ictx->display_supported) {
390 err("%s: display not supported by device", __func__); 391 pr_err("display not supported by device\n");
391 retval = -ENODEV; 392 retval = -ENODEV;
392 } else if (ictx->display_isopen) { 393 } else if (ictx->display_isopen) {
393 err("%s: display port is already open", __func__); 394 pr_err("display port is already open\n");
394 retval = -EBUSY; 395 retval = -EBUSY;
395 } else { 396 } else {
396 ictx->display_isopen = true; 397 ictx->display_isopen = true;
@@ -417,17 +418,17 @@ static int display_close(struct inode *inode, struct file *file)
417 ictx = file->private_data; 418 ictx = file->private_data;
418 419
419 if (!ictx) { 420 if (!ictx) {
420 err("%s: no context for device", __func__); 421 pr_err("no context for device\n");
421 return -ENODEV; 422 return -ENODEV;
422 } 423 }
423 424
424 mutex_lock(&ictx->lock); 425 mutex_lock(&ictx->lock);
425 426
426 if (!ictx->display_supported) { 427 if (!ictx->display_supported) {
427 err("%s: display not supported by device", __func__); 428 pr_err("display not supported by device\n");
428 retval = -ENODEV; 429 retval = -ENODEV;
429 } else if (!ictx->display_isopen) { 430 } else if (!ictx->display_isopen) {
430 err("%s: display is not open", __func__); 431 pr_err("display is not open\n");
431 retval = -EIO; 432 retval = -EIO;
432 } else { 433 } else {
433 ictx->display_isopen = false; 434 ictx->display_isopen = false;
@@ -506,19 +507,19 @@ static int send_packet(struct imon_context *ictx)
506 if (retval) { 507 if (retval) {
507 ictx->tx.busy = false; 508 ictx->tx.busy = false;
508 smp_rmb(); /* ensure later readers know we're not busy */ 509 smp_rmb(); /* ensure later readers know we're not busy */
509 err("%s: error submitting urb(%d)", __func__, retval); 510 pr_err("error submitting urb(%d)\n", retval);
510 } else { 511 } else {
511 /* Wait for transmission to complete (or abort) */ 512 /* Wait for transmission to complete (or abort) */
512 mutex_unlock(&ictx->lock); 513 mutex_unlock(&ictx->lock);
513 retval = wait_for_completion_interruptible( 514 retval = wait_for_completion_interruptible(
514 &ictx->tx.finished); 515 &ictx->tx.finished);
515 if (retval) 516 if (retval)
516 err("%s: task interrupted", __func__); 517 pr_err("task interrupted\n");
517 mutex_lock(&ictx->lock); 518 mutex_lock(&ictx->lock);
518 519
519 retval = ictx->tx.status; 520 retval = ictx->tx.status;
520 if (retval) 521 if (retval)
521 err("%s: packet tx failed (%d)", __func__, retval); 522 pr_err("packet tx failed (%d)\n", retval);
522 } 523 }
523 524
524 kfree(control_req); 525 kfree(control_req);
@@ -550,12 +551,12 @@ static int send_associate_24g(struct imon_context *ictx)
550 0x00, 0x00, 0x00, 0x20 }; 551 0x00, 0x00, 0x00, 0x20 };
551 552
552 if (!ictx) { 553 if (!ictx) {
553 err("%s: no context for device", __func__); 554 pr_err("no context for device\n");
554 return -ENODEV; 555 return -ENODEV;
555 } 556 }
556 557
557 if (!ictx->dev_present_intf0) { 558 if (!ictx->dev_present_intf0) {
558 err("%s: no iMON device present", __func__); 559 pr_err("no iMON device present\n");
559 return -ENODEV; 560 return -ENODEV;
560 } 561 }
561 562
@@ -583,7 +584,7 @@ static int send_set_imon_clock(struct imon_context *ictx,
583 int i; 584 int i;
584 585
585 if (!ictx) { 586 if (!ictx) {
586 err("%s: no context for device", __func__); 587 pr_err("no context for device\n");
587 return -ENODEV; 588 return -ENODEV;
588 } 589 }
589 590
@@ -644,8 +645,7 @@ static int send_set_imon_clock(struct imon_context *ictx,
644 memcpy(ictx->usb_tx_buf, clock_enable_pkt[i], 8); 645 memcpy(ictx->usb_tx_buf, clock_enable_pkt[i], 8);
645 retval = send_packet(ictx); 646 retval = send_packet(ictx);
646 if (retval) { 647 if (retval) {
647 err("%s: send_packet failed for packet %d", 648 pr_err("send_packet failed for packet %d\n", i);
648 __func__, i);
649 break; 649 break;
650 } 650 }
651 } 651 }
@@ -821,20 +821,20 @@ static ssize_t vfd_write(struct file *file, const char *buf,
821 821
822 ictx = file->private_data; 822 ictx = file->private_data;
823 if (!ictx) { 823 if (!ictx) {
824 err("%s: no context for device", __func__); 824 pr_err("no context for device\n");
825 return -ENODEV; 825 return -ENODEV;
826 } 826 }
827 827
828 mutex_lock(&ictx->lock); 828 mutex_lock(&ictx->lock);
829 829
830 if (!ictx->dev_present_intf0) { 830 if (!ictx->dev_present_intf0) {
831 err("%s: no iMON device present", __func__); 831 pr_err("no iMON device present\n");
832 retval = -ENODEV; 832 retval = -ENODEV;
833 goto exit; 833 goto exit;
834 } 834 }
835 835
836 if (n_bytes <= 0 || n_bytes > 32) { 836 if (n_bytes <= 0 || n_bytes > 32) {
837 err("%s: invalid payload size", __func__); 837 pr_err("invalid payload size\n");
838 retval = -EINVAL; 838 retval = -EINVAL;
839 goto exit; 839 goto exit;
840 } 840 }
@@ -860,8 +860,7 @@ static ssize_t vfd_write(struct file *file, const char *buf,
860 860
861 retval = send_packet(ictx); 861 retval = send_packet(ictx);
862 if (retval) { 862 if (retval) {
863 err("%s: send packet failed for packet #%d", 863 pr_err("send packet failed for packet #%d\n", seq / 2);
864 __func__, seq/2);
865 goto exit; 864 goto exit;
866 } else { 865 } else {
867 seq += 2; 866 seq += 2;
@@ -875,8 +874,7 @@ static ssize_t vfd_write(struct file *file, const char *buf,
875 ictx->usb_tx_buf[7] = (unsigned char) seq; 874 ictx->usb_tx_buf[7] = (unsigned char) seq;
876 retval = send_packet(ictx); 875 retval = send_packet(ictx);
877 if (retval) 876 if (retval)
878 err("%s: send packet failed for packet #%d", 877 pr_err("send packet failed for packet #%d\n", seq / 2);
879 __func__, seq / 2);
880 878
881exit: 879exit:
882 mutex_unlock(&ictx->lock); 880 mutex_unlock(&ictx->lock);
@@ -905,21 +903,20 @@ static ssize_t lcd_write(struct file *file, const char *buf,
905 903
906 ictx = file->private_data; 904 ictx = file->private_data;
907 if (!ictx) { 905 if (!ictx) {
908 err("%s: no context for device", __func__); 906 pr_err("no context for device\n");
909 return -ENODEV; 907 return -ENODEV;
910 } 908 }
911 909
912 mutex_lock(&ictx->lock); 910 mutex_lock(&ictx->lock);
913 911
914 if (!ictx->display_supported) { 912 if (!ictx->display_supported) {
915 err("%s: no iMON display present", __func__); 913 pr_err("no iMON display present\n");
916 retval = -ENODEV; 914 retval = -ENODEV;
917 goto exit; 915 goto exit;
918 } 916 }
919 917
920 if (n_bytes != 8) { 918 if (n_bytes != 8) {
921 err("%s: invalid payload size: %d (expecting 8)", 919 pr_err("invalid payload size: %d (expected 8)\n", (int)n_bytes);
922 __func__, (int) n_bytes);
923 retval = -EINVAL; 920 retval = -EINVAL;
924 goto exit; 921 goto exit;
925 } 922 }
@@ -931,7 +928,7 @@ static ssize_t lcd_write(struct file *file, const char *buf,
931 928
932 retval = send_packet(ictx); 929 retval = send_packet(ictx);
933 if (retval) { 930 if (retval) {
934 err("%s: send packet failed!", __func__); 931 pr_err("send packet failed!\n");
935 goto exit; 932 goto exit;
936 } else { 933 } else {
937 dev_dbg(ictx->dev, "%s: write %d bytes to LCD\n", 934 dev_dbg(ictx->dev, "%s: write %d bytes to LCD\n",
@@ -2065,7 +2062,7 @@ static bool imon_find_endpoints(struct imon_context *ictx,
2065 2062
2066 /* Input endpoint is mandatory */ 2063 /* Input endpoint is mandatory */
2067 if (!ir_ep_found) 2064 if (!ir_ep_found)
2068 err("%s: no valid input (IR) endpoint found.", __func__); 2065 pr_err("no valid input (IR) endpoint found\n");
2069 2066
2070 ictx->tx_control = tx_control; 2067 ictx->tx_control = tx_control;
2071 2068
@@ -2144,8 +2141,7 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf)
2144 2141
2145 ret = usb_submit_urb(ictx->rx_urb_intf0, GFP_KERNEL); 2142 ret = usb_submit_urb(ictx->rx_urb_intf0, GFP_KERNEL);
2146 if (ret) { 2143 if (ret) {
2147 err("%s: usb_submit_urb failed for intf0 (%d)", 2144 pr_err("usb_submit_urb failed for intf0 (%d)\n", ret);
2148 __func__, ret);
2149 goto urb_submit_failed; 2145 goto urb_submit_failed;
2150 } 2146 }
2151 2147
@@ -2178,7 +2174,7 @@ static struct imon_context *imon_init_intf1(struct usb_interface *intf,
2178 2174
2179 rx_urb = usb_alloc_urb(0, GFP_KERNEL); 2175 rx_urb = usb_alloc_urb(0, GFP_KERNEL);
2180 if (!rx_urb) { 2176 if (!rx_urb) {
2181 err("%s: usb_alloc_urb failed for IR urb", __func__); 2177 pr_err("usb_alloc_urb failed for IR urb\n");
2182 goto rx_urb_alloc_failed; 2178 goto rx_urb_alloc_failed;
2183 } 2179 }
2184 2180
@@ -2216,8 +2212,7 @@ static struct imon_context *imon_init_intf1(struct usb_interface *intf,
2216 ret = usb_submit_urb(ictx->rx_urb_intf1, GFP_KERNEL); 2212 ret = usb_submit_urb(ictx->rx_urb_intf1, GFP_KERNEL);
2217 2213
2218 if (ret) { 2214 if (ret) {
2219 err("%s: usb_submit_urb failed for intf1 (%d)", 2215 pr_err("usb_submit_urb failed for intf1 (%d)\n", ret);
2220 __func__, ret);
2221 goto urb_submit_failed; 2216 goto urb_submit_failed;
2222 } 2217 }
2223 2218
@@ -2297,7 +2292,7 @@ static int __devinit imon_probe(struct usb_interface *interface,
2297 if (ifnum == 0) { 2292 if (ifnum == 0) {
2298 ictx = imon_init_intf0(interface); 2293 ictx = imon_init_intf0(interface);
2299 if (!ictx) { 2294 if (!ictx) {
2300 err("%s: failed to initialize context!\n", __func__); 2295 pr_err("failed to initialize context!\n");
2301 ret = -ENODEV; 2296 ret = -ENODEV;
2302 goto fail; 2297 goto fail;
2303 } 2298 }
@@ -2306,7 +2301,7 @@ static int __devinit imon_probe(struct usb_interface *interface,
2306 /* this is the secondary interface on the device */ 2301 /* this is the secondary interface on the device */
2307 ictx = imon_init_intf1(interface, first_if_ctx); 2302 ictx = imon_init_intf1(interface, first_if_ctx);
2308 if (!ictx) { 2303 if (!ictx) {
2309 err("%s: failed to attach to context!\n", __func__); 2304 pr_err("failed to attach to context!\n");
2310 ret = -ENODEV; 2305 ret = -ENODEV;
2311 goto fail; 2306 goto fail;
2312 } 2307 }
@@ -2320,8 +2315,8 @@ static int __devinit imon_probe(struct usb_interface *interface,
2320 sysfs_err = sysfs_create_group(&interface->dev.kobj, 2315 sysfs_err = sysfs_create_group(&interface->dev.kobj,
2321 &imon_rf_attribute_group); 2316 &imon_rf_attribute_group);
2322 if (sysfs_err) 2317 if (sysfs_err)
2323 err("%s: Could not create RF sysfs entries(%d)", 2318 pr_err("Could not create RF sysfs entries(%d)\n",
2324 __func__, sysfs_err); 2319 sysfs_err);
2325 } 2320 }
2326 2321
2327 if (ictx->display_supported) 2322 if (ictx->display_supported)
@@ -2469,7 +2464,7 @@ static int __init imon_init(void)
2469 2464
2470 rc = usb_register(&imon_driver); 2465 rc = usb_register(&imon_driver);
2471 if (rc) { 2466 if (rc) {
2472 err("%s: usb register failed(%d)", __func__, rc); 2467 pr_err("usb register failed(%d)\n", rc);
2473 rc = -ENODEV; 2468 rc = -ENODEV;
2474 } 2469 }
2475 2470