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/bt8xx/dst.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/bt8xx/dst.c')
-rw-r--r-- | drivers/media/dvb/bt8xx/dst.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/media/dvb/bt8xx/dst.c b/drivers/media/dvb/bt8xx/dst.c index 1cfa5e5035d8..b2018b5a405b 100644 --- a/drivers/media/dvb/bt8xx/dst.c +++ b/drivers/media/dvb/bt8xx/dst.c | |||
@@ -1417,24 +1417,22 @@ struct dst_state *dst_attach(struct dst_state *state, struct dvb_adapter *dvb_ad | |||
1417 | return NULL; | 1417 | return NULL; |
1418 | } | 1418 | } |
1419 | /* determine settings based on type */ | 1419 | /* determine settings based on type */ |
1420 | /* create dvb_frontend */ | ||
1420 | switch (state->dst_type) { | 1421 | switch (state->dst_type) { |
1421 | case DST_TYPE_IS_TERR: | 1422 | case DST_TYPE_IS_TERR: |
1422 | memcpy(&state->ops, &dst_dvbt_ops, sizeof(struct dvb_frontend_ops)); | 1423 | memcpy(&state->frontend.ops, &dst_dvbt_ops, sizeof(struct dvb_frontend_ops)); |
1423 | break; | 1424 | break; |
1424 | case DST_TYPE_IS_CABLE: | 1425 | case DST_TYPE_IS_CABLE: |
1425 | memcpy(&state->ops, &dst_dvbc_ops, sizeof(struct dvb_frontend_ops)); | 1426 | memcpy(&state->frontend.ops, &dst_dvbc_ops, sizeof(struct dvb_frontend_ops)); |
1426 | break; | 1427 | break; |
1427 | case DST_TYPE_IS_SAT: | 1428 | case DST_TYPE_IS_SAT: |
1428 | memcpy(&state->ops, &dst_dvbs_ops, sizeof(struct dvb_frontend_ops)); | 1429 | memcpy(&state->frontend.ops, &dst_dvbs_ops, sizeof(struct dvb_frontend_ops)); |
1429 | break; | 1430 | break; |
1430 | default: | 1431 | default: |
1431 | dprintk(verbose, DST_ERROR, 1, "unknown DST type. please report to the LinuxTV.org DVB mailinglist."); | 1432 | dprintk(verbose, DST_ERROR, 1, "unknown DST type. please report to the LinuxTV.org DVB mailinglist."); |
1432 | kfree(state); | 1433 | kfree(state); |
1433 | return NULL; | 1434 | return NULL; |
1434 | } | 1435 | } |
1435 | |||
1436 | /* create dvb_frontend */ | ||
1437 | state->frontend.ops = &state->ops; | ||
1438 | state->frontend.demodulator_priv = state; | 1436 | state->frontend.demodulator_priv = state; |
1439 | 1437 | ||
1440 | return state; /* Manu (DST is a card not a frontend) */ | 1438 | return state; /* Manu (DST is a card not a frontend) */ |