diff options
author | Antti Palosaari <crope@iki.fi> | 2012-12-09 10:33:04 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-01-06 06:07:28 -0500 |
commit | 3a98477200b44328e50a5c0830f92fd5cdc1ea9b (patch) | |
tree | 94e0c29fa74e93e15deb9e51b4772cda14651edb /drivers/media/tuners | |
parent | 0bb3d8ac87188a106f98e5d257f56f3ffe066147 (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.h | 3 | ||||
-rw-r--r-- | drivers/media/tuners/fc0012.c | 17 | ||||
-rw-r--r-- | drivers/media/tuners/fc0012.h | 2 |
3 files changed, 9 insertions, 13 deletions
diff --git a/drivers/media/tuners/fc0012-priv.h b/drivers/media/tuners/fc0012-priv.h index 1195ee9b9cf7..3b98bf971fb3 100644 --- a/drivers/media/tuners/fc0012-priv.h +++ b/drivers/media/tuners/fc0012-priv.h | |||
@@ -33,9 +33,6 @@ | |||
33 | struct fc0012_priv { | 33 | struct fc0012_priv { |
34 | struct i2c_adapter *i2c; | 34 | struct i2c_adapter *i2c; |
35 | const struct fc0012_config *cfg; | 35 | const struct fc0012_config *cfg; |
36 | u8 addr; | ||
37 | u8 dual_master; | ||
38 | u8 xtal_freq; | ||
39 | 36 | ||
40 | u32 frequency; | 37 | u32 frequency; |
41 | u32 bandwidth; | 38 | u32 bandwidth; |
diff --git a/drivers/media/tuners/fc0012.c b/drivers/media/tuners/fc0012.c index 1a52b766360f..01f5e406282c 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) | |||
25 | { | 25 | { |
26 | u8 buf[2] = {reg, val}; | 26 | u8 buf[2] = {reg, val}; |
27 | struct i2c_msg msg = { | 27 | struct i2c_msg msg = { |
28 | .addr = priv->addr, .flags = 0, .buf = buf, .len = 2 | 28 | .addr = priv->cfg->i2c_address, .flags = 0, .buf = buf, .len = 2 |
29 | }; | 29 | }; |
30 | 30 | ||
31 | if (i2c_transfer(priv->i2c, &msg, 1) != 1) { | 31 | if (i2c_transfer(priv->i2c, &msg, 1) != 1) { |
@@ -38,8 +38,10 @@ static int fc0012_writereg(struct fc0012_priv *priv, u8 reg, u8 val) | |||
38 | static int fc0012_readreg(struct fc0012_priv *priv, u8 reg, u8 *val) | 38 | static int fc0012_readreg(struct fc0012_priv *priv, u8 reg, u8 *val) |
39 | { | 39 | { |
40 | struct i2c_msg msg[2] = { | 40 | struct i2c_msg msg[2] = { |
41 | { .addr = priv->addr, .flags = 0, .buf = ®, .len = 1 }, | 41 | { .addr = priv->cfg->i2c_address, .flags = 0, |
42 | { .addr = priv->addr, .flags = I2C_M_RD, .buf = val, .len = 1 }, | 42 | .buf = ®, .len = 1 }, |
43 | { .addr = priv->cfg->i2c_address, .flags = I2C_M_RD, | ||
44 | .buf = val, .len = 1 }, | ||
43 | }; | 45 | }; |
44 | 46 | ||
45 | if (i2c_transfer(priv->i2c, msg, 2) != 2) { | 47 | if (i2c_transfer(priv->i2c, msg, 2) != 2) { |
@@ -88,7 +90,7 @@ static int fc0012_init(struct dvb_frontend *fe) | |||
88 | 0x04, /* reg. 0x15: Enable LNA COMPS */ | 90 | 0x04, /* reg. 0x15: Enable LNA COMPS */ |
89 | }; | 91 | }; |
90 | 92 | ||
91 | switch (priv->xtal_freq) { | 93 | switch (priv->cfg->xtal_freq) { |
92 | case FC_XTAL_27_MHZ: | 94 | case FC_XTAL_27_MHZ: |
93 | case FC_XTAL_28_8_MHZ: | 95 | case FC_XTAL_28_8_MHZ: |
94 | reg[0x07] |= 0x20; | 96 | reg[0x07] |= 0x20; |
@@ -98,7 +100,7 @@ static int fc0012_init(struct dvb_frontend *fe) | |||
98 | break; | 100 | break; |
99 | } | 101 | } |
100 | 102 | ||
101 | if (priv->dual_master) | 103 | if (priv->cfg->dual_master) |
102 | reg[0x0c] |= 0x02; | 104 | reg[0x0c] |= 0x02; |
103 | 105 | ||
104 | if (priv->cfg->loop_through) | 106 | if (priv->cfg->loop_through) |
@@ -147,7 +149,7 @@ static int fc0012_set_params(struct dvb_frontend *fe) | |||
147 | goto exit; | 149 | goto exit; |
148 | } | 150 | } |
149 | 151 | ||
150 | switch (priv->xtal_freq) { | 152 | switch (priv->cfg->xtal_freq) { |
151 | case FC_XTAL_27_MHZ: | 153 | case FC_XTAL_27_MHZ: |
152 | xtal_freq_khz_2 = 27000 / 2; | 154 | xtal_freq_khz_2 = 27000 / 2; |
153 | break; | 155 | break; |
@@ -449,9 +451,6 @@ struct dvb_frontend *fc0012_attach(struct dvb_frontend *fe, | |||
449 | 451 | ||
450 | priv->i2c = i2c; | 452 | priv->i2c = i2c; |
451 | priv->cfg = cfg; | 453 | priv->cfg = cfg; |
452 | priv->dual_master = cfg->dual_master; | ||
453 | priv->addr = cfg->i2c_address; | ||
454 | priv->xtal_freq = cfg->xtal_freq; | ||
455 | 454 | ||
456 | info("Fitipower FC0012 successfully attached."); | 455 | info("Fitipower FC0012 successfully attached."); |
457 | 456 | ||
diff --git a/drivers/media/tuners/fc0012.h b/drivers/media/tuners/fc0012.h index 83a98e732502..3fb53b86813a 100644 --- a/drivers/media/tuners/fc0012.h +++ b/drivers/media/tuners/fc0012.h | |||
@@ -35,7 +35,7 @@ struct fc0012_config { | |||
35 | */ | 35 | */ |
36 | enum fc001x_xtal_freq xtal_freq; | 36 | enum fc001x_xtal_freq xtal_freq; |
37 | 37 | ||
38 | int dual_master; | 38 | bool dual_master; |
39 | 39 | ||
40 | /* | 40 | /* |
41 | * RF loop-through | 41 | * RF loop-through |