aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb-frontends
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2012-09-11 21:27:11 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-09-23 18:46:48 -0400
commit298efdd3765dfdfb92976d3bb7113061f8b0a92a (patch)
tree1c296d0d363b9989804dfd10a88401c008e2aabd /drivers/media/dvb-frontends
parente6211c7c99ad9e13b28698d4258763b5bb7420e1 (diff)
[media] rtl2832: use 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/dvb-frontends')
-rw-r--r--drivers/media/dvb-frontends/rtl2832.c64
-rw-r--r--drivers/media/dvb-frontends/rtl2832.h2
-rw-r--r--drivers/media/dvb-frontends/rtl2832_priv.h15
3 files changed, 33 insertions, 48 deletions
diff --git a/drivers/media/dvb-frontends/rtl2832.c b/drivers/media/dvb-frontends/rtl2832.c
index 8f8a5b0c7f3f..aaf0c29f0229 100644
--- a/drivers/media/dvb-frontends/rtl2832.c
+++ b/drivers/media/dvb-frontends/rtl2832.c
@@ -179,7 +179,8 @@ static int rtl2832_wr(struct rtl2832_priv *priv, u8 reg, u8 *val, int len)
179 if (ret == 1) { 179 if (ret == 1) {
180 ret = 0; 180 ret = 0;
181 } else { 181 } else {
182 warn("i2c wr failed=%d reg=%02x len=%d", ret, reg, len); 182 dev_warn(&priv->i2c->dev, "%s: i2c wr failed=%d reg=%02x " \
183 "len=%d\n", KBUILD_MODNAME, ret, reg, len);
183 ret = -EREMOTEIO; 184 ret = -EREMOTEIO;
184 } 185 }
185 return ret; 186 return ret;
@@ -207,10 +208,11 @@ static int rtl2832_rd(struct rtl2832_priv *priv, u8 reg, u8 *val, int len)
207 if (ret == 2) { 208 if (ret == 2) {
208 ret = 0; 209 ret = 0;
209 } else { 210 } else {
210 warn("i2c rd failed=%d reg=%02x len=%d", ret, reg, len); 211 dev_warn(&priv->i2c->dev, "%s: i2c rd failed=%d reg=%02x " \
212 "len=%d\n", KBUILD_MODNAME, ret, reg, len);
211 ret = -EREMOTEIO; 213 ret = -EREMOTEIO;
212} 214 }
213return ret; 215 return ret;
214} 216}
215 217
216/* write multiple registers */ 218/* write multiple registers */
@@ -219,7 +221,6 @@ static int rtl2832_wr_regs(struct rtl2832_priv *priv, u8 reg, u8 page, u8 *val,
219{ 221{
220 int ret; 222 int ret;
221 223
222
223 /* switch bank if needed */ 224 /* switch bank if needed */
224 if (page != priv->page) { 225 if (page != priv->page) {
225 ret = rtl2832_wr(priv, 0x00, &page, 1); 226 ret = rtl2832_wr(priv, 0x00, &page, 1);
@@ -299,7 +300,7 @@ int rtl2832_rd_demod_reg(struct rtl2832_priv *priv, int reg, u32 *val)
299 return ret; 300 return ret;
300 301
301err: 302err:
302 dbg("%s: failed=%d", __func__, ret); 303 dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
303 return ret; 304 return ret;
304 305
305} 306}
@@ -351,7 +352,7 @@ int rtl2832_wr_demod_reg(struct rtl2832_priv *priv, int reg, u32 val)
351 return ret; 352 return ret;
352 353
353err: 354err:
354 dbg("%s: failed=%d", __func__, ret); 355 dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
355 return ret; 356 return ret;
356 357
357} 358}
@@ -361,7 +362,7 @@ static int rtl2832_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
361 int ret; 362 int ret;
362 struct rtl2832_priv *priv = fe->demodulator_priv; 363 struct rtl2832_priv *priv = fe->demodulator_priv;
363 364
364 dbg("%s: enable=%d", __func__, enable); 365 dev_dbg(&priv->i2c->dev, "%s: enable=%d\n", __func__, enable);
365 366
366 /* gate already open or close */ 367 /* gate already open or close */
367 if (priv->i2c_gate_state == enable) 368 if (priv->i2c_gate_state == enable)
@@ -375,7 +376,7 @@ static int rtl2832_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
375 376
376 return ret; 377 return ret;
377err: 378err:
378 dbg("%s: failed=%d", __func__, ret); 379 dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
379 return ret; 380 return ret;
380} 381}
381 382
@@ -434,7 +435,7 @@ static int rtl2832_init(struct dvb_frontend *fe)
434 {DVBT_SPEC_INV, 0x0}, 435 {DVBT_SPEC_INV, 0x0},
435 }; 436 };
436 437
437 dbg("%s", __func__); 438 dev_dbg(&priv->i2c->dev, "%s:\n", __func__);
438 439
439 en_bbin = (priv->cfg.if_dvbt == 0 ? 0x1 : 0x0); 440 en_bbin = (priv->cfg.if_dvbt == 0 ? 0x1 : 0x0);
440 441
@@ -455,7 +456,8 @@ static int rtl2832_init(struct dvb_frontend *fe)
455 } 456 }
456 457
457 /* load tuner specific settings */ 458 /* load tuner specific settings */
458 dbg("%s: load settings for tuner=%02x", __func__, priv->cfg.tuner); 459 dev_dbg(&priv->i2c->dev, "%s: load settings for tuner=%02x\n",
460 __func__, priv->cfg.tuner);
459 switch (priv->cfg.tuner) { 461 switch (priv->cfg.tuner) {
460 case RTL2832_TUNER_FC0012: 462 case RTL2832_TUNER_FC0012:
461 case RTL2832_TUNER_FC0013: 463 case RTL2832_TUNER_FC0013:
@@ -491,7 +493,7 @@ static int rtl2832_init(struct dvb_frontend *fe)
491 return ret; 493 return ret;
492 494
493err: 495err:
494 dbg("%s: failed=%d", __func__, ret); 496 dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
495 return ret; 497 return ret;
496} 498}
497 499
@@ -499,7 +501,7 @@ static int rtl2832_sleep(struct dvb_frontend *fe)
499{ 501{
500 struct rtl2832_priv *priv = fe->demodulator_priv; 502 struct rtl2832_priv *priv = fe->demodulator_priv;
501 503
502 dbg("%s", __func__); 504 dev_dbg(&priv->i2c->dev, "%s:\n", __func__);
503 priv->sleeping = true; 505 priv->sleeping = true;
504 return 0; 506 return 0;
505} 507}
@@ -507,7 +509,9 @@ static int rtl2832_sleep(struct dvb_frontend *fe)
507int rtl2832_get_tune_settings(struct dvb_frontend *fe, 509int rtl2832_get_tune_settings(struct dvb_frontend *fe,
508 struct dvb_frontend_tune_settings *s) 510 struct dvb_frontend_tune_settings *s)
509{ 511{
510 dbg("%s", __func__); 512 struct rtl2832_priv *priv = fe->demodulator_priv;
513
514 dev_dbg(&priv->i2c->dev, "%s:\n", __func__);
511 s->min_delay_ms = 1000; 515 s->min_delay_ms = 1000;
512 s->step_size = fe->ops.info.frequency_stepsize * 2; 516 s->step_size = fe->ops.info.frequency_stepsize * 2;
513 s->max_drift = (fe->ops.info.frequency_stepsize * 2) + 1; 517 s->max_drift = (fe->ops.info.frequency_stepsize * 2) + 1;
@@ -521,8 +525,6 @@ static int rtl2832_set_frontend(struct dvb_frontend *fe)
521 int ret, i, j; 525 int ret, i, j;
522 u64 bw_mode, num, num2; 526 u64 bw_mode, num, num2;
523 u32 resamp_ratio, cfreq_off_ratio; 527 u32 resamp_ratio, cfreq_off_ratio;
524
525
526 static u8 bw_params[3][32] = { 528 static u8 bw_params[3][32] = {
527 /* 6 MHz bandwidth */ 529 /* 6 MHz bandwidth */
528 { 530 {
@@ -550,15 +552,14 @@ static int rtl2832_set_frontend(struct dvb_frontend *fe)
550 }; 552 };
551 553
552 554
553 dbg("%s: frequency=%d bandwidth_hz=%d inversion=%d", __func__, 555 dev_dbg(&priv->i2c->dev, "%s: frequency=%d bandwidth_hz=%d " \
554 c->frequency, c->bandwidth_hz, c->inversion); 556 "inversion=%d\n", __func__, c->frequency,
555 557 c->bandwidth_hz, c->inversion);
556 558
557 /* program tuner */ 559 /* program tuner */
558 if (fe->ops.tuner_ops.set_params) 560 if (fe->ops.tuner_ops.set_params)
559 fe->ops.tuner_ops.set_params(fe); 561 fe->ops.tuner_ops.set_params(fe);
560 562
561
562 switch (c->bandwidth_hz) { 563 switch (c->bandwidth_hz) {
563 case 6000000: 564 case 6000000:
564 i = 0; 565 i = 0;
@@ -573,7 +574,7 @@ static int rtl2832_set_frontend(struct dvb_frontend *fe)
573 bw_mode = 64000000; 574 bw_mode = 64000000;
574 break; 575 break;
575 default: 576 default:
576 dbg("invalid bandwidth"); 577 dev_dbg(&priv->i2c->dev, "%s: invalid bandwidth\n", __func__);
577 return -EINVAL; 578 return -EINVAL;
578 } 579 }
579 580
@@ -620,7 +621,7 @@ static int rtl2832_set_frontend(struct dvb_frontend *fe)
620 621
621 return ret; 622 return ret;
622err: 623err:
623 info("%s: failed=%d", __func__, ret); 624 dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
624 return ret; 625 return ret;
625} 626}
626 627
@@ -642,7 +643,7 @@ static int rtl2832_get_frontend(struct dvb_frontend *fe)
642 if (ret) 643 if (ret)
643 goto err; 644 goto err;
644 645
645 dbg("%s: TPS=%*ph", __func__, 3, buf); 646 dev_dbg(&priv->i2c->dev, "%s: TPS=%*ph\n", __func__, 3, buf);
646 647
647 switch ((buf[0] >> 2) & 3) { 648 switch ((buf[0] >> 2) & 3) {
648 case 0: 649 case 0:
@@ -732,7 +733,7 @@ static int rtl2832_get_frontend(struct dvb_frontend *fe)
732 733
733 return 0; 734 return 0;
734err: 735err:
735 dbg("%s: failed=%d", __func__, ret); 736 dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
736 return ret; 737 return ret;
737} 738}
738 739
@@ -743,8 +744,7 @@ static int rtl2832_read_status(struct dvb_frontend *fe, fe_status_t *status)
743 u32 tmp; 744 u32 tmp;
744 *status = 0; 745 *status = 0;
745 746
746 747 dev_dbg(&priv->i2c->dev, "%s:\n", __func__);
747 dbg("%s", __func__);
748 if (priv->sleeping) 748 if (priv->sleeping)
749 return 0; 749 return 0;
750 750
@@ -764,7 +764,7 @@ static int rtl2832_read_status(struct dvb_frontend *fe, fe_status_t *status)
764 764
765 return ret; 765 return ret;
766err: 766err:
767 info("%s: failed=%d", __func__, ret); 767 dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
768 return ret; 768 return ret;
769} 769}
770 770
@@ -810,7 +810,7 @@ static int rtl2832_read_snr(struct dvb_frontend *fe, u16 *snr)
810 810
811 return 0; 811 return 0;
812err: 812err:
813 dbg("%s: failed=%d", __func__, ret); 813 dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
814 return ret; 814 return ret;
815} 815}
816 816
@@ -828,7 +828,7 @@ static int rtl2832_read_ber(struct dvb_frontend *fe, u32 *ber)
828 828
829 return 0; 829 return 0;
830err: 830err:
831 dbg("%s: failed=%d", __func__, ret); 831 dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
832 return ret; 832 return ret;
833} 833}
834 834
@@ -838,7 +838,7 @@ static void rtl2832_release(struct dvb_frontend *fe)
838{ 838{
839 struct rtl2832_priv *priv = fe->demodulator_priv; 839 struct rtl2832_priv *priv = fe->demodulator_priv;
840 840
841 dbg("%s", __func__); 841 dev_dbg(&priv->i2c->dev, "%s:\n", __func__);
842 kfree(priv); 842 kfree(priv);
843} 843}
844 844
@@ -849,7 +849,7 @@ struct dvb_frontend *rtl2832_attach(const struct rtl2832_config *cfg,
849 int ret = 0; 849 int ret = 0;
850 u8 tmp; 850 u8 tmp;
851 851
852 dbg("%s", __func__); 852 dev_dbg(&i2c->dev, "%s:\n", __func__);
853 853
854 /* allocate memory for the internal state */ 854 /* allocate memory for the internal state */
855 priv = kzalloc(sizeof(struct rtl2832_priv), GFP_KERNEL); 855 priv = kzalloc(sizeof(struct rtl2832_priv), GFP_KERNEL);
@@ -875,7 +875,7 @@ struct dvb_frontend *rtl2832_attach(const struct rtl2832_config *cfg,
875 875
876 return &priv->fe; 876 return &priv->fe;
877err: 877err:
878 dbg("%s: failed=%d", __func__, ret); 878 dev_dbg(&i2c->dev, "%s: failed=%d\n", __func__, ret);
879 kfree(priv); 879 kfree(priv);
880 return NULL; 880 return NULL;
881} 881}
diff --git a/drivers/media/dvb-frontends/rtl2832.h b/drivers/media/dvb-frontends/rtl2832.h
index f7cb09a2cb6e..c4a611868195 100644
--- a/drivers/media/dvb-frontends/rtl2832.h
+++ b/drivers/media/dvb-frontends/rtl2832.h
@@ -65,7 +65,7 @@ static inline struct dvb_frontend *rtl2832_attach(
65 struct i2c_adapter *i2c 65 struct i2c_adapter *i2c
66) 66)
67{ 67{
68 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 68 pr_warn("%s: driver disabled by Kconfig\n", __func__);
69 return NULL; 69 return NULL;
70} 70}
71#endif 71#endif
diff --git a/drivers/media/dvb-frontends/rtl2832_priv.h b/drivers/media/dvb-frontends/rtl2832_priv.h
index 75af963f444f..5e68955a539c 100644
--- a/drivers/media/dvb-frontends/rtl2832_priv.h
+++ b/drivers/media/dvb-frontends/rtl2832_priv.h
@@ -24,21 +24,6 @@
24#include "dvb_frontend.h" 24#include "dvb_frontend.h"
25#include "rtl2832.h" 25#include "rtl2832.h"
26 26
27#define LOG_PREFIX "rtl2832"
28
29#undef dbg
30#define dbg(f, arg...) \
31do { \
32 if (rtl2832_debug) \
33 printk(KERN_INFO LOG_PREFIX": " f "\n" , ## arg); \
34} while (0)
35#undef err
36#define err(f, arg...) printk(KERN_ERR LOG_PREFIX": " f "\n" , ## arg)
37#undef info
38#define info(f, arg...) printk(KERN_INFO LOG_PREFIX": " f "\n" , ## arg)
39#undef warn
40#define warn(f, arg...) printk(KERN_WARNING LOG_PREFIX": " f "\n" , ## arg)
41
42struct rtl2832_priv { 27struct rtl2832_priv {
43 struct i2c_adapter *i2c; 28 struct i2c_adapter *i2c;
44 struct dvb_frontend fe; 29 struct dvb_frontend fe;