diff options
author | Antti Palosaari <crope@iki.fi> | 2012-08-14 14:56:20 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-08-15 18:03:52 -0400 |
commit | 82026f9673cfa35c74a66e9d7bf1b0e44bb0de3f (patch) | |
tree | 29ece19d3b6a421200cf31e8fc84909457fa09e6 | |
parent | f44e6b4223fdbb2556faa895861098c32b0ba83f (diff) |
[media] anysee: convert Kernel dev_* logging
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/usb/dvb-usb-v2/anysee.c | 58 | ||||
-rw-r--r-- | drivers/media/usb/dvb-usb-v2/anysee.h | 30 |
2 files changed, 30 insertions, 58 deletions
diff --git a/drivers/media/usb/dvb-usb-v2/anysee.c b/drivers/media/usb/dvb-usb-v2/anysee.c index fb3829a73d2d..5aa3ac625124 100644 --- a/drivers/media/usb/dvb-usb-v2/anysee.c +++ b/drivers/media/usb/dvb-usb-v2/anysee.c | |||
@@ -44,12 +44,7 @@ | |||
44 | #include "isl6423.h" | 44 | #include "isl6423.h" |
45 | #include "cxd2820r.h" | 45 | #include "cxd2820r.h" |
46 | 46 | ||
47 | /* debug */ | ||
48 | static int dvb_usb_anysee_debug; | ||
49 | module_param_named(debug, dvb_usb_anysee_debug, int, 0644); | ||
50 | MODULE_PARM_DESC(debug, "set debugging level" DVB_USB_DEBUG_STATUS); | ||
51 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | 47 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
52 | |||
53 | static DEFINE_MUTEX(anysee_usb_mutex); | 48 | static DEFINE_MUTEX(anysee_usb_mutex); |
54 | 49 | ||
55 | static int anysee_ctrl_msg(struct dvb_usb_device *d, u8 *sbuf, u8 slen, | 50 | static int anysee_ctrl_msg(struct dvb_usb_device *d, u8 *sbuf, u8 slen, |
@@ -64,8 +59,7 @@ static int anysee_ctrl_msg(struct dvb_usb_device *d, u8 *sbuf, u8 slen, | |||
64 | 59 | ||
65 | mutex_lock(&anysee_usb_mutex); | 60 | mutex_lock(&anysee_usb_mutex); |
66 | 61 | ||
67 | deb_xfer(">>> "); | 62 | dev_dbg(&d->udev->dev, "%s: >>> %*ph\n", __func__, slen, buf); |
68 | debug_dump(buf, slen, deb_xfer); | ||
69 | 63 | ||
70 | /* We need receive one message more after dvb_usb_generic_rw due | 64 | /* We need receive one message more after dvb_usb_generic_rw due |
71 | to weird transaction flow, which is 1 x send + 2 x receive. */ | 65 | to weird transaction flow, which is 1 x send + 2 x receive. */ |
@@ -92,14 +86,15 @@ static int anysee_ctrl_msg(struct dvb_usb_device *d, u8 *sbuf, u8 slen, | |||
92 | &act_len, 2000); | 86 | &act_len, 2000); |
93 | 87 | ||
94 | if (ret) { | 88 | if (ret) { |
95 | deb_info("%s: recv bulk message failed: %d", | 89 | dev_dbg(&d->udev->dev, "%s: recv bulk message " \ |
96 | __func__, ret); | 90 | "failed=%d\n", __func__, ret); |
97 | } else { | 91 | } else { |
98 | deb_xfer("<<< "); | 92 | dev_dbg(&d->udev->dev, "%s: <<< %*ph\n", __func__, |
99 | debug_dump(buf, rlen, deb_xfer); | 93 | rlen, buf); |
100 | 94 | ||
101 | if (buf[63] != 0x4f) | 95 | if (buf[63] != 0x4f) |
102 | deb_info("%s: cmd failed\n", __func__); | 96 | dev_dbg(&d->udev->dev, "%s: cmd failed\n", |
97 | __func__); | ||
103 | 98 | ||
104 | break; | 99 | break; |
105 | } | 100 | } |
@@ -107,7 +102,8 @@ static int anysee_ctrl_msg(struct dvb_usb_device *d, u8 *sbuf, u8 slen, | |||
107 | 102 | ||
108 | if (ret) { | 103 | if (ret) { |
109 | /* all retries failed, it is fatal */ | 104 | /* all retries failed, it is fatal */ |
110 | err("%s: recv bulk message failed: %d", __func__, ret); | 105 | dev_err(&d->udev->dev, "%s: recv bulk message failed=%d\n", |
106 | KBUILD_MODNAME, ret); | ||
111 | goto error_unlock; | 107 | goto error_unlock; |
112 | } | 108 | } |
113 | 109 | ||
@@ -126,14 +122,14 @@ static int anysee_read_reg(struct dvb_usb_device *d, u16 reg, u8 *val) | |||
126 | u8 buf[] = {CMD_REG_READ, reg >> 8, reg & 0xff, 0x01}; | 122 | u8 buf[] = {CMD_REG_READ, reg >> 8, reg & 0xff, 0x01}; |
127 | int ret; | 123 | int ret; |
128 | ret = anysee_ctrl_msg(d, buf, sizeof(buf), val, 1); | 124 | ret = anysee_ctrl_msg(d, buf, sizeof(buf), val, 1); |
129 | deb_info("%s: reg:%04x val:%02x\n", __func__, reg, *val); | 125 | dev_dbg(&d->udev->dev, "%s: reg=%04x val=%02x\n", __func__, reg, *val); |
130 | return ret; | 126 | return ret; |
131 | } | 127 | } |
132 | 128 | ||
133 | static int anysee_write_reg(struct dvb_usb_device *d, u16 reg, u8 val) | 129 | static int anysee_write_reg(struct dvb_usb_device *d, u16 reg, u8 val) |
134 | { | 130 | { |
135 | u8 buf[] = {CMD_REG_WRITE, reg >> 8, reg & 0xff, 0x01, val}; | 131 | u8 buf[] = {CMD_REG_WRITE, reg >> 8, reg & 0xff, 0x01, val}; |
136 | deb_info("%s: reg:%04x val:%02x\n", __func__, reg, val); | 132 | dev_dbg(&d->udev->dev, "%s: reg=%04x val=%02x\n", __func__, reg, val); |
137 | return anysee_ctrl_msg(d, buf, sizeof(buf), NULL, 0); | 133 | return anysee_ctrl_msg(d, buf, sizeof(buf), NULL, 0); |
138 | } | 134 | } |
139 | 135 | ||
@@ -190,21 +186,22 @@ static int anysee_get_hw_info(struct dvb_usb_device *d, u8 *id) | |||
190 | static int anysee_streaming_ctrl(struct dvb_frontend *fe, int onoff) | 186 | static int anysee_streaming_ctrl(struct dvb_frontend *fe, int onoff) |
191 | { | 187 | { |
192 | u8 buf[] = {CMD_STREAMING_CTRL, (u8)onoff, 0x00}; | 188 | u8 buf[] = {CMD_STREAMING_CTRL, (u8)onoff, 0x00}; |
193 | deb_info("%s: onoff:%02x\n", __func__, onoff); | 189 | dev_dbg(&fe_to_d(fe)->udev->dev, "%s: onoff=%d\n", __func__, onoff); |
194 | return anysee_ctrl_msg(fe_to_d(fe), buf, sizeof(buf), NULL, 0); | 190 | return anysee_ctrl_msg(fe_to_d(fe), buf, sizeof(buf), NULL, 0); |
195 | } | 191 | } |
196 | 192 | ||
197 | static int anysee_led_ctrl(struct dvb_usb_device *d, u8 mode, u8 interval) | 193 | static int anysee_led_ctrl(struct dvb_usb_device *d, u8 mode, u8 interval) |
198 | { | 194 | { |
199 | u8 buf[] = {CMD_LED_AND_IR_CTRL, 0x01, mode, interval}; | 195 | u8 buf[] = {CMD_LED_AND_IR_CTRL, 0x01, mode, interval}; |
200 | deb_info("%s: state:%02x interval:%02x\n", __func__, mode, interval); | 196 | dev_dbg(&d->udev->dev, "%s: state=%d interval=%d\n", __func__, |
197 | mode, interval); | ||
201 | return anysee_ctrl_msg(d, buf, sizeof(buf), NULL, 0); | 198 | return anysee_ctrl_msg(d, buf, sizeof(buf), NULL, 0); |
202 | } | 199 | } |
203 | 200 | ||
204 | static int anysee_ir_ctrl(struct dvb_usb_device *d, u8 onoff) | 201 | static int anysee_ir_ctrl(struct dvb_usb_device *d, u8 onoff) |
205 | { | 202 | { |
206 | u8 buf[] = {CMD_LED_AND_IR_CTRL, 0x02, onoff}; | 203 | u8 buf[] = {CMD_LED_AND_IR_CTRL, 0x02, onoff}; |
207 | deb_info("%s: onoff:%02x\n", __func__, onoff); | 204 | dev_dbg(&d->udev->dev, "%s: onoff=%d\n", __func__, onoff); |
208 | return anysee_ctrl_msg(d, buf, sizeof(buf), NULL, 0); | 205 | return anysee_ctrl_msg(d, buf, sizeof(buf), NULL, 0); |
209 | } | 206 | } |
210 | 207 | ||
@@ -524,9 +521,11 @@ static int anysee_read_config(struct dvb_usb_device *d) | |||
524 | if (ret) | 521 | if (ret) |
525 | goto error; | 522 | goto error; |
526 | 523 | ||
527 | /* Meaning of these info bytes are guessed. */ | 524 | /* |
528 | info("firmware version:%d.%d hardware id:%d", | 525 | * Meaning of these info bytes are guessed. |
529 | hw_info[1], hw_info[2], hw_info[0]); | 526 | */ |
527 | dev_info(&d->udev->dev, "%s: firmware version %d.%d hardware id %d\n", | ||
528 | KBUILD_MODNAME, hw_info[1], hw_info[2], hw_info[0]); | ||
530 | 529 | ||
531 | state->hw = hw_info[0]; | 530 | state->hw = hw_info[0]; |
532 | error: | 531 | error: |
@@ -545,8 +544,7 @@ static int anysee_frontend_ctrl(struct dvb_frontend *fe, int onoff) | |||
545 | struct anysee_state *state = fe_to_priv(fe); | 544 | struct anysee_state *state = fe_to_priv(fe); |
546 | struct dvb_usb_device *d = fe_to_d(fe); | 545 | struct dvb_usb_device *d = fe_to_d(fe); |
547 | int ret; | 546 | int ret; |
548 | 547 | dev_dbg(&d->udev->dev, "%s: fe=%d onoff=%d\n", __func__, fe->id, onoff); | |
549 | deb_info("%s: fe=%d onoff=%d\n", __func__, fe->id, onoff); | ||
550 | 548 | ||
551 | /* no frontend sleep control */ | 549 | /* no frontend sleep control */ |
552 | if (onoff == 0) | 550 | if (onoff == 0) |
@@ -728,7 +726,8 @@ static int anysee_frontend_attach(struct dvb_usb_adapter *adap) | |||
728 | tmp = 0; | 726 | tmp = 0; |
729 | ret = i2c_transfer(&d->i2c_adap, msg, 2); | 727 | ret = i2c_transfer(&d->i2c_adap, msg, 2); |
730 | if (ret == 2 && tmp == 0xc7) | 728 | if (ret == 2 && tmp == 0xc7) |
731 | deb_info("%s: TDA18212 found\n", __func__); | 729 | dev_dbg(&d->udev->dev, "%s: TDA18212 found\n", |
730 | __func__); | ||
732 | else | 731 | else |
733 | tmp = 0; | 732 | tmp = 0; |
734 | 733 | ||
@@ -885,8 +884,10 @@ static int anysee_frontend_attach(struct dvb_usb_adapter *adap) | |||
885 | if (!adap->fe[0]) { | 884 | if (!adap->fe[0]) { |
886 | /* we have no frontend :-( */ | 885 | /* we have no frontend :-( */ |
887 | ret = -ENODEV; | 886 | ret = -ENODEV; |
888 | err("Unsupported Anysee version. " \ | 887 | dev_err(&d->udev->dev, "%s: Unsupported Anysee version. " \ |
889 | "Please report the <linux-media@vger.kernel.org>."); | 888 | "Please report the " \ |
889 | "<linux-media@vger.kernel.org>.\n", | ||
890 | KBUILD_MODNAME); | ||
890 | } | 891 | } |
891 | error: | 892 | error: |
892 | return ret; | 893 | return ret; |
@@ -898,7 +899,7 @@ static int anysee_tuner_attach(struct dvb_usb_adapter *adap) | |||
898 | struct dvb_usb_device *d = adap_to_d(adap); | 899 | struct dvb_usb_device *d = adap_to_d(adap); |
899 | struct dvb_frontend *fe; | 900 | struct dvb_frontend *fe; |
900 | int ret; | 901 | int ret; |
901 | deb_info("%s: adap=%d\n", __func__, adap->id); | 902 | dev_dbg(&d->udev->dev, "%s:\n", __func__); |
902 | 903 | ||
903 | switch (state->hw) { | 904 | switch (state->hw) { |
904 | case ANYSEE_HW_507T: /* 2 */ | 905 | case ANYSEE_HW_507T: /* 2 */ |
@@ -1037,7 +1038,8 @@ static int anysee_rc_query(struct dvb_usb_device *d) | |||
1037 | return ret; | 1038 | return ret; |
1038 | 1039 | ||
1039 | if (ircode[0]) { | 1040 | if (ircode[0]) { |
1040 | deb_rc("%s: key pressed %02x\n", __func__, ircode[1]); | 1041 | dev_dbg(&d->udev->dev, "%s: key pressed %02x\n", __func__, |
1042 | ircode[1]); | ||
1041 | rc_keydown(d->rc_dev, 0x08 << 8 | ircode[1], 0); | 1043 | rc_keydown(d->rc_dev, 0x08 << 8 | ircode[1], 0); |
1042 | } | 1044 | } |
1043 | 1045 | ||
diff --git a/drivers/media/usb/dvb-usb-v2/anysee.h b/drivers/media/usb/dvb-usb-v2/anysee.h index 834dc120f90f..4ab467679a43 100644 --- a/drivers/media/usb/dvb-usb-v2/anysee.h +++ b/drivers/media/usb/dvb-usb-v2/anysee.h | |||
@@ -38,36 +38,6 @@ | |||
38 | #include "dvb_usb.h" | 38 | #include "dvb_usb.h" |
39 | #include "dvb_ca_en50221.h" | 39 | #include "dvb_ca_en50221.h" |
40 | 40 | ||
41 | #ifdef CONFIG_DVB_USB_DEBUG | ||
42 | #define dprintk(var, level, args...) \ | ||
43 | do { if ((var & level)) printk(args); } while (0) | ||
44 | #define debug_dump(b, l, func) {\ | ||
45 | int loop_; \ | ||
46 | for (loop_ = 0; loop_ < l; loop_++) \ | ||
47 | func("%02x ", b[loop_]); \ | ||
48 | func("\n");\ | ||
49 | } | ||
50 | #define DVB_USB_DEBUG_STATUS | ||
51 | #else | ||
52 | #define dprintk(args...) | ||
53 | #define debug_dump(b, l, func) | ||
54 | #define DVB_USB_DEBUG_STATUS " (debugging is not enabled)" | ||
55 | #endif | ||
56 | |||
57 | #define deb_info(args...) dprintk(dvb_usb_anysee_debug, 0x01, args) | ||
58 | #define deb_xfer(args...) dprintk(dvb_usb_anysee_debug, 0x02, args) | ||
59 | #define deb_rc(args...) dprintk(dvb_usb_anysee_debug, 0x04, args) | ||
60 | #define deb_reg(args...) dprintk(dvb_usb_anysee_debug, 0x08, args) | ||
61 | #define deb_i2c(args...) dprintk(dvb_usb_anysee_debug, 0x10, args) | ||
62 | #define deb_fw(args...) dprintk(dvb_usb_anysee_debug, 0x20, args) | ||
63 | |||
64 | #undef err | ||
65 | #define err(format, arg...) printk(KERN_ERR DVB_USB_LOG_PREFIX ": " format "\n" , ## arg) | ||
66 | #undef info | ||
67 | #define info(format, arg...) printk(KERN_INFO DVB_USB_LOG_PREFIX ": " format "\n" , ## arg) | ||
68 | #undef warn | ||
69 | #define warn(format, arg...) printk(KERN_WARNING DVB_USB_LOG_PREFIX ": " format "\n" , ## arg) | ||
70 | |||
71 | enum cmd { | 41 | enum cmd { |
72 | CMD_I2C_READ = 0x33, | 42 | CMD_I2C_READ = 0x33, |
73 | CMD_I2C_WRITE = 0x31, | 43 | CMD_I2C_WRITE = 0x31, |