diff options
author | Antti Palosaari <crope@iki.fi> | 2012-09-12 19:23:42 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-09-23 19:09:51 -0400 |
commit | 0a73f2d61cba0b58ff3639a8c0ce2c7950347584 (patch) | |
tree | 4b5cf46f0a27620439f7ec3909fc45e310926ca4 | |
parent | 6a60e3f653a76bd0771216b3225b82861fa8dfd1 (diff) |
[media] af9033: use Kernel dev_foo() logging
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/dvb-frontends/af9033.c | 83 | ||||
-rw-r--r-- | drivers/media/dvb-frontends/af9033.h | 2 |
2 files changed, 44 insertions, 41 deletions
diff --git a/drivers/media/dvb-frontends/af9033.c b/drivers/media/dvb-frontends/af9033.c index a38998286260..0979ada2a20a 100644 --- a/drivers/media/dvb-frontends/af9033.c +++ b/drivers/media/dvb-frontends/af9033.c | |||
@@ -59,8 +59,8 @@ static int af9033_wr_regs(struct af9033_state *state, u32 reg, const u8 *val, | |||
59 | if (ret == 1) { | 59 | if (ret == 1) { |
60 | ret = 0; | 60 | ret = 0; |
61 | } else { | 61 | } else { |
62 | printk(KERN_WARNING "%s: i2c wr failed=%d reg=%06x len=%d\n", | 62 | dev_warn(&state->i2c->dev, "%s: i2c wr failed=%d reg=%06x " \ |
63 | __func__, ret, reg, len); | 63 | "len=%d\n", KBUILD_MODNAME, ret, reg, len); |
64 | ret = -EREMOTEIO; | 64 | ret = -EREMOTEIO; |
65 | } | 65 | } |
66 | 66 | ||
@@ -91,8 +91,8 @@ static int af9033_rd_regs(struct af9033_state *state, u32 reg, u8 *val, int len) | |||
91 | if (ret == 2) { | 91 | if (ret == 2) { |
92 | ret = 0; | 92 | ret = 0; |
93 | } else { | 93 | } else { |
94 | printk(KERN_WARNING "%s: i2c rd failed=%d reg=%06x len=%d\n", | 94 | dev_warn(&state->i2c->dev, "%s: i2c rd failed=%d reg=%06x " \ |
95 | __func__, ret, reg, len); | 95 | "len=%d\n", KBUILD_MODNAME, ret, reg, len); |
96 | ret = -EREMOTEIO; | 96 | ret = -EREMOTEIO; |
97 | } | 97 | } |
98 | 98 | ||
@@ -156,11 +156,11 @@ static int af9033_rd_reg_mask(struct af9033_state *state, u32 reg, u8 *val, | |||
156 | return 0; | 156 | return 0; |
157 | } | 157 | } |
158 | 158 | ||
159 | static u32 af9033_div(u32 a, u32 b, u32 x) | 159 | static u32 af9033_div(struct af9033_state *state, u32 a, u32 b, u32 x) |
160 | { | 160 | { |
161 | u32 r = 0, c = 0, i; | 161 | u32 r = 0, c = 0, i; |
162 | 162 | ||
163 | pr_debug("%s: a=%d b=%d x=%d\n", __func__, a, b, x); | 163 | dev_dbg(&state->i2c->dev, "%s: a=%d b=%d x=%d\n", __func__, a, b, x); |
164 | 164 | ||
165 | if (a > b) { | 165 | if (a > b) { |
166 | c = a / b; | 166 | c = a / b; |
@@ -177,7 +177,8 @@ static u32 af9033_div(u32 a, u32 b, u32 x) | |||
177 | } | 177 | } |
178 | r = (c << (u32)x) + r; | 178 | r = (c << (u32)x) + r; |
179 | 179 | ||
180 | pr_debug("%s: a=%d b=%d x=%d r=%d r=%x\n", __func__, a, b, x, r, r); | 180 | dev_dbg(&state->i2c->dev, "%s: a=%d b=%d x=%d r=%d r=%x\n", |
181 | __func__, a, b, x, r, r); | ||
181 | 182 | ||
182 | return r; | 183 | return r; |
183 | } | 184 | } |
@@ -225,14 +226,14 @@ static int af9033_init(struct dvb_frontend *fe) | |||
225 | }; | 226 | }; |
226 | 227 | ||
227 | /* program clock control */ | 228 | /* program clock control */ |
228 | clock_cw = af9033_div(state->cfg.clock, 1000000ul, 19ul); | 229 | clock_cw = af9033_div(state, state->cfg.clock, 1000000ul, 19ul); |
229 | buf[0] = (clock_cw >> 0) & 0xff; | 230 | buf[0] = (clock_cw >> 0) & 0xff; |
230 | buf[1] = (clock_cw >> 8) & 0xff; | 231 | buf[1] = (clock_cw >> 8) & 0xff; |
231 | buf[2] = (clock_cw >> 16) & 0xff; | 232 | buf[2] = (clock_cw >> 16) & 0xff; |
232 | buf[3] = (clock_cw >> 24) & 0xff; | 233 | buf[3] = (clock_cw >> 24) & 0xff; |
233 | 234 | ||
234 | pr_debug("%s: clock=%d clock_cw=%08x\n", __func__, state->cfg.clock, | 235 | dev_dbg(&state->i2c->dev, "%s: clock=%d clock_cw=%08x\n", |
235 | clock_cw); | 236 | __func__, state->cfg.clock, clock_cw); |
236 | 237 | ||
237 | ret = af9033_wr_regs(state, 0x800025, buf, 4); | 238 | ret = af9033_wr_regs(state, 0x800025, buf, 4); |
238 | if (ret < 0) | 239 | if (ret < 0) |
@@ -244,13 +245,13 @@ static int af9033_init(struct dvb_frontend *fe) | |||
244 | break; | 245 | break; |
245 | } | 246 | } |
246 | 247 | ||
247 | adc_cw = af9033_div(clock_adc_lut[i].adc, 1000000ul, 19ul); | 248 | adc_cw = af9033_div(state, clock_adc_lut[i].adc, 1000000ul, 19ul); |
248 | buf[0] = (adc_cw >> 0) & 0xff; | 249 | buf[0] = (adc_cw >> 0) & 0xff; |
249 | buf[1] = (adc_cw >> 8) & 0xff; | 250 | buf[1] = (adc_cw >> 8) & 0xff; |
250 | buf[2] = (adc_cw >> 16) & 0xff; | 251 | buf[2] = (adc_cw >> 16) & 0xff; |
251 | 252 | ||
252 | pr_debug("%s: adc=%d adc_cw=%06x\n", __func__, clock_adc_lut[i].adc, | 253 | dev_dbg(&state->i2c->dev, "%s: adc=%d adc_cw=%06x\n", |
253 | adc_cw); | 254 | __func__, clock_adc_lut[i].adc, adc_cw); |
254 | 255 | ||
255 | ret = af9033_wr_regs(state, 0x80f1cd, buf, 3); | 256 | ret = af9033_wr_regs(state, 0x80f1cd, buf, 3); |
256 | if (ret < 0) | 257 | if (ret < 0) |
@@ -284,7 +285,7 @@ static int af9033_init(struct dvb_frontend *fe) | |||
284 | } | 285 | } |
285 | 286 | ||
286 | /* load OFSM settings */ | 287 | /* load OFSM settings */ |
287 | pr_debug("%s: load ofsm settings\n", __func__); | 288 | dev_dbg(&state->i2c->dev, "%s: load ofsm settings\n", __func__); |
288 | len = ARRAY_SIZE(ofsm_init); | 289 | len = ARRAY_SIZE(ofsm_init); |
289 | init = ofsm_init; | 290 | init = ofsm_init; |
290 | for (i = 0; i < len; i++) { | 291 | for (i = 0; i < len; i++) { |
@@ -294,7 +295,7 @@ static int af9033_init(struct dvb_frontend *fe) | |||
294 | } | 295 | } |
295 | 296 | ||
296 | /* load tuner specific settings */ | 297 | /* load tuner specific settings */ |
297 | pr_debug("%s: load tuner specific settings\n", | 298 | dev_dbg(&state->i2c->dev, "%s: load tuner specific settings\n", |
298 | __func__); | 299 | __func__); |
299 | switch (state->cfg.tuner) { | 300 | switch (state->cfg.tuner) { |
300 | case AF9033_TUNER_TUA9001: | 301 | case AF9033_TUNER_TUA9001: |
@@ -314,8 +315,8 @@ static int af9033_init(struct dvb_frontend *fe) | |||
314 | init = tuner_init_tda18218; | 315 | init = tuner_init_tda18218; |
315 | break; | 316 | break; |
316 | default: | 317 | default: |
317 | pr_debug("%s: unsupported tuner ID=%d\n", __func__, | 318 | dev_dbg(&state->i2c->dev, "%s: unsupported tuner ID=%d\n", |
318 | state->cfg.tuner); | 319 | __func__, state->cfg.tuner); |
319 | ret = -ENODEV; | 320 | ret = -ENODEV; |
320 | goto err; | 321 | goto err; |
321 | } | 322 | } |
@@ -331,7 +332,7 @@ static int af9033_init(struct dvb_frontend *fe) | |||
331 | return 0; | 332 | return 0; |
332 | 333 | ||
333 | err: | 334 | err: |
334 | pr_debug("%s: failed=%d\n", __func__, ret); | 335 | dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); |
335 | 336 | ||
336 | return ret; | 337 | return ret; |
337 | } | 338 | } |
@@ -358,7 +359,7 @@ static int af9033_sleep(struct dvb_frontend *fe) | |||
358 | usleep_range(200, 10000); | 359 | usleep_range(200, 10000); |
359 | } | 360 | } |
360 | 361 | ||
361 | pr_debug("%s: loop=%d\n", __func__, i); | 362 | dev_dbg(&state->i2c->dev, "%s: loop=%d\n", __func__, i); |
362 | 363 | ||
363 | if (i == 0) { | 364 | if (i == 0) { |
364 | ret = -ETIMEDOUT; | 365 | ret = -ETIMEDOUT; |
@@ -384,7 +385,7 @@ static int af9033_sleep(struct dvb_frontend *fe) | |||
384 | return 0; | 385 | return 0; |
385 | 386 | ||
386 | err: | 387 | err: |
387 | pr_debug("%s: failed=%d\n", __func__, ret); | 388 | dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); |
388 | 389 | ||
389 | return ret; | 390 | return ret; |
390 | } | 391 | } |
@@ -407,8 +408,8 @@ static int af9033_set_frontend(struct dvb_frontend *fe) | |||
407 | u8 tmp, buf[3], bandwidth_reg_val; | 408 | u8 tmp, buf[3], bandwidth_reg_val; |
408 | u32 if_frequency, freq_cw, adc_freq; | 409 | u32 if_frequency, freq_cw, adc_freq; |
409 | 410 | ||
410 | pr_debug("%s: frequency=%d bandwidth_hz=%d\n", __func__, c->frequency, | 411 | dev_dbg(&state->i2c->dev, "%s: frequency=%d bandwidth_hz=%d\n", |
411 | c->bandwidth_hz); | 412 | __func__, c->frequency, c->bandwidth_hz); |
412 | 413 | ||
413 | /* check bandwidth */ | 414 | /* check bandwidth */ |
414 | switch (c->bandwidth_hz) { | 415 | switch (c->bandwidth_hz) { |
@@ -422,7 +423,8 @@ static int af9033_set_frontend(struct dvb_frontend *fe) | |||
422 | bandwidth_reg_val = 0x02; | 423 | bandwidth_reg_val = 0x02; |
423 | break; | 424 | break; |
424 | default: | 425 | default: |
425 | pr_debug("%s: invalid bandwidth_hz\n", __func__); | 426 | dev_dbg(&state->i2c->dev, "%s: invalid bandwidth_hz\n", |
427 | __func__); | ||
426 | ret = -EINVAL; | 428 | ret = -EINVAL; |
427 | goto err; | 429 | goto err; |
428 | } | 430 | } |
@@ -467,7 +469,7 @@ static int af9033_set_frontend(struct dvb_frontend *fe) | |||
467 | else | 469 | else |
468 | if_frequency *= -1; | 470 | if_frequency *= -1; |
469 | 471 | ||
470 | freq_cw = af9033_div(if_frequency, adc_freq, 23ul); | 472 | freq_cw = af9033_div(state, if_frequency, adc_freq, 23ul); |
471 | 473 | ||
472 | if (spec_inv == -1) | 474 | if (spec_inv == -1) |
473 | freq_cw *= -1; | 475 | freq_cw *= -1; |
@@ -522,7 +524,7 @@ static int af9033_set_frontend(struct dvb_frontend *fe) | |||
522 | return 0; | 524 | return 0; |
523 | 525 | ||
524 | err: | 526 | err: |
525 | pr_debug("%s: failed=%d\n", __func__, ret); | 527 | dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); |
526 | 528 | ||
527 | return ret; | 529 | return ret; |
528 | } | 530 | } |
@@ -534,7 +536,7 @@ static int af9033_get_frontend(struct dvb_frontend *fe) | |||
534 | int ret; | 536 | int ret; |
535 | u8 buf[8]; | 537 | u8 buf[8]; |
536 | 538 | ||
537 | pr_debug("%s\n", __func__); | 539 | dev_dbg(&state->i2c->dev, "%s:\n", __func__); |
538 | 540 | ||
539 | /* read all needed registers */ | 541 | /* read all needed registers */ |
540 | ret = af9033_rd_regs(state, 0x80f900, buf, sizeof(buf)); | 542 | ret = af9033_rd_regs(state, 0x80f900, buf, sizeof(buf)); |
@@ -649,7 +651,7 @@ static int af9033_get_frontend(struct dvb_frontend *fe) | |||
649 | return 0; | 651 | return 0; |
650 | 652 | ||
651 | err: | 653 | err: |
652 | pr_debug("%s: failed=%d\n", __func__, ret); | 654 | dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); |
653 | 655 | ||
654 | return ret; | 656 | return ret; |
655 | } | 657 | } |
@@ -695,7 +697,7 @@ static int af9033_read_status(struct dvb_frontend *fe, fe_status_t *status) | |||
695 | return 0; | 697 | return 0; |
696 | 698 | ||
697 | err: | 699 | err: |
698 | pr_debug("%s: failed=%d\n", __func__, ret); | 700 | dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); |
699 | 701 | ||
700 | return ret; | 702 | return ret; |
701 | } | 703 | } |
@@ -749,7 +751,7 @@ static int af9033_read_snr(struct dvb_frontend *fe, u16 *snr) | |||
749 | return 0; | 751 | return 0; |
750 | 752 | ||
751 | err: | 753 | err: |
752 | pr_debug("%s: failed=%d\n", __func__, ret); | 754 | dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); |
753 | 755 | ||
754 | return ret; | 756 | return ret; |
755 | } | 757 | } |
@@ -771,7 +773,7 @@ static int af9033_read_signal_strength(struct dvb_frontend *fe, u16 *strength) | |||
771 | return 0; | 773 | return 0; |
772 | 774 | ||
773 | err: | 775 | err: |
774 | pr_debug("%s: failed=%d\n", __func__, ret); | 776 | dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); |
775 | 777 | ||
776 | return ret; | 778 | return ret; |
777 | } | 779 | } |
@@ -815,7 +817,8 @@ static int af9033_update_ch_stat(struct af9033_state *state) | |||
815 | 817 | ||
816 | return 0; | 818 | return 0; |
817 | err: | 819 | err: |
818 | pr_debug("%s: failed=%d\n", __func__, ret); | 820 | dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); |
821 | |||
819 | return ret; | 822 | return ret; |
820 | } | 823 | } |
821 | 824 | ||
@@ -852,7 +855,7 @@ static int af9033_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) | |||
852 | struct af9033_state *state = fe->demodulator_priv; | 855 | struct af9033_state *state = fe->demodulator_priv; |
853 | int ret; | 856 | int ret; |
854 | 857 | ||
855 | pr_debug("%s: enable=%d\n", __func__, enable); | 858 | dev_dbg(&state->i2c->dev, "%s: enable=%d\n", __func__, enable); |
856 | 859 | ||
857 | ret = af9033_wr_reg_mask(state, 0x00fa04, enable, 0x01); | 860 | ret = af9033_wr_reg_mask(state, 0x00fa04, enable, 0x01); |
858 | if (ret < 0) | 861 | if (ret < 0) |
@@ -861,7 +864,7 @@ static int af9033_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) | |||
861 | return 0; | 864 | return 0; |
862 | 865 | ||
863 | err: | 866 | err: |
864 | pr_debug("%s: failed=%d\n", __func__, ret); | 867 | dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); |
865 | 868 | ||
866 | return ret; | 869 | return ret; |
867 | } | 870 | } |
@@ -875,7 +878,7 @@ struct dvb_frontend *af9033_attach(const struct af9033_config *config, | |||
875 | struct af9033_state *state; | 878 | struct af9033_state *state; |
876 | u8 buf[8]; | 879 | u8 buf[8]; |
877 | 880 | ||
878 | pr_debug("%s:\n", __func__); | 881 | dev_dbg(&i2c->dev, "%s:\n", __func__); |
879 | 882 | ||
880 | /* allocate memory for the internal state */ | 883 | /* allocate memory for the internal state */ |
881 | state = kzalloc(sizeof(struct af9033_state), GFP_KERNEL); | 884 | state = kzalloc(sizeof(struct af9033_state), GFP_KERNEL); |
@@ -887,9 +890,9 @@ struct dvb_frontend *af9033_attach(const struct af9033_config *config, | |||
887 | memcpy(&state->cfg, config, sizeof(struct af9033_config)); | 890 | memcpy(&state->cfg, config, sizeof(struct af9033_config)); |
888 | 891 | ||
889 | if (state->cfg.clock != 12000000) { | 892 | if (state->cfg.clock != 12000000) { |
890 | printk(KERN_INFO "af9033: unsupported clock=%d, only " \ | 893 | dev_err(&state->i2c->dev, "%s: af9033: unsupported clock=%d, " \ |
891 | "12000000 Hz is supported currently\n", | 894 | "only 12000000 Hz is supported currently\n", |
892 | state->cfg.clock); | 895 | KBUILD_MODNAME, state->cfg.clock); |
893 | goto err; | 896 | goto err; |
894 | } | 897 | } |
895 | 898 | ||
@@ -902,9 +905,9 @@ struct dvb_frontend *af9033_attach(const struct af9033_config *config, | |||
902 | if (ret < 0) | 905 | if (ret < 0) |
903 | goto err; | 906 | goto err; |
904 | 907 | ||
905 | printk(KERN_INFO "af9033: firmware version: LINK=%d.%d.%d.%d " \ | 908 | dev_info(&state->i2c->dev, "%s: firmware version: LINK=%d.%d.%d.%d " \ |
906 | "OFDM=%d.%d.%d.%d\n", buf[0], buf[1], buf[2], buf[3], | 909 | "OFDM=%d.%d.%d.%d\n", KBUILD_MODNAME, buf[0], buf[1], |
907 | buf[4], buf[5], buf[6], buf[7]); | 910 | buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]); |
908 | 911 | ||
909 | /* configure internal TS mode */ | 912 | /* configure internal TS mode */ |
910 | switch (state->cfg.ts_mode) { | 913 | switch (state->cfg.ts_mode) { |
diff --git a/drivers/media/dvb-frontends/af9033.h b/drivers/media/dvb-frontends/af9033.h index 9e302c3f0f7d..288622b54e8b 100644 --- a/drivers/media/dvb-frontends/af9033.h +++ b/drivers/media/dvb-frontends/af9033.h | |||
@@ -67,7 +67,7 @@ extern struct dvb_frontend *af9033_attach(const struct af9033_config *config, | |||
67 | static inline struct dvb_frontend *af9033_attach( | 67 | static inline struct dvb_frontend *af9033_attach( |
68 | const struct af9033_config *config, struct i2c_adapter *i2c) | 68 | const struct af9033_config *config, struct i2c_adapter *i2c) |
69 | { | 69 | { |
70 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); | 70 | pr_warn("%s: driver disabled by Kconfig\n", __func__); |
71 | return NULL; | 71 | return NULL; |
72 | } | 72 | } |
73 | #endif | 73 | #endif |