V4L/DVB (13112): tda18271: display some state information in debug output
authorMichael Krufky <mkrufky@kernellabs.com>
Mon, 28 Sep 2009 06:13:49 +0000 (03:13 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 5 Dec 2009 20:40:24 +0000 (18:40 -0200)
Display i2c adapter id, address and master / slave role in debug output.

Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/common/tuners/tda18271-maps.c
drivers/media/common/tuners/tda18271-priv.h

index e21fdeff3ddf907ec02796bbcc0c05fc7dd403ff..e7f84c705da867f32ff7a3f663897b49c293c400 100644 (file)
@@ -978,6 +978,7 @@ static struct tda18271_cid_target_map tda18271_cid_target[] = {
 int tda18271_lookup_cid_target(struct dvb_frontend *fe,
                               u32 *freq, u8 *cid_target, u16 *count_limit)
 {
+       struct tda18271_priv *priv = fe->tuner_priv;
        int i = 0;
 
        while ((tda18271_cid_target[i].rfmax * 1000) < *freq) {
index 74075be4dea3efe6b3a03d84d4f2597ba08d68bf..7047680cdbd14c98ddcfd1a3774b9c404353621d 100644 (file)
@@ -136,27 +136,37 @@ extern int tda18271_debug;
 #define DBG_ADV  8
 #define DBG_CAL  16
 
-#define tda_printk(kern, fmt, arg...) \
-       printk(kern "%s: " fmt, __func__, ##arg)
-
-#define tda_dprintk(lvl, fmt, arg...) do {\
+#define tda_printk(st, kern, fmt, arg...) do {\
+       if (st) { \
+               struct tda18271_priv *state = st; \
+               printk(kern "%s: [%d-%04x|%s] " fmt, __func__, \
+                       i2c_adapter_id(state->i2c_props.adap), \
+                       state->i2c_props.addr, \
+                       (state->role == TDA18271_MASTER) \
+                       ? "M" : "S", ##arg); \
+       } else \
+               printk(kern "%s: " fmt, __func__, ##arg); \
+} while (0)
+
+#define tda_dprintk(st, lvl, fmt, arg...) do {\
        if (tda18271_debug & lvl) \
-               tda_printk(KERN_DEBUG, fmt, ##arg); } while (0)
+               tda_printk(st, KERN_DEBUG, fmt, ##arg); } while (0)
 
 #define tda_info(fmt, arg...)     printk(KERN_INFO     fmt, ##arg)
-#define tda_warn(fmt, arg...) tda_printk(KERN_WARNING, fmt, ##arg)
-#define tda_err(fmt, arg...)  tda_printk(KERN_ERR,     fmt, ##arg)
-#define tda_dbg(fmt, arg...)  tda_dprintk(DBG_INFO,    fmt, ##arg)
-#define tda_map(fmt, arg...)  tda_dprintk(DBG_MAP,     fmt, ##arg)
-#define tda_reg(fmt, arg...)  tda_dprintk(DBG_REG,     fmt, ##arg)
-#define tda_cal(fmt, arg...)  tda_dprintk(DBG_CAL,     fmt, ##arg)
+#define tda_warn(fmt, arg...) tda_printk(priv, KERN_WARNING, fmt, ##arg)
+#define tda_err(fmt, arg...)  tda_printk(priv, KERN_ERR,     fmt, ##arg)
+#define tda_dbg(fmt, arg...)  tda_dprintk(priv, DBG_INFO,    fmt, ##arg)
+#define tda_map(fmt, arg...)  tda_dprintk(priv, DBG_MAP,     fmt, ##arg)
+#define tda_reg(fmt, arg...)  tda_dprintk(priv, DBG_REG,     fmt, ##arg)
+#define tda_cal(fmt, arg...)  tda_dprintk(priv, DBG_CAL,     fmt, ##arg)
 
 #define tda_fail(ret)                                                       \
 ({                                                                          \
        int __ret;                                                           \
        __ret = (ret < 0);                                                   \
        if (__ret)                                                           \
-               tda_printk(KERN_ERR, "error %d on line %d\n", ret, __LINE__);\
+               tda_printk(priv, KERN_ERR,                                   \
+                          "error %d on line %d\n", ret, __LINE__);          \
        __ret;                                                               \
 })