diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2006-11-20 15:03:48 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-12-10 06:05:06 -0500 |
commit | fd83e2487e9149d8cd7c8b1e7d6f0e5231b79f8a (patch) | |
tree | 468c14d3b00eeafb352b982365d113d4f4d62e73 | |
parent | 89faeefcf875c16d8923eaed50bd57731c221bcc (diff) |
V4L/DVB (4869): Lgh06xf: use return value of dvb_pll_configure()
Use return value of dvb_pll_configure() to fill priv->frequency
In lgh06xf_set_params:
Rename int variable "err" to "result".
Remove needless calculation of the set frequency, since this value is now
being returned by dvb_pll_configure().
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r-- | drivers/media/dvb/frontends/lgh06xf.c | 43 |
1 files changed, 19 insertions, 24 deletions
diff --git a/drivers/media/dvb/frontends/lgh06xf.c b/drivers/media/dvb/frontends/lgh06xf.c index badbea8ad821..2202d0cc878b 100644 --- a/drivers/media/dvb/frontends/lgh06xf.c +++ b/drivers/media/dvb/frontends/lgh06xf.c | |||
@@ -40,19 +40,23 @@ static int lgh06xf_set_params(struct dvb_frontend* fe, | |||
40 | u8 buf[4]; | 40 | u8 buf[4]; |
41 | struct i2c_msg msg = { .addr = LG_H06XF_PLL_I2C_ADDR, .flags = 0, | 41 | struct i2c_msg msg = { .addr = LG_H06XF_PLL_I2C_ADDR, .flags = 0, |
42 | .buf = buf, .len = sizeof(buf) }; | 42 | .buf = buf, .len = sizeof(buf) }; |
43 | u32 div; | 43 | u32 frequency; |
44 | int i; | 44 | int result; |
45 | int err; | 45 | |
46 | if ((result = dvb_pll_configure(&dvb_pll_lg_tdvs_h06xf, buf, | ||
47 | params->frequency, 0)) < 0) | ||
48 | return result; | ||
49 | else | ||
50 | frequency = result; | ||
46 | 51 | ||
47 | dvb_pll_configure(&dvb_pll_lg_tdvs_h06xf, buf, params->frequency, 0); | ||
48 | if (fe->ops.i2c_gate_ctrl) | 52 | if (fe->ops.i2c_gate_ctrl) |
49 | fe->ops.i2c_gate_ctrl(fe, 1); | 53 | fe->ops.i2c_gate_ctrl(fe, 1); |
50 | if ((err = i2c_transfer(priv->i2c, &msg, 1)) != 1) { | 54 | if ((result = i2c_transfer(priv->i2c, &msg, 1)) != 1) { |
51 | printk(KERN_WARNING "lgh06xf: %s error " | 55 | printk(KERN_WARNING "lgh06xf: %s error " |
52 | "(addr %02x <- %02x, err = %i)\n", | 56 | "(addr %02x <- %02x, result = %i)\n", |
53 | __FUNCTION__, buf[0], buf[1], err); | 57 | __FUNCTION__, buf[0], buf[1], result); |
54 | if (err < 0) | 58 | if (result < 0) |
55 | return err; | 59 | return result; |
56 | else | 60 | else |
57 | return -EREMOTEIO; | 61 | return -EREMOTEIO; |
58 | } | 62 | } |
@@ -65,26 +69,17 @@ static int lgh06xf_set_params(struct dvb_frontend* fe, | |||
65 | msg.len = 2; | 69 | msg.len = 2; |
66 | if (fe->ops.i2c_gate_ctrl) | 70 | if (fe->ops.i2c_gate_ctrl) |
67 | fe->ops.i2c_gate_ctrl(fe, 1); | 71 | fe->ops.i2c_gate_ctrl(fe, 1); |
68 | if ((err = i2c_transfer(priv->i2c, &msg, 1)) != 1) { | 72 | if ((result = i2c_transfer(priv->i2c, &msg, 1)) != 1) { |
69 | printk(KERN_WARNING "lgh06xf: %s error " | 73 | printk(KERN_WARNING "lgh06xf: %s error " |
70 | "(addr %02x <- %02x, err = %i)\n", | 74 | "(addr %02x <- %02x, result = %i)\n", |
71 | __FUNCTION__, buf[0], buf[1], err); | 75 | __FUNCTION__, buf[0], buf[1], result); |
72 | if (err < 0) | 76 | if (result < 0) |
73 | return err; | 77 | return result; |
74 | else | 78 | else |
75 | return -EREMOTEIO; | 79 | return -EREMOTEIO; |
76 | } | 80 | } |
77 | 81 | ||
78 | // calculate the frequency we set it to | 82 | priv->frequency = frequency; |
79 | for (i = 0; i < dvb_pll_lg_tdvs_h06xf.count; i++) { | ||
80 | if (params->frequency > dvb_pll_lg_tdvs_h06xf.entries[i].limit) | ||
81 | continue; | ||
82 | break; | ||
83 | } | ||
84 | div = (params->frequency + dvb_pll_lg_tdvs_h06xf.entries[i].offset) / | ||
85 | dvb_pll_lg_tdvs_h06xf.entries[i].stepsize; | ||
86 | priv->frequency = (div * dvb_pll_lg_tdvs_h06xf.entries[i].stepsize) - | ||
87 | dvb_pll_lg_tdvs_h06xf.entries[i].offset; | ||
88 | 83 | ||
89 | return 0; | 84 | return 0; |
90 | } | 85 | } |