mirror of
https://github.com/adulau/aha.git
synced 2025-01-03 22:53:18 +00:00
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>
This commit is contained in:
parent
89faeefcf8
commit
fd83e2487e
1 changed files with 19 additions and 24 deletions
|
@ -40,19 +40,23 @@ static int lgh06xf_set_params(struct dvb_frontend* fe,
|
||||||
u8 buf[4];
|
u8 buf[4];
|
||||||
struct i2c_msg msg = { .addr = LG_H06XF_PLL_I2C_ADDR, .flags = 0,
|
struct i2c_msg msg = { .addr = LG_H06XF_PLL_I2C_ADDR, .flags = 0,
|
||||||
.buf = buf, .len = sizeof(buf) };
|
.buf = buf, .len = sizeof(buf) };
|
||||||
u32 div;
|
u32 frequency;
|
||||||
int i;
|
int result;
|
||||||
int err;
|
|
||||||
|
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)
|
if (fe->ops.i2c_gate_ctrl)
|
||||||
fe->ops.i2c_gate_ctrl(fe, 1);
|
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 "
|
printk(KERN_WARNING "lgh06xf: %s error "
|
||||||
"(addr %02x <- %02x, err = %i)\n",
|
"(addr %02x <- %02x, result = %i)\n",
|
||||||
__FUNCTION__, buf[0], buf[1], err);
|
__FUNCTION__, buf[0], buf[1], result);
|
||||||
if (err < 0)
|
if (result < 0)
|
||||||
return err;
|
return result;
|
||||||
else
|
else
|
||||||
return -EREMOTEIO;
|
return -EREMOTEIO;
|
||||||
}
|
}
|
||||||
|
@ -65,26 +69,17 @@ static int lgh06xf_set_params(struct dvb_frontend* fe,
|
||||||
msg.len = 2;
|
msg.len = 2;
|
||||||
if (fe->ops.i2c_gate_ctrl)
|
if (fe->ops.i2c_gate_ctrl)
|
||||||
fe->ops.i2c_gate_ctrl(fe, 1);
|
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 "
|
printk(KERN_WARNING "lgh06xf: %s error "
|
||||||
"(addr %02x <- %02x, err = %i)\n",
|
"(addr %02x <- %02x, result = %i)\n",
|
||||||
__FUNCTION__, buf[0], buf[1], err);
|
__FUNCTION__, buf[0], buf[1], result);
|
||||||
if (err < 0)
|
if (result < 0)
|
||||||
return err;
|
return result;
|
||||||
else
|
else
|
||||||
return -EREMOTEIO;
|
return -EREMOTEIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate the frequency we set it to
|
priv->frequency = frequency;
|
||||||
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;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue