提交 dc9ca2af 编写于 作者: M Michael Krufky 提交者: Linus Torvalds

[PATCH] DVB: lgdt330x check callback fix

Most of the patch is whitespace cleanup, but more importantly, this patch
checks to see whether a callback is set before calling it.  On cx88 boards
(currently the only boards using lgdt330x in 2.6.13) every callback is set.
However, newer drivers currently in development leave a callback undefined,
and lgdt330x must not call it if it isn't defined.
Signed-off-by: NPatrick Boettcher <pb@linuxtv.org>
Signed-off-by: NMichael Krufky <mkrufky@m1k.net>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 2684f5c7
...@@ -69,8 +69,8 @@ struct lgdt330x_state ...@@ -69,8 +69,8 @@ struct lgdt330x_state
}; };
static int i2c_write_demod_bytes (struct lgdt330x_state* state, static int i2c_write_demod_bytes (struct lgdt330x_state* state,
u8 *buf, /* data bytes to send */ u8 *buf, /* data bytes to send */
int len /* number of bytes to send */ ) int len /* number of bytes to send */ )
{ {
struct i2c_msg msg = struct i2c_msg msg =
{ .addr = state->config->demod_address, { .addr = state->config->demod_address,
...@@ -129,13 +129,13 @@ static int lgdt3302_SwReset(struct lgdt330x_state* state) ...@@ -129,13 +129,13 @@ static int lgdt3302_SwReset(struct lgdt330x_state* state)
}; };
ret = i2c_write_demod_bytes(state, ret = i2c_write_demod_bytes(state,
reset, sizeof(reset)); reset, sizeof(reset));
if (ret == 0) { if (ret == 0) {
/* force reset high (inactive) and unmask interrupts */ /* force reset high (inactive) and unmask interrupts */
reset[1] = 0x7f; reset[1] = 0x7f;
ret = i2c_write_demod_bytes(state, ret = i2c_write_demod_bytes(state,
reset, sizeof(reset)); reset, sizeof(reset));
} }
return ret; return ret;
} }
...@@ -149,13 +149,13 @@ static int lgdt3303_SwReset(struct lgdt330x_state* state) ...@@ -149,13 +149,13 @@ static int lgdt3303_SwReset(struct lgdt330x_state* state)
}; };
ret = i2c_write_demod_bytes(state, ret = i2c_write_demod_bytes(state,
reset, sizeof(reset)); reset, sizeof(reset));
if (ret == 0) { if (ret == 0) {
/* force reset high (inactive) */ /* force reset high (inactive) */
reset[1] = 0x01; reset[1] = 0x01;
ret = i2c_write_demod_bytes(state, ret = i2c_write_demod_bytes(state,
reset, sizeof(reset)); reset, sizeof(reset));
} }
return ret; return ret;
} }
...@@ -172,7 +172,6 @@ static int lgdt330x_SwReset(struct lgdt330x_state* state) ...@@ -172,7 +172,6 @@ static int lgdt330x_SwReset(struct lgdt330x_state* state)
} }
} }
static int lgdt330x_init(struct dvb_frontend* fe) static int lgdt330x_init(struct dvb_frontend* fe)
{ {
/* Hardware reset is done using gpio[0] of cx23880x chip. /* Hardware reset is done using gpio[0] of cx23880x chip.
...@@ -229,13 +228,13 @@ static int lgdt330x_init(struct dvb_frontend* fe) ...@@ -229,13 +228,13 @@ static int lgdt330x_init(struct dvb_frontend* fe)
case LGDT3302: case LGDT3302:
chip_name = "LGDT3302"; chip_name = "LGDT3302";
err = i2c_write_demod_bytes(state, lgdt3302_init_data, err = i2c_write_demod_bytes(state, lgdt3302_init_data,
sizeof(lgdt3302_init_data)); sizeof(lgdt3302_init_data));
break; break;
case LGDT3303: case LGDT3303:
chip_name = "LGDT3303"; chip_name = "LGDT3303";
err = i2c_write_demod_bytes(state, lgdt3303_init_data, err = i2c_write_demod_bytes(state, lgdt3303_init_data,
sizeof(lgdt3303_init_data)); sizeof(lgdt3303_init_data));
break; break;
default: default:
chip_name = "undefined"; chip_name = "undefined";
printk (KERN_WARNING "Only LGDT3302 and LGDT3303 are supported chips.\n"); printk (KERN_WARNING "Only LGDT3302 and LGDT3303 are supported chips.\n");
...@@ -262,15 +261,15 @@ static int lgdt330x_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) ...@@ -262,15 +261,15 @@ static int lgdt330x_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
switch (state->config->demod_chip) { switch (state->config->demod_chip) {
case LGDT3302: case LGDT3302:
err = i2c_read_demod_bytes(state, LGDT3302_PACKET_ERR_COUNTER1, err = i2c_read_demod_bytes(state, LGDT3302_PACKET_ERR_COUNTER1,
buf, sizeof(buf)); buf, sizeof(buf));
break; break;
case LGDT3303: case LGDT3303:
err = i2c_read_demod_bytes(state, LGDT3303_PACKET_ERR_COUNTER1, err = i2c_read_demod_bytes(state, LGDT3303_PACKET_ERR_COUNTER1,
buf, sizeof(buf)); buf, sizeof(buf));
break; break;
default: default:
printk(KERN_WARNING printk(KERN_WARNING
"Only LGDT3302 and LGDT3303 are supported chips.\n"); "Only LGDT3302 and LGDT3303 are supported chips.\n");
err = -ENODEV; err = -ENODEV;
} }
...@@ -330,7 +329,7 @@ static int lgdt330x_set_parameters(struct dvb_frontend* fe, ...@@ -330,7 +329,7 @@ static int lgdt330x_set_parameters(struct dvb_frontend* fe,
if (state->config->demod_chip == LGDT3303) { if (state->config->demod_chip == LGDT3303) {
err = i2c_write_demod_bytes(state, lgdt3303_8vsb_44_data, err = i2c_write_demod_bytes(state, lgdt3303_8vsb_44_data,
sizeof(lgdt3303_8vsb_44_data)); sizeof(lgdt3303_8vsb_44_data));
} }
break; break;
...@@ -378,18 +377,19 @@ static int lgdt330x_set_parameters(struct dvb_frontend* fe, ...@@ -378,18 +377,19 @@ static int lgdt330x_set_parameters(struct dvb_frontend* fe,
/* Select the requested mode */ /* Select the requested mode */
i2c_write_demod_bytes(state, top_ctrl_cfg, i2c_write_demod_bytes(state, top_ctrl_cfg,
sizeof(top_ctrl_cfg)); sizeof(top_ctrl_cfg));
state->config->set_ts_params(fe, 0); if (state->config->set_ts_params)
state->config->set_ts_params(fe, 0);
state->current_modulation = param->u.vsb.modulation; state->current_modulation = param->u.vsb.modulation;
} }
/* Change only if we are actually changing the channel */ /* Tune to the specified frequency */
if (state->current_frequency != param->frequency) { if (state->config->pll_set)
/* Tune to the new frequency */
state->config->pll_set(fe, param); state->config->pll_set(fe, param);
/* Keep track of the new frequency */
state->current_frequency = param->frequency; /* Keep track of the new frequency */
} state->current_frequency = param->frequency;
lgdt330x_SwReset(state); lgdt330x_SwReset(state);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册