summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2006-11-20 15:03:48 -0500
committerMichael Krufky <mkrufky@linuxtv.org>2006-11-20 15:03:48 -0500
commit84fad7e5d89c6d848c581cfe0367f9027400bc0d (patch)
treeced547e9365a79d12adc29c9e91a66553158d580
parent11e47ce1e81e4caf80d0de2b8545236e67149a8f (diff)
downloadmediapointer-dvb-s2-84fad7e5d89c6d848c581cfe0367f9027400bc0d.tar.gz
mediapointer-dvb-s2-84fad7e5d89c6d848c581cfe0367f9027400bc0d.tar.bz2
lgh06xf: use return value of dvb_pll_configure() to fill priv->frequency
From: Michael Krufky <mkrufky@linuxtv.org> 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>
-rw-r--r--linux/drivers/media/dvb/frontends/lgh06xf.c43
1 files changed, 19 insertions, 24 deletions
diff --git a/linux/drivers/media/dvb/frontends/lgh06xf.c b/linux/drivers/media/dvb/frontends/lgh06xf.c
index 8bbabd731..25396d199 100644
--- a/linux/drivers/media/dvb/frontends/lgh06xf.c
+++ b/linux/drivers/media/dvb/frontends/lgh06xf.c
@@ -40,19 +40,23 @@ static int lgh06xf_set_params(struct dvb_frontend* fe,
u8 buf[4];
struct i2c_msg msg = { .addr = LG_H06XF_PLL_I2C_ADDR, .flags = 0,
.buf = buf, .len = sizeof(buf) };
- u32 div;
- int i;
- int err;
+ u32 frequency;
+ int result;
+
+ if ((result = dvb_pll_configure(&dvb_pll_lg_tdvs_h06xf, buf,
+ params->frequency, 0)) < 0)
+ return result;
+ else
+ frequency = result;
- dvb_pll_configure(&dvb_pll_lg_tdvs_h06xf, buf, params->frequency, 0);
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1);
- if ((err = i2c_transfer(priv->i2c, &msg, 1)) != 1) {
+ if ((result = i2c_transfer(priv->i2c, &msg, 1)) != 1) {
printk(KERN_WARNING "lgh06xf: %s error "
- "(addr %02x <- %02x, err = %i)\n",
- __FUNCTION__, buf[0], buf[1], err);
- if (err < 0)
- return err;
+ "(addr %02x <- %02x, result = %i)\n",
+ __FUNCTION__, buf[0], buf[1], result);
+ if (result < 0)
+ return result;
else
return -EREMOTEIO;
}
@@ -71,26 +75,17 @@ static int lgh06xf_set_params(struct dvb_frontend* fe,
#endif
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1);
- if ((err = i2c_transfer(priv->i2c, &msg, 1)) != 1) {
+ if ((result = i2c_transfer(priv->i2c, &msg, 1)) != 1) {
printk(KERN_WARNING "lgh06xf: %s error "
- "(addr %02x <- %02x, err = %i)\n",
- __FUNCTION__, buf[0], buf[1], err);
- if (err < 0)
- return err;
+ "(addr %02x <- %02x, result = %i)\n",
+ __FUNCTION__, buf[0], buf[1], result);
+ if (result < 0)
+ return result;
else
return -EREMOTEIO;
}
- // calculate the frequency we set it to
- for (i = 0; i < dvb_pll_lg_tdvs_h06xf.count; i++) {
- if (params->frequency > dvb_pll_lg_tdvs_h06xf.entries[i].limit)
- continue;
- break;
- }
- div = (params->frequency + dvb_pll_lg_tdvs_h06xf.entries[i].offset) /
- dvb_pll_lg_tdvs_h06xf.entries[i].stepsize;
- priv->frequency = (div * dvb_pll_lg_tdvs_h06xf.entries[i].stepsize) -
- dvb_pll_lg_tdvs_h06xf.entries[i].offset;
+ priv->frequency = frequency;
return 0;
}