aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2007-12-25 15:10:11 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 19:04:25 -0200
commit182519f4c99f73f376323580dda494d986b4760b (patch)
tree1104af036e85295101407e0b309cae1f36bd663b /drivers/media/dvb
parent2f27dfc98cc0a183be9e3c2fc0da0450b85e5fde (diff)
V4L/DVB (6927): tda18271: improve printk macros
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/frontends/tda18271-fe.c58
-rw-r--r--drivers/media/dvb/frontends/tda18271-priv.h20
-rw-r--r--drivers/media/dvb/frontends/tda18271-tables.c8
3 files changed, 44 insertions, 42 deletions
diff --git a/drivers/media/dvb/frontends/tda18271-fe.c b/drivers/media/dvb/frontends/tda18271-fe.c
index 72e256ebeb0..8146c4e7ee7 100644
--- a/drivers/media/dvb/frontends/tda18271-fe.c
+++ b/drivers/media/dvb/frontends/tda18271-fe.c
@@ -76,23 +76,23 @@ static void tda18271_dump_regs(struct dvb_frontend *fe)
struct tda18271_priv *priv = fe->tuner_priv;
unsigned char *regs = priv->tda18271_regs;
- dbg_reg("=== TDA18271 REG DUMP ===\n");
- dbg_reg("ID_BYTE = 0x%02x\n", 0xff & regs[R_ID]);
- dbg_reg("THERMO_BYTE = 0x%02x\n", 0xff & regs[R_TM]);
- dbg_reg("POWER_LEVEL_BYTE = 0x%02x\n", 0xff & regs[R_PL]);
- dbg_reg("EASY_PROG_BYTE_1 = 0x%02x\n", 0xff & regs[R_EP1]);
- dbg_reg("EASY_PROG_BYTE_2 = 0x%02x\n", 0xff & regs[R_EP2]);
- dbg_reg("EASY_PROG_BYTE_3 = 0x%02x\n", 0xff & regs[R_EP3]);
- dbg_reg("EASY_PROG_BYTE_4 = 0x%02x\n", 0xff & regs[R_EP4]);
- dbg_reg("EASY_PROG_BYTE_5 = 0x%02x\n", 0xff & regs[R_EP5]);
- dbg_reg("CAL_POST_DIV_BYTE = 0x%02x\n", 0xff & regs[R_CPD]);
- dbg_reg("CAL_DIV_BYTE_1 = 0x%02x\n", 0xff & regs[R_CD1]);
- dbg_reg("CAL_DIV_BYTE_2 = 0x%02x\n", 0xff & regs[R_CD2]);
- dbg_reg("CAL_DIV_BYTE_3 = 0x%02x\n", 0xff & regs[R_CD3]);
- dbg_reg("MAIN_POST_DIV_BYTE = 0x%02x\n", 0xff & regs[R_MPD]);
- dbg_reg("MAIN_DIV_BYTE_1 = 0x%02x\n", 0xff & regs[R_MD1]);
- dbg_reg("MAIN_DIV_BYTE_2 = 0x%02x\n", 0xff & regs[R_MD2]);
- dbg_reg("MAIN_DIV_BYTE_3 = 0x%02x\n", 0xff & regs[R_MD3]);
+ tda_reg("=== TDA18271 REG DUMP ===\n");
+ tda_reg("ID_BYTE = 0x%02x\n", 0xff & regs[R_ID]);
+ tda_reg("THERMO_BYTE = 0x%02x\n", 0xff & regs[R_TM]);
+ tda_reg("POWER_LEVEL_BYTE = 0x%02x\n", 0xff & regs[R_PL]);
+ tda_reg("EASY_PROG_BYTE_1 = 0x%02x\n", 0xff & regs[R_EP1]);
+ tda_reg("EASY_PROG_BYTE_2 = 0x%02x\n", 0xff & regs[R_EP2]);
+ tda_reg("EASY_PROG_BYTE_3 = 0x%02x\n", 0xff & regs[R_EP3]);
+ tda_reg("EASY_PROG_BYTE_4 = 0x%02x\n", 0xff & regs[R_EP4]);
+ tda_reg("EASY_PROG_BYTE_5 = 0x%02x\n", 0xff & regs[R_EP5]);
+ tda_reg("CAL_POST_DIV_BYTE = 0x%02x\n", 0xff & regs[R_CPD]);
+ tda_reg("CAL_DIV_BYTE_1 = 0x%02x\n", 0xff & regs[R_CD1]);
+ tda_reg("CAL_DIV_BYTE_2 = 0x%02x\n", 0xff & regs[R_CD2]);
+ tda_reg("CAL_DIV_BYTE_3 = 0x%02x\n", 0xff & regs[R_CD3]);
+ tda_reg("MAIN_POST_DIV_BYTE = 0x%02x\n", 0xff & regs[R_MPD]);
+ tda_reg("MAIN_DIV_BYTE_1 = 0x%02x\n", 0xff & regs[R_MD1]);
+ tda_reg("MAIN_DIV_BYTE_2 = 0x%02x\n", 0xff & regs[R_MD2]);
+ tda_reg("MAIN_DIV_BYTE_3 = 0x%02x\n", 0xff & regs[R_MD3]);
}
static void tda18271_read_regs(struct dvb_frontend *fe)
@@ -116,8 +116,7 @@ static void tda18271_read_regs(struct dvb_frontend *fe)
tda18271_i2c_gate_ctrl(fe, 0);
if (ret != 2)
- printk("ERROR: %s: i2c_transfer returned: %d\n",
- __FUNCTION__, ret);
+ tda_err("ERROR: i2c_transfer returned: %d\n", ret);
if (tda18271_debug & DBG_REG)
tda18271_dump_regs(fe);
@@ -147,8 +146,7 @@ static void tda18271_write_regs(struct dvb_frontend *fe, int idx, int len)
tda18271_i2c_gate_ctrl(fe, 0);
if (ret != 1)
- printk(KERN_WARNING "ERROR: %s: i2c_transfer returned: %d\n",
- __FUNCTION__, ret);
+ tda_err("ERROR: i2c_transfer returned: %d\n", ret);
}
/*---------------------------------------------------------------------*/
@@ -158,7 +156,8 @@ static int tda18271_init_regs(struct dvb_frontend *fe)
struct tda18271_priv *priv = fe->tuner_priv;
unsigned char *regs = priv->tda18271_regs;
- printk(KERN_INFO "tda18271: initializing registers\n");
+ tda_dbg("initializing registers for device @ %d-%04x\n",
+ i2c_adapter_id(priv->i2c_adap), priv->i2c_addr);
/* initialize registers */
regs[R_ID] = 0x83;
@@ -417,7 +416,7 @@ static int tda18271_tune(struct dvb_frontend *fe,
tda18271_init(fe);
- dbg_info("freq = %d, ifc = %d\n", freq, ifc);
+ tda_dbg("freq = %d, ifc = %d\n", freq, ifc);
/* RF tracking filter calibration */
@@ -602,8 +601,7 @@ static int tda18271_set_params(struct dvb_frontend *fe,
sgIF = 4000000;
break;
default:
- printk(KERN_WARNING "%s: modulation not set!\n",
- __FUNCTION__);
+ tda_warn("modulation not set!\n");
return -EINVAL;
}
#if 0
@@ -629,13 +627,11 @@ static int tda18271_set_params(struct dvb_frontend *fe,
sgIF = 4300000;
break;
default:
- printk(KERN_WARNING "%s: bandwidth not set!\n",
- __FUNCTION__);
+ tda_warn("bandwidth not set!\n");
return -EINVAL;
}
} else {
- printk(KERN_WARNING "%s: modulation type not supported!\n",
- __FUNCTION__);
+ tda_warn("modulation type not supported!\n");
return -EINVAL;
}
@@ -690,7 +686,7 @@ static int tda18271_set_analog_params(struct dvb_frontend *fe,
if (params->mode == V4L2_TUNER_RADIO)
sgIF = 88; /* if frequency is 5.5 MHz */
- dbg_info("setting tda18271 to system %s\n", mode);
+ tda_dbg("setting tda18271 to system %s\n", mode);
return tda18271_tune(fe, sgIF * 62500, params->frequency * 62500,
0, std);
@@ -740,7 +736,7 @@ static int tda18271_get_id(struct dvb_frontend *fe)
break;
}
- dbg_info("%s detected @ %d-%04x%s\n", name,
+ tda_info("%s detected @ %d-%04x%s\n", name,
i2c_adapter_id(priv->i2c_adap), priv->i2c_addr,
(0 == ret) ? "" : ", device not supported.");
diff --git a/drivers/media/dvb/frontends/tda18271-priv.h b/drivers/media/dvb/frontends/tda18271-priv.h
index b08bf08aa88..912b81e0c76 100644
--- a/drivers/media/dvb/frontends/tda18271-priv.h
+++ b/drivers/media/dvb/frontends/tda18271-priv.h
@@ -90,17 +90,23 @@ struct tda18271_priv {
extern int tda18271_debug;
-#define dprintk(level, fmt, arg...) do {\
- if (tda18271_debug & level) \
- printk(KERN_DEBUG "%s: " fmt, __FUNCTION__, ##arg); } while (0)
-
#define DBG_INFO 1
#define DBG_MAP 2
#define DBG_REG 4
-#define dbg_info(fmt, arg...) dprintk(DBG_INFO, fmt, ##arg)
-#define dbg_map(fmt, arg...) dprintk(DBG_MAP, fmt, ##arg)
-#define dbg_reg(fmt, arg...) dprintk(DBG_REG, fmt, ##arg)
+#define tda_printk(kern, fmt, arg...) \
+ printk(kern "%s: " fmt, __FUNCTION__, ##arg)
+
+#define dprintk(kern, lvl, fmt, arg...) do {\
+ if (tda18271_debug & lvl) \
+ tda_printk(kern, 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...) dprintk(KERN_DEBUG, DBG_INFO, fmt, ##arg)
+#define tda_map(fmt, arg...) dprintk(KERN_DEBUG, DBG_MAP, fmt, ##arg)
+#define tda_reg(fmt, arg...) dprintk(KERN_DEBUG, DBG_REG, fmt, ##arg)
/*---------------------------------------------------------------------*/
diff --git a/drivers/media/dvb/frontends/tda18271-tables.c b/drivers/media/dvb/frontends/tda18271-tables.c
index 8990bef0cf7..e10a93bf12c 100644
--- a/drivers/media/dvb/frontends/tda18271-tables.c
+++ b/drivers/media/dvb/frontends/tda18271-tables.c
@@ -290,7 +290,7 @@ int tda18271_lookup_pll_map(enum tda18271_map_type map_type,
}
if (!map) {
- dbg_info("%s map is not set!\n", map_name);
+ tda_warn("%s map is not set!\n", map_name);
return -EINVAL;
}
@@ -302,7 +302,7 @@ int tda18271_lookup_pll_map(enum tda18271_map_type map_type,
*post_div = map[i].pd;
*div = map[i].d;
- dbg_map("%s: post div = 0x%02x, div = 0x%02x\n",
+ tda_map("%s: post div = 0x%02x, div = 0x%02x\n",
map_name, *post_div, *div);
return 0;
@@ -346,7 +346,7 @@ int tda18271_lookup_map(enum tda18271_map_type map_type, u32 *freq, u8 *val)
}
if (!map) {
- dbg_info("%s map is not set!\n", map_name);
+ tda_warn("%s map is not set!\n", map_name);
return -EINVAL;
}
@@ -357,7 +357,7 @@ int tda18271_lookup_map(enum tda18271_map_type map_type, u32 *freq, u8 *val)
}
*val = map[i].val;
- dbg_map("%s: 0x%02x\n", map_name, *val);
+ tda_map("%s: 0x%02x\n", map_name, *val);
return 0;
}