aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2012-09-12 19:23:53 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-09-23 19:49:22 -0400
commit119f7a8c5ded2789defdccc6dfe50d9934ea156e (patch)
tree2c00d79c4068eb4a7a0473487a9ddb1d0061534e /drivers/media
parente1e9e510bb8639ace59dcd1f8e6b5754dfbb9b44 (diff)
[media] af9035: use Kernel dev_foo() logging
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/usb/dvb-usb-v2/af9035.c90
1 files changed, 49 insertions, 41 deletions
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c
index fdec3b1a186b..7d599a999619 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.c
+++ b/drivers/media/usb/dvb-usb-v2/af9035.c
@@ -53,9 +53,9 @@ static int af9035_ctrl_msg(struct dvb_usb_device *d, struct usb_req *req)
53 53
54 /* buffer overflow check */ 54 /* buffer overflow check */
55 if (req->wlen > (BUF_LEN - REQ_HDR_LEN - CHECKSUM_LEN) || 55 if (req->wlen > (BUF_LEN - REQ_HDR_LEN - CHECKSUM_LEN) ||
56 req->rlen > (BUF_LEN - ACK_HDR_LEN - CHECKSUM_LEN)) { 56 req->rlen > (BUF_LEN - ACK_HDR_LEN - CHECKSUM_LEN)) {
57 pr_debug("%s: too much data wlen=%d rlen=%d\n", __func__, 57 dev_err(&d->udev->dev, "%s: too much data wlen=%d rlen=%d\n",
58 req->wlen, req->rlen); 58 __func__, req->wlen, req->rlen);
59 return -EINVAL; 59 return -EINVAL;
60 } 60 }
61 61
@@ -89,17 +89,17 @@ static int af9035_ctrl_msg(struct dvb_usb_device *d, struct usb_req *req)
89 checksum = af9035_checksum(buf, rlen - 2); 89 checksum = af9035_checksum(buf, rlen - 2);
90 tmp_checksum = (buf[rlen - 2] << 8) | buf[rlen - 1]; 90 tmp_checksum = (buf[rlen - 2] << 8) | buf[rlen - 1];
91 if (tmp_checksum != checksum) { 91 if (tmp_checksum != checksum) {
92 pr_err("%s: command=%02x checksum mismatch (%04x != %04x)\n", 92 dev_err(&d->udev->dev, "%s: command=%02x checksum mismatch " \
93 KBUILD_MODNAME, req->cmd, tmp_checksum, 93 "(%04x != %04x)\n", KBUILD_MODNAME, req->cmd,
94 checksum); 94 tmp_checksum, checksum);
95 ret = -EIO; 95 ret = -EIO;
96 goto err; 96 goto err;
97 } 97 }
98 98
99 /* check status */ 99 /* check status */
100 if (buf[2]) { 100 if (buf[2]) {
101 pr_debug("%s: command=%02x failed fw error=%d\n", __func__, 101 dev_dbg(&d->udev->dev, "%s: command=%02x failed fw error=%d\n",
102 req->cmd, buf[2]); 102 __func__, req->cmd, buf[2]);
103 ret = -EIO; 103 ret = -EIO;
104 goto err; 104 goto err;
105 } 105 }
@@ -112,7 +112,7 @@ exit:
112 return 0; 112 return 0;
113 113
114err: 114err:
115 pr_debug("%s: failed=%d\n", __func__, ret); 115 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
116 116
117 return ret; 117 return ret;
118} 118}
@@ -290,7 +290,7 @@ static int af9035_identify_state(struct dvb_usb_device *d, const char **name)
290 if (ret < 0) 290 if (ret < 0)
291 goto err; 291 goto err;
292 292
293 pr_debug("%s: reply=%*ph\n", __func__, 4, rbuf); 293 dev_dbg(&d->udev->dev, "%s: reply=%*ph\n", __func__, 4, rbuf);
294 if (rbuf[0] || rbuf[1] || rbuf[2] || rbuf[3]) 294 if (rbuf[0] || rbuf[1] || rbuf[2] || rbuf[3])
295 ret = WARM; 295 ret = WARM;
296 else 296 else
@@ -299,7 +299,7 @@ static int af9035_identify_state(struct dvb_usb_device *d, const char **name)
299 return ret; 299 return ret;
300 300
301err: 301err:
302 pr_debug("%s: failed=%d\n", __func__, ret); 302 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
303 303
304 return ret; 304 return ret;
305} 305}
@@ -339,13 +339,13 @@ static int af9035_download_firmware(struct dvb_usb_device *d,
339 hdr_checksum = fw->data[fw->size - i + 5] << 8; 339 hdr_checksum = fw->data[fw->size - i + 5] << 8;
340 hdr_checksum |= fw->data[fw->size - i + 6] << 0; 340 hdr_checksum |= fw->data[fw->size - i + 6] << 0;
341 341
342 pr_debug("%s: core=%d addr=%04x data_len=%d checksum=%04x\n", 342 dev_dbg(&d->udev->dev, "%s: core=%d addr=%04x data_len=%d " \
343 __func__, hdr_core, hdr_addr, hdr_data_len, 343 "checksum=%04x\n", __func__, hdr_core, hdr_addr,
344 hdr_checksum); 344 hdr_data_len, hdr_checksum);
345 345
346 if (((hdr_core != 1) && (hdr_core != 2)) || 346 if (((hdr_core != 1) && (hdr_core != 2)) ||
347 (hdr_data_len > i)) { 347 (hdr_data_len > i)) {
348 pr_debug("%s: bad firmware\n", __func__); 348 dev_dbg(&d->udev->dev, "%s: bad firmware\n", __func__);
349 break; 349 break;
350 } 350 }
351 351
@@ -376,7 +376,8 @@ static int af9035_download_firmware(struct dvb_usb_device *d,
376 376
377 i -= hdr_data_len + HDR_SIZE; 377 i -= hdr_data_len + HDR_SIZE;
378 378
379 pr_debug("%s: data uploaded=%zu\n", __func__, fw->size - i); 379 dev_dbg(&d->udev->dev, "%s: data uploaded=%zu\n",
380 __func__, fw->size - i);
380 } 381 }
381 382
382 /* firmware loaded, request boot */ 383 /* firmware loaded, request boot */
@@ -392,18 +393,19 @@ static int af9035_download_firmware(struct dvb_usb_device *d,
392 goto err; 393 goto err;
393 394
394 if (!(rbuf[0] || rbuf[1] || rbuf[2] || rbuf[3])) { 395 if (!(rbuf[0] || rbuf[1] || rbuf[2] || rbuf[3])) {
395 pr_err("%s: firmware did not run\n", KBUILD_MODNAME); 396 dev_err(&d->udev->dev, "%s: firmware did not run\n",
397 KBUILD_MODNAME);
396 ret = -ENODEV; 398 ret = -ENODEV;
397 goto err; 399 goto err;
398 } 400 }
399 401
400 pr_info("%s: firmware version=%d.%d.%d.%d", KBUILD_MODNAME, 402 dev_info(&d->udev->dev, "%s: firmware version=%d.%d.%d.%d",
401 rbuf[0], rbuf[1], rbuf[2], rbuf[3]); 403 KBUILD_MODNAME, rbuf[0], rbuf[1], rbuf[2], rbuf[3]);
402 404
403 return 0; 405 return 0;
404 406
405err: 407err:
406 pr_debug("%s: failed=%d\n", __func__, ret); 408 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
407 409
408 return ret; 410 return ret;
409} 411}
@@ -445,7 +447,8 @@ static int af9035_download_firmware_it9135(struct dvb_usb_device *d,
445 if (ret < 0) 447 if (ret < 0)
446 goto err; 448 goto err;
447 449
448 pr_debug("%s: data uploaded=%d\n", __func__, i); 450 dev_dbg(&d->udev->dev, "%s: data uploaded=%d\n",
451 __func__, i);
449 } 452 }
450 } 453 }
451 454
@@ -462,18 +465,19 @@ static int af9035_download_firmware_it9135(struct dvb_usb_device *d,
462 goto err; 465 goto err;
463 466
464 if (!(rbuf[0] || rbuf[1] || rbuf[2] || rbuf[3])) { 467 if (!(rbuf[0] || rbuf[1] || rbuf[2] || rbuf[3])) {
465 pr_err("%s: firmware did not run\n", KBUILD_MODNAME); 468 dev_err(&d->udev->dev, "%s: firmware did not run\n",
469 KBUILD_MODNAME);
466 ret = -ENODEV; 470 ret = -ENODEV;
467 goto err; 471 goto err;
468 } 472 }
469 473
470 pr_info("%s: firmware version=%d.%d.%d.%d", KBUILD_MODNAME, 474 dev_info(&d->udev->dev, "%s: firmware version=%d.%d.%d.%d",
471 rbuf[0], rbuf[1], rbuf[2], rbuf[3]); 475 KBUILD_MODNAME, rbuf[0], rbuf[1], rbuf[2], rbuf[3]);
472 476
473 return 0; 477 return 0;
474 478
475err: 479err:
476 pr_debug("%s: failed=%d\n", __func__, ret); 480 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
477 481
478 return ret; 482 return ret;
479} 483}
@@ -491,7 +495,8 @@ static int af9035_read_config(struct dvb_usb_device *d)
491 goto err; 495 goto err;
492 496
493 state->dual_mode = tmp; 497 state->dual_mode = tmp;
494 pr_debug("%s: dual mode=%d\n", __func__, state->dual_mode); 498 dev_dbg(&d->udev->dev, "%s: dual mode=%d\n",
499 __func__, state->dual_mode);
495 500
496 for (i = 0; i < state->dual_mode + 1; i++) { 501 for (i = 0; i < state->dual_mode + 1; i++) {
497 /* tuner */ 502 /* tuner */
@@ -500,7 +505,8 @@ static int af9035_read_config(struct dvb_usb_device *d)
500 goto err; 505 goto err;
501 506
502 state->af9033_config[i].tuner = tmp; 507 state->af9033_config[i].tuner = tmp;
503 pr_debug("%s: [%d]tuner=%02x\n", __func__, i, tmp); 508 dev_dbg(&d->udev->dev, "%s: [%d]tuner=%02x\n",
509 __func__, i, tmp);
504 510
505 switch (tmp) { 511 switch (tmp) {
506 case AF9033_TUNER_TUA9001: 512 case AF9033_TUNER_TUA9001:
@@ -510,8 +516,9 @@ static int af9035_read_config(struct dvb_usb_device *d)
510 state->af9033_config[i].spec_inv = 1; 516 state->af9033_config[i].spec_inv = 1;
511 break; 517 break;
512 default: 518 default:
513 pr_info("%s: tuner ID=%02x not supported, please " \ 519 dev_warn(&d->udev->dev, "%s: tuner id=%02x not " \
514 "report!", KBUILD_MODNAME, tmp); 520 "supported, please report!",
521 KBUILD_MODNAME, tmp);
515 }; 522 };
516 523
517 /* tuner IF frequency */ 524 /* tuner IF frequency */
@@ -527,7 +534,7 @@ static int af9035_read_config(struct dvb_usb_device *d)
527 534
528 tmp16 |= tmp << 8; 535 tmp16 |= tmp << 8;
529 536
530 pr_debug("%s: [%d]IF=%d\n", __func__, i, tmp16); 537 dev_dbg(&d->udev->dev, "%s: [%d]IF=%d\n", __func__, i, tmp16);
531 538
532 eeprom_shift = 0x10; /* shift for the 2nd tuner params */ 539 eeprom_shift = 0x10; /* shift for the 2nd tuner params */
533 } 540 }
@@ -545,7 +552,7 @@ static int af9035_read_config(struct dvb_usb_device *d)
545 return 0; 552 return 0;
546 553
547err: 554err:
548 pr_debug("%s: failed=%d\n", __func__, ret); 555 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
549 556
550 return ret; 557 return ret;
551} 558}
@@ -571,7 +578,7 @@ static int af9035_read_config_it9135(struct dvb_usb_device *d)
571 return 0; 578 return 0;
572 579
573err: 580err:
574 pr_debug("%s: failed=%d\n", __func__, ret); 581 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
575 582
576 return ret; 583 return ret;
577} 584}
@@ -636,7 +643,7 @@ static int af9035_fc0011_tuner_callback(struct dvb_usb_device *d,
636 return 0; 643 return 0;
637 644
638err: 645err:
639 pr_debug("%s: failed=%d\n", __func__, ret); 646 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
640 647
641 return ret; 648 return ret;
642} 649}
@@ -716,7 +723,7 @@ static int af9035_frontend_attach(struct dvb_usb_adapter *adap)
716 return 0; 723 return 0;
717 724
718err: 725err:
719 pr_debug("%s: failed=%d\n", __func__, ret); 726 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
720 727
721 return ret; 728 return ret;
722} 729}
@@ -856,7 +863,7 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
856 return 0; 863 return 0;
857 864
858err: 865err:
859 pr_debug("%s: failed=%d\n", __func__, ret); 866 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
860 867
861 return ret; 868 return ret;
862} 869}
@@ -888,8 +895,9 @@ static int af9035_init(struct dvb_usb_device *d)
888 { 0x80f9a4, 0x00, 0x01 }, 895 { 0x80f9a4, 0x00, 0x01 },
889 }; 896 };
890 897
891 pr_debug("%s: USB speed=%d frame_size=%04x packet_size=%02x\n", 898 dev_dbg(&d->udev->dev, "%s: USB speed=%d frame_size=%04x " \
892 __func__, d->udev->speed, frame_size, packet_size); 899 "packet_size=%02x\n", __func__,
900 d->udev->speed, frame_size, packet_size);
893 901
894 /* init endpoints */ 902 /* init endpoints */
895 for (i = 0; i < ARRAY_SIZE(tab); i++) { 903 for (i = 0; i < ARRAY_SIZE(tab); i++) {
@@ -902,7 +910,7 @@ static int af9035_init(struct dvb_usb_device *d)
902 return 0; 910 return 0;
903 911
904err: 912err:
905 pr_debug("%s: failed=%d\n", __func__, ret); 913 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
906 914
907 return ret; 915 return ret;
908} 916}
@@ -946,7 +954,7 @@ static int af9035_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
946 if (ret < 0) 954 if (ret < 0)
947 goto err; 955 goto err;
948 956
949 pr_debug("%s: ir_mode=%02x\n", __func__, tmp); 957 dev_dbg(&d->udev->dev, "%s: ir_mode=%02x\n", __func__, tmp);
950 958
951 /* don't activate rc if in HID mode or if not available */ 959 /* don't activate rc if in HID mode or if not available */
952 if (tmp == 5) { 960 if (tmp == 5) {
@@ -954,7 +962,7 @@ static int af9035_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
954 if (ret < 0) 962 if (ret < 0)
955 goto err; 963 goto err;
956 964
957 pr_debug("%s: ir_type=%02x\n", __func__, tmp); 965 dev_dbg(&d->udev->dev, "%s: ir_type=%02x\n", __func__, tmp);
958 966
959 switch (tmp) { 967 switch (tmp) {
960 case 0: /* NEC */ 968 case 0: /* NEC */
@@ -977,7 +985,7 @@ static int af9035_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
977 return 0; 985 return 0;
978 986
979err: 987err:
980 pr_debug("%s: failed=%d\n", __func__, ret); 988 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
981 989
982 return ret; 990 return ret;
983} 991}