summaryrefslogtreecommitdiffstats
path: root/drivers/media/tuners
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2012-12-09 12:33:04 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-01-06 09:07:28 -0200
commit3a98477200b44328e50a5c0830f92fd5cdc1ea9b (patch)
tree94e0c29fa74e93e15deb9e51b4772cda14651edb /drivers/media/tuners
parent0bb3d8ac87188a106f98e5d257f56f3ffe066147 (diff)
[media] fc0012: use config directly from the config struct
No need to copy config to the driver state. Those are coming from the const struct and could be used directly. Signed-off-by: Antti Palosaari <crope@iki.fi> Acked-by: Hans-Frieder Vogt <hfvogt@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/tuners')
-rw-r--r--drivers/media/tuners/fc0012-priv.h3
-rw-r--r--drivers/media/tuners/fc0012.c17
-rw-r--r--drivers/media/tuners/fc0012.h2
3 files changed, 9 insertions, 13 deletions
diff --git a/drivers/media/tuners/fc0012-priv.h b/drivers/media/tuners/fc0012-priv.h
index 1195ee9b9cf..3b98bf971fb 100644
--- a/drivers/media/tuners/fc0012-priv.h
+++ b/drivers/media/tuners/fc0012-priv.h
@@ -33,9 +33,6 @@
struct fc0012_priv {
struct i2c_adapter *i2c;
const struct fc0012_config *cfg;
- u8 addr;
- u8 dual_master;
- u8 xtal_freq;
u32 frequency;
u32 bandwidth;
diff --git a/drivers/media/tuners/fc0012.c b/drivers/media/tuners/fc0012.c
index 1a52b766360..01f5e406282 100644
--- a/drivers/media/tuners/fc0012.c
+++ b/drivers/media/tuners/fc0012.c
@@ -25,7 +25,7 @@ static int fc0012_writereg(struct fc0012_priv *priv, u8 reg, u8 val)
{
u8 buf[2] = {reg, val};
struct i2c_msg msg = {
- .addr = priv->addr, .flags = 0, .buf = buf, .len = 2
+ .addr = priv->cfg->i2c_address, .flags = 0, .buf = buf, .len = 2
};
if (i2c_transfer(priv->i2c, &msg, 1) != 1) {
@@ -38,8 +38,10 @@ static int fc0012_writereg(struct fc0012_priv *priv, u8 reg, u8 val)
static int fc0012_readreg(struct fc0012_priv *priv, u8 reg, u8 *val)
{
struct i2c_msg msg[2] = {
- { .addr = priv->addr, .flags = 0, .buf = &reg, .len = 1 },
- { .addr = priv->addr, .flags = I2C_M_RD, .buf = val, .len = 1 },
+ { .addr = priv->cfg->i2c_address, .flags = 0,
+ .buf = &reg, .len = 1 },
+ { .addr = priv->cfg->i2c_address, .flags = I2C_M_RD,
+ .buf = val, .len = 1 },
};
if (i2c_transfer(priv->i2c, msg, 2) != 2) {
@@ -88,7 +90,7 @@ static int fc0012_init(struct dvb_frontend *fe)
0x04, /* reg. 0x15: Enable LNA COMPS */
};
- switch (priv->xtal_freq) {
+ switch (priv->cfg->xtal_freq) {
case FC_XTAL_27_MHZ:
case FC_XTAL_28_8_MHZ:
reg[0x07] |= 0x20;
@@ -98,7 +100,7 @@ static int fc0012_init(struct dvb_frontend *fe)
break;
}
- if (priv->dual_master)
+ if (priv->cfg->dual_master)
reg[0x0c] |= 0x02;
if (priv->cfg->loop_through)
@@ -147,7 +149,7 @@ static int fc0012_set_params(struct dvb_frontend *fe)
goto exit;
}
- switch (priv->xtal_freq) {
+ switch (priv->cfg->xtal_freq) {
case FC_XTAL_27_MHZ:
xtal_freq_khz_2 = 27000 / 2;
break;
@@ -449,9 +451,6 @@ struct dvb_frontend *fc0012_attach(struct dvb_frontend *fe,
priv->i2c = i2c;
priv->cfg = cfg;
- priv->dual_master = cfg->dual_master;
- priv->addr = cfg->i2c_address;
- priv->xtal_freq = cfg->xtal_freq;
info("Fitipower FC0012 successfully attached.");
diff --git a/drivers/media/tuners/fc0012.h b/drivers/media/tuners/fc0012.h
index 83a98e73250..3fb53b86813 100644
--- a/drivers/media/tuners/fc0012.h
+++ b/drivers/media/tuners/fc0012.h
@@ -35,7 +35,7 @@ struct fc0012_config {
*/
enum fc001x_xtal_freq xtal_freq;
- int dual_master;
+ bool dual_master;
/*
* RF loop-through