aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/mt352.c
diff options
context:
space:
mode:
authorJohannes Stezenbach <js@linuxtv.org>2005-05-17 00:54:34 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-17 10:59:31 -0400
commit77b3bd0ccb2fae27e710b921f053ae16f34d70de (patch)
treef4d34e59ca33b2c9d2ff08b8c5a045b376e569eb /drivers/media/dvb/frontends/mt352.c
parentcd22d5c093faf3b123af33a8a0059f583c6b8cae (diff)
[PATCH] dvb: mt352: embed struct mt352_config in mt352_state
copying the mt352_config-struct to mt352_state instead of storing just the pointer to it (Patrick Boettcher) Signed-off-by: Johannes Stezenbach <js@linuxtv.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media/dvb/frontends/mt352.c')
-rw-r--r--drivers/media/dvb/frontends/mt352.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/media/dvb/frontends/mt352.c b/drivers/media/dvb/frontends/mt352.c
index 50326c7248fa..2d13a412ce6a 100644
--- a/drivers/media/dvb/frontends/mt352.c
+++ b/drivers/media/dvb/frontends/mt352.c
@@ -46,7 +46,7 @@ struct mt352_state {
46 struct dvb_frontend_ops ops; 46 struct dvb_frontend_ops ops;
47 47
48 /* configuration settings */ 48 /* configuration settings */
49 const struct mt352_config* config; 49 struct mt352_config config;
50}; 50};
51 51
52static int debug; 52static int debug;
@@ -59,7 +59,7 @@ static int mt352_single_write(struct dvb_frontend *fe, u8 reg, u8 val)
59{ 59{
60 struct mt352_state* state = fe->demodulator_priv; 60 struct mt352_state* state = fe->demodulator_priv;
61 u8 buf[2] = { reg, val }; 61 u8 buf[2] = { reg, val };
62 struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, 62 struct i2c_msg msg = { .addr = state->config.demod_address, .flags = 0,
63 .buf = buf, .len = 2 }; 63 .buf = buf, .len = 2 };
64 int err = i2c_transfer(state->i2c, &msg, 1); 64 int err = i2c_transfer(state->i2c, &msg, 1);
65 if (err != 1) { 65 if (err != 1) {
@@ -84,10 +84,10 @@ static int mt352_read_register(struct mt352_state* state, u8 reg)
84 int ret; 84 int ret;
85 u8 b0 [] = { reg }; 85 u8 b0 [] = { reg };
86 u8 b1 [] = { 0 }; 86 u8 b1 [] = { 0 };
87 struct i2c_msg msg [] = { { .addr = state->config->demod_address, 87 struct i2c_msg msg [] = { { .addr = state->config.demod_address,
88 .flags = 0, 88 .flags = 0,
89 .buf = b0, .len = 1 }, 89 .buf = b0, .len = 1 },
90 { .addr = state->config->demod_address, 90 { .addr = state->config.demod_address,
91 .flags = I2C_M_RD, 91 .flags = I2C_M_RD,
92 .buf = b1, .len = 1 } }; 92 .buf = b1, .len = 1 } };
93 93
@@ -134,8 +134,8 @@ static void mt352_calc_nominal_rate(struct mt352_state* state,
134 bw = 8; 134 bw = 8;
135 break; 135 break;
136 } 136 }
137 if (state->config->adc_clock) 137 if (state->config.adc_clock)
138 adc_clock = state->config->adc_clock; 138 adc_clock = state->config.adc_clock;
139 139
140 value = 64 * bw * (1<<16) / (7 * 8); 140 value = 64 * bw * (1<<16) / (7 * 8);
141 value = value * 1000 / adc_clock; 141 value = value * 1000 / adc_clock;
@@ -152,10 +152,10 @@ static void mt352_calc_input_freq(struct mt352_state* state,
152 int if2 = 36167; /* 36.166667 MHz */ 152 int if2 = 36167; /* 36.166667 MHz */
153 int ife,value; 153 int ife,value;
154 154
155 if (state->config->adc_clock) 155 if (state->config.adc_clock)
156 adc_clock = state->config->adc_clock; 156 adc_clock = state->config.adc_clock;
157 if (state->config->if2) 157 if (state->config.if2)
158 if2 = state->config->if2; 158 if2 = state->config.if2;
159 159
160 ife = (2*adc_clock - if2); 160 ife = (2*adc_clock - if2);
161 value = -16374 * ife / adc_clock; 161 value = -16374 * ife / adc_clock;
@@ -289,10 +289,10 @@ static int mt352_set_parameters(struct dvb_frontend* fe,
289 289
290 mt352_calc_nominal_rate(state, op->bandwidth, buf+4); 290 mt352_calc_nominal_rate(state, op->bandwidth, buf+4);
291 mt352_calc_input_freq(state, buf+6); 291 mt352_calc_input_freq(state, buf+6);
292 state->config->pll_set(fe, param, buf+8); 292 state->config.pll_set(fe, param, buf+8);
293 293
294 mt352_write(fe, buf, sizeof(buf)); 294 mt352_write(fe, buf, sizeof(buf));
295 if (state->config->no_tuner) { 295 if (state->config.no_tuner) {
296 /* start decoding */ 296 /* start decoding */
297 mt352_write(fe, fsm_go, 2); 297 mt352_write(fe, fsm_go, 2);
298 } else { 298 } else {
@@ -516,7 +516,7 @@ static int mt352_init(struct dvb_frontend* fe)
516 516
517 /* Do a "hard" reset */ 517 /* Do a "hard" reset */
518 mt352_write(fe, mt352_reset_attach, sizeof(mt352_reset_attach)); 518 mt352_write(fe, mt352_reset_attach, sizeof(mt352_reset_attach));
519 return state->config->demod_init(fe); 519 return state->config.demod_init(fe);
520 } 520 }
521 521
522 return 0; 522 return 0;
@@ -541,8 +541,8 @@ struct dvb_frontend* mt352_attach(const struct mt352_config* config,
541 memset(state,0,sizeof(*state)); 541 memset(state,0,sizeof(*state));
542 542
543 /* setup the state */ 543 /* setup the state */
544 state->config = config;
545 state->i2c = i2c; 544 state->i2c = i2c;
545 memcpy(&state->config,config,sizeof(struct mt352_config));
546 memcpy(&state->ops, &mt352_ops, sizeof(struct dvb_frontend_ops)); 546 memcpy(&state->ops, &mt352_ops, sizeof(struct dvb_frontend_ops));
547 547
548 /* check if the demod is there */ 548 /* check if the demod is there */