Commit 86ad0f1d authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab

[media] rtl2830: use Kernel dev_foo() logging

Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent a44850df
...@@ -27,10 +27,6 @@ ...@@ -27,10 +27,6 @@
#include "rtl2830_priv.h" #include "rtl2830_priv.h"
int rtl2830_debug;
module_param_named(debug, rtl2830_debug, int, 0644);
MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off).");
/* write multiple hardware registers */ /* write multiple hardware registers */
static int rtl2830_wr(struct rtl2830_priv *priv, u8 reg, u8 *val, int len) static int rtl2830_wr(struct rtl2830_priv *priv, u8 reg, u8 *val, int len)
{ {
...@@ -52,7 +48,8 @@ static int rtl2830_wr(struct rtl2830_priv *priv, u8 reg, u8 *val, int len) ...@@ -52,7 +48,8 @@ static int rtl2830_wr(struct rtl2830_priv *priv, u8 reg, u8 *val, int len)
if (ret == 1) { if (ret == 1) {
ret = 0; ret = 0;
} else { } else {
warn("i2c wr failed=%d reg=%02x len=%d", ret, reg, len); dev_warn(&priv->i2c->dev, "%s: i2c wr failed=%d reg=%02x " \
"len=%d\n", KBUILD_MODNAME, ret, reg, len);
ret = -EREMOTEIO; ret = -EREMOTEIO;
} }
return ret; return ret;
...@@ -80,7 +77,8 @@ static int rtl2830_rd(struct rtl2830_priv *priv, u8 reg, u8 *val, int len) ...@@ -80,7 +77,8 @@ static int rtl2830_rd(struct rtl2830_priv *priv, u8 reg, u8 *val, int len)
if (ret == 2) { if (ret == 2) {
ret = 0; ret = 0;
} else { } else {
warn("i2c rd failed=%d reg=%02x len=%d", ret, reg, len); dev_warn(&priv->i2c->dev, "%s: i2c rd failed=%d reg=%02x " \
"len=%d\n", KBUILD_MODNAME, ret, reg, len);
ret = -EREMOTEIO; ret = -EREMOTEIO;
} }
return ret; return ret;
...@@ -247,7 +245,7 @@ static int rtl2830_init(struct dvb_frontend *fe) ...@@ -247,7 +245,7 @@ static int rtl2830_init(struct dvb_frontend *fe)
num = div_u64(num, priv->cfg.xtal); num = div_u64(num, priv->cfg.xtal);
num = -num; num = -num;
if_ctl = num & 0x3fffff; if_ctl = num & 0x3fffff;
dbg("%s: if_ctl=%08x", __func__, if_ctl); dev_dbg(&priv->i2c->dev, "%s: if_ctl=%08x\n", __func__, if_ctl);
ret = rtl2830_rd_reg_mask(priv, 0x119, &tmp, 0xc0); /* b[7:6] */ ret = rtl2830_rd_reg_mask(priv, 0x119, &tmp, 0xc0); /* b[7:6] */
if (ret) if (ret)
...@@ -277,7 +275,7 @@ static int rtl2830_init(struct dvb_frontend *fe) ...@@ -277,7 +275,7 @@ static int rtl2830_init(struct dvb_frontend *fe)
return ret; return ret;
err: err:
dbg("%s: failed=%d", __func__, ret); dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret; return ret;
} }
...@@ -328,8 +326,9 @@ static int rtl2830_set_frontend(struct dvb_frontend *fe) ...@@ -328,8 +326,9 @@ static int rtl2830_set_frontend(struct dvb_frontend *fe)
}; };
dbg("%s: frequency=%d bandwidth_hz=%d inversion=%d", __func__, dev_dbg(&priv->i2c->dev,
c->frequency, c->bandwidth_hz, c->inversion); "%s: frequency=%d bandwidth_hz=%d inversion=%d\n",
__func__, c->frequency, c->bandwidth_hz, c->inversion);
/* program tuner */ /* program tuner */
if (fe->ops.tuner_ops.set_params) if (fe->ops.tuner_ops.set_params)
...@@ -346,7 +345,7 @@ static int rtl2830_set_frontend(struct dvb_frontend *fe) ...@@ -346,7 +345,7 @@ static int rtl2830_set_frontend(struct dvb_frontend *fe)
i = 2; i = 2;
break; break;
default: default:
dbg("invalid bandwidth"); dev_dbg(&priv->i2c->dev, "%s: invalid bandwidth\n", __func__);
return -EINVAL; return -EINVAL;
} }
...@@ -370,7 +369,7 @@ static int rtl2830_set_frontend(struct dvb_frontend *fe) ...@@ -370,7 +369,7 @@ static int rtl2830_set_frontend(struct dvb_frontend *fe)
return ret; return ret;
err: err:
dbg("%s: failed=%d", __func__, ret); dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret; return ret;
} }
...@@ -392,7 +391,7 @@ static int rtl2830_get_frontend(struct dvb_frontend *fe) ...@@ -392,7 +391,7 @@ static int rtl2830_get_frontend(struct dvb_frontend *fe)
if (ret) if (ret)
goto err; goto err;
dbg("%s: TPS=%*ph", __func__, 3, buf); dev_dbg(&priv->i2c->dev, "%s: TPS=%*ph\n", __func__, 3, buf);
switch ((buf[0] >> 2) & 3) { switch ((buf[0] >> 2) & 3) {
case 0: case 0:
...@@ -482,7 +481,7 @@ static int rtl2830_get_frontend(struct dvb_frontend *fe) ...@@ -482,7 +481,7 @@ static int rtl2830_get_frontend(struct dvb_frontend *fe)
return 0; return 0;
err: err:
dbg("%s: failed=%d", __func__, ret); dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret; return ret;
} }
...@@ -510,7 +509,7 @@ static int rtl2830_read_status(struct dvb_frontend *fe, fe_status_t *status) ...@@ -510,7 +509,7 @@ static int rtl2830_read_status(struct dvb_frontend *fe, fe_status_t *status)
return ret; return ret;
err: err:
dbg("%s: failed=%d", __func__, ret); dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret; return ret;
} }
...@@ -559,7 +558,7 @@ static int rtl2830_read_snr(struct dvb_frontend *fe, u16 *snr) ...@@ -559,7 +558,7 @@ static int rtl2830_read_snr(struct dvb_frontend *fe, u16 *snr)
return 0; return 0;
err: err:
dbg("%s: failed=%d", __func__, ret); dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret; return ret;
} }
...@@ -580,7 +579,7 @@ static int rtl2830_read_ber(struct dvb_frontend *fe, u32 *ber) ...@@ -580,7 +579,7 @@ static int rtl2830_read_ber(struct dvb_frontend *fe, u32 *ber)
return 0; return 0;
err: err:
dbg("%s: failed=%d", __func__, ret); dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret; return ret;
} }
...@@ -616,7 +615,7 @@ static int rtl2830_read_signal_strength(struct dvb_frontend *fe, u16 *strength) ...@@ -616,7 +615,7 @@ static int rtl2830_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
return 0; return 0;
err: err:
dbg("%s: failed=%d", __func__, ret); dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret; return ret;
} }
...@@ -640,11 +639,12 @@ static int rtl2830_tuner_i2c_xfer(struct i2c_adapter *i2c_adap, ...@@ -640,11 +639,12 @@ static int rtl2830_tuner_i2c_xfer(struct i2c_adapter *i2c_adap,
ret = i2c_transfer(priv->i2c, msg, num); ret = i2c_transfer(priv->i2c, msg, num);
if (ret < 0) if (ret < 0)
warn("tuner i2c failed=%d", ret); dev_warn(&priv->i2c->dev, "%s: tuner i2c failed=%d\n",
KBUILD_MODNAME, ret);
return ret; return ret;
err: err:
dbg("%s: failed=%d", __func__, ret); dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret; return ret;
} }
...@@ -700,7 +700,9 @@ struct dvb_frontend *rtl2830_attach(const struct rtl2830_config *cfg, ...@@ -700,7 +700,9 @@ struct dvb_frontend *rtl2830_attach(const struct rtl2830_config *cfg,
priv->tuner_i2c_adapter.algo_data = NULL; priv->tuner_i2c_adapter.algo_data = NULL;
i2c_set_adapdata(&priv->tuner_i2c_adapter, priv); i2c_set_adapdata(&priv->tuner_i2c_adapter, priv);
if (i2c_add_adapter(&priv->tuner_i2c_adapter) < 0) { if (i2c_add_adapter(&priv->tuner_i2c_adapter) < 0) {
err("tuner I2C bus could not be initialized"); dev_err(&i2c->dev,
"%s: tuner i2c bus could not be initialized\n",
KBUILD_MODNAME);
goto err; goto err;
} }
...@@ -708,7 +710,7 @@ struct dvb_frontend *rtl2830_attach(const struct rtl2830_config *cfg, ...@@ -708,7 +710,7 @@ struct dvb_frontend *rtl2830_attach(const struct rtl2830_config *cfg,
return &priv->fe; return &priv->fe;
err: err:
dbg("%s: failed=%d", __func__, ret); dev_dbg(&i2c->dev, "%s: failed=%d\n", __func__, ret);
kfree(priv); kfree(priv);
return NULL; return NULL;
} }
......
...@@ -82,7 +82,7 @@ static inline struct dvb_frontend *rtl2830_attach( ...@@ -82,7 +82,7 @@ static inline struct dvb_frontend *rtl2830_attach(
struct i2c_adapter *i2c struct i2c_adapter *i2c
) )
{ {
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); pr_warn("%s: driver disabled by Kconfig\n", __func__);
return NULL; return NULL;
} }
......
...@@ -25,19 +25,6 @@ ...@@ -25,19 +25,6 @@
#include "dvb_math.h" #include "dvb_math.h"
#include "rtl2830.h" #include "rtl2830.h"
#define LOG_PREFIX "rtl2830"
#undef dbg
#define dbg(f, arg...) \
if (rtl2830_debug) \
printk(KERN_INFO LOG_PREFIX": " f "\n" , ## arg)
#undef err
#define err(f, arg...) printk(KERN_ERR LOG_PREFIX": " f "\n" , ## arg)
#undef info
#define info(f, arg...) printk(KERN_INFO LOG_PREFIX": " f "\n" , ## arg)
#undef warn
#define warn(f, arg...) printk(KERN_WARNING LOG_PREFIX": " f "\n" , ## arg)
struct rtl2830_priv { struct rtl2830_priv {
struct i2c_adapter *i2c; struct i2c_adapter *i2c;
struct dvb_frontend fe; struct dvb_frontend fe;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment