diff options
author | Patrick Boettcher <pb@linuxtv.org> | 2006-05-14 04:01:31 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-06-25 01:00:42 -0400 |
commit | dea74869f3c62b0b7addd67017b22b394e942aac (patch) | |
tree | d1a597caea6615c76f34896cc832fd1371f2e776 /drivers/media/dvb/ttusb-dec/ttusbdecfe.c | |
parent | 332bed5fc25ab0eb84215ecd89a4acd48219eee0 (diff) |
V4L/DVB (4028): Change dvb_frontend_ops to be a real field instead of a pointer field inside dvb_frontend
The dvb_frontend_ops is a pointer inside dvb_frontend. That's why every demod-driver
is having a field of dvb_frontend_ops in its private-state-struct and
using the reference for filling the pointer-field in dvb_frontend.
- It saves at least two lines of code per demod-driver,
- reduces object size (one less dereference per frontend_ops-access),
- be coherent with dvb_tuner_ops,
- makes it a little bit easier for newbies to understand how it works and
- avoids stupid mistakes because you would have to copy the dvb_frontend_ops
always, before you could assign the static pointer directly, which was
dangerous.
Signed-off-by: Patrick Boettcher <pb@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/ttusb-dec/ttusbdecfe.c')
-rw-r--r-- | drivers/media/dvb/ttusb-dec/ttusbdecfe.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/media/dvb/ttusb-dec/ttusbdecfe.c b/drivers/media/dvb/ttusb-dec/ttusbdecfe.c index a5a46175fa09..42f39a89bc4d 100644 --- a/drivers/media/dvb/ttusb-dec/ttusbdecfe.c +++ b/drivers/media/dvb/ttusb-dec/ttusbdecfe.c | |||
@@ -28,8 +28,6 @@ | |||
28 | 28 | ||
29 | struct ttusbdecfe_state { | 29 | struct ttusbdecfe_state { |
30 | 30 | ||
31 | struct dvb_frontend_ops ops; | ||
32 | |||
33 | /* configuration settings */ | 31 | /* configuration settings */ |
34 | const struct ttusbdecfe_config* config; | 32 | const struct ttusbdecfe_config* config; |
35 | 33 | ||
@@ -203,10 +201,9 @@ struct dvb_frontend* ttusbdecfe_dvbt_attach(const struct ttusbdecfe_config* conf | |||
203 | 201 | ||
204 | /* setup the state */ | 202 | /* setup the state */ |
205 | state->config = config; | 203 | state->config = config; |
206 | memcpy(&state->ops, &ttusbdecfe_dvbt_ops, sizeof(struct dvb_frontend_ops)); | ||
207 | 204 | ||
208 | /* create dvb_frontend */ | 205 | /* create dvb_frontend */ |
209 | state->frontend.ops = &state->ops; | 206 | memcpy(&state->frontend.ops, &ttusbdecfe_dvbt_ops, sizeof(struct dvb_frontend_ops)); |
210 | state->frontend.demodulator_priv = state; | 207 | state->frontend.demodulator_priv = state; |
211 | return &state->frontend; | 208 | return &state->frontend; |
212 | } | 209 | } |
@@ -226,10 +223,9 @@ struct dvb_frontend* ttusbdecfe_dvbs_attach(const struct ttusbdecfe_config* conf | |||
226 | state->config = config; | 223 | state->config = config; |
227 | state->voltage = 0; | 224 | state->voltage = 0; |
228 | state->hi_band = 0; | 225 | state->hi_band = 0; |
229 | memcpy(&state->ops, &ttusbdecfe_dvbs_ops, sizeof(struct dvb_frontend_ops)); | ||
230 | 226 | ||
231 | /* create dvb_frontend */ | 227 | /* create dvb_frontend */ |
232 | state->frontend.ops = &state->ops; | 228 | memcpy(&state->frontend.ops, &ttusbdecfe_dvbs_ops, sizeof(struct dvb_frontend_ops)); |
233 | state->frontend.demodulator_priv = state; | 229 | state->frontend.demodulator_priv = state; |
234 | return &state->frontend; | 230 | return &state->frontend; |
235 | } | 231 | } |