aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2005-09-06 18:19:40 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-07 19:58:02 -0400
commitdc9ca2af4917ce4e545fa3eb1d845c555128cabc (patch)
treead7e5cdc1ebd0767fc7bf717c3d9340efc2af38b /drivers/media
parent2684f5c74d5c2d3eb6ddbb599a8c89a06c5fa420 (diff)
[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: Patrick Boettcher <pb@linuxtv.org> Signed-off-by: Michael Krufky <mkrufky@m1k.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/frontends/lgdt330x.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/drivers/media/dvb/frontends/lgdt330x.c b/drivers/media/dvb/frontends/lgdt330x.c
index 1f1cd7a8d500..7142b9c51dd2 100644
--- a/drivers/media/dvb/frontends/lgdt330x.c
+++ b/drivers/media/dvb/frontends/lgdt330x.c
@@ -69,8 +69,8 @@ struct lgdt330x_state
69}; 69};
70 70
71static int i2c_write_demod_bytes (struct lgdt330x_state* state, 71static int i2c_write_demod_bytes (struct lgdt330x_state* state,
72 u8 *buf, /* data bytes to send */ 72 u8 *buf, /* data bytes to send */
73 int len /* number of bytes to send */ ) 73 int len /* number of bytes to send */ )
74{ 74{
75 struct i2c_msg msg = 75 struct i2c_msg msg =
76 { .addr = state->config->demod_address, 76 { .addr = state->config->demod_address,
@@ -129,13 +129,13 @@ static int lgdt3302_SwReset(struct lgdt330x_state* state)
129 }; 129 };
130 130
131 ret = i2c_write_demod_bytes(state, 131 ret = i2c_write_demod_bytes(state,
132 reset, sizeof(reset)); 132 reset, sizeof(reset));
133 if (ret == 0) { 133 if (ret == 0) {
134 134
135 /* force reset high (inactive) and unmask interrupts */ 135 /* force reset high (inactive) and unmask interrupts */
136 reset[1] = 0x7f; 136 reset[1] = 0x7f;
137 ret = i2c_write_demod_bytes(state, 137 ret = i2c_write_demod_bytes(state,
138 reset, sizeof(reset)); 138 reset, sizeof(reset));
139 } 139 }
140 return ret; 140 return ret;
141} 141}
@@ -149,13 +149,13 @@ static int lgdt3303_SwReset(struct lgdt330x_state* state)
149 }; 149 };
150 150
151 ret = i2c_write_demod_bytes(state, 151 ret = i2c_write_demod_bytes(state,
152 reset, sizeof(reset)); 152 reset, sizeof(reset));
153 if (ret == 0) { 153 if (ret == 0) {
154 154
155 /* force reset high (inactive) */ 155 /* force reset high (inactive) */
156 reset[1] = 0x01; 156 reset[1] = 0x01;
157 ret = i2c_write_demod_bytes(state, 157 ret = i2c_write_demod_bytes(state,
158 reset, sizeof(reset)); 158 reset, sizeof(reset));
159 } 159 }
160 return ret; 160 return ret;
161} 161}
@@ -172,7 +172,6 @@ static int lgdt330x_SwReset(struct lgdt330x_state* state)
172 } 172 }
173} 173}
174 174
175
176static int lgdt330x_init(struct dvb_frontend* fe) 175static int lgdt330x_init(struct dvb_frontend* fe)
177{ 176{
178 /* Hardware reset is done using gpio[0] of cx23880x chip. 177 /* Hardware reset is done using gpio[0] of cx23880x chip.
@@ -229,13 +228,13 @@ static int lgdt330x_init(struct dvb_frontend* fe)
229 case LGDT3302: 228 case LGDT3302:
230 chip_name = "LGDT3302"; 229 chip_name = "LGDT3302";
231 err = i2c_write_demod_bytes(state, lgdt3302_init_data, 230 err = i2c_write_demod_bytes(state, lgdt3302_init_data,
232 sizeof(lgdt3302_init_data)); 231 sizeof(lgdt3302_init_data));
233 break; 232 break;
234 case LGDT3303: 233 case LGDT3303:
235 chip_name = "LGDT3303"; 234 chip_name = "LGDT3303";
236 err = i2c_write_demod_bytes(state, lgdt3303_init_data, 235 err = i2c_write_demod_bytes(state, lgdt3303_init_data,
237 sizeof(lgdt3303_init_data)); 236 sizeof(lgdt3303_init_data));
238 break; 237 break;
239 default: 238 default:
240 chip_name = "undefined"; 239 chip_name = "undefined";
241 printk (KERN_WARNING "Only LGDT3302 and LGDT3303 are supported chips.\n"); 240 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 switch (state->config->demod_chip) { 261 switch (state->config->demod_chip) {
263 case LGDT3302: 262 case LGDT3302:
264 err = i2c_read_demod_bytes(state, LGDT3302_PACKET_ERR_COUNTER1, 263 err = i2c_read_demod_bytes(state, LGDT3302_PACKET_ERR_COUNTER1,
265 buf, sizeof(buf)); 264 buf, sizeof(buf));
266 break; 265 break;
267 case LGDT3303: 266 case LGDT3303:
268 err = i2c_read_demod_bytes(state, LGDT3303_PACKET_ERR_COUNTER1, 267 err = i2c_read_demod_bytes(state, LGDT3303_PACKET_ERR_COUNTER1,
269 buf, sizeof(buf)); 268 buf, sizeof(buf));
270 break; 269 break;
271 default: 270 default:
272 printk(KERN_WARNING 271 printk(KERN_WARNING
273 "Only LGDT3302 and LGDT3303 are supported chips.\n"); 272 "Only LGDT3302 and LGDT3303 are supported chips.\n");
274 err = -ENODEV; 273 err = -ENODEV;
275 } 274 }
276 275
@@ -330,7 +329,7 @@ static int lgdt330x_set_parameters(struct dvb_frontend* fe,
330 329
331 if (state->config->demod_chip == LGDT3303) { 330 if (state->config->demod_chip == LGDT3303) {
332 err = i2c_write_demod_bytes(state, lgdt3303_8vsb_44_data, 331 err = i2c_write_demod_bytes(state, lgdt3303_8vsb_44_data,
333 sizeof(lgdt3303_8vsb_44_data)); 332 sizeof(lgdt3303_8vsb_44_data));
334 } 333 }
335 break; 334 break;
336 335
@@ -378,18 +377,19 @@ static int lgdt330x_set_parameters(struct dvb_frontend* fe,
378 377
379 /* Select the requested mode */ 378 /* Select the requested mode */
380 i2c_write_demod_bytes(state, top_ctrl_cfg, 379 i2c_write_demod_bytes(state, top_ctrl_cfg,
381 sizeof(top_ctrl_cfg)); 380 sizeof(top_ctrl_cfg));
382 state->config->set_ts_params(fe, 0); 381 if (state->config->set_ts_params)
382 state->config->set_ts_params(fe, 0);
383 state->current_modulation = param->u.vsb.modulation; 383 state->current_modulation = param->u.vsb.modulation;
384 } 384 }
385 385
386 /* Change only if we are actually changing the channel */ 386 /* Tune to the specified frequency */
387 if (state->current_frequency != param->frequency) { 387 if (state->config->pll_set)
388 /* Tune to the new frequency */
389 state->config->pll_set(fe, param); 388 state->config->pll_set(fe, param);
390 /* Keep track of the new frequency */ 389
391 state->current_frequency = param->frequency; 390 /* Keep track of the new frequency */
392 } 391 state->current_frequency = param->frequency;
392
393 lgdt330x_SwReset(state); 393 lgdt330x_SwReset(state);
394 return 0; 394 return 0;
395} 395}