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/frontends/dib3000mc.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/frontends/dib3000mc.c')
-rw-r--r-- | drivers/media/dvb/frontends/dib3000mc.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/media/dvb/frontends/dib3000mc.c b/drivers/media/dvb/frontends/dib3000mc.c index 68a443b3d504..6c3be2529980 100644 --- a/drivers/media/dvb/frontends/dib3000mc.c +++ b/drivers/media/dvb/frontends/dib3000mc.c | |||
@@ -462,9 +462,9 @@ static int dib3000mc_set_frontend(struct dvb_frontend* fe, | |||
462 | int search_state,auto_val; | 462 | int search_state,auto_val; |
463 | u16 val; | 463 | u16 val; |
464 | 464 | ||
465 | if (tuner && fe->ops->tuner_ops.set_params) { /* initial call from dvb */ | 465 | if (tuner && fe->ops.tuner_ops.set_params) { /* initial call from dvb */ |
466 | fe->ops->tuner_ops.set_params(fe, fep); | 466 | fe->ops.tuner_ops.set_params(fe, fep); |
467 | if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); | 467 | if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); |
468 | 468 | ||
469 | state->last_tuned_freq = fep->frequency; | 469 | state->last_tuned_freq = fep->frequency; |
470 | // if (!scanboost) { | 470 | // if (!scanboost) { |
@@ -837,7 +837,6 @@ struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config, | |||
837 | /* setup the state */ | 837 | /* setup the state */ |
838 | state->i2c = i2c; | 838 | state->i2c = i2c; |
839 | memcpy(&state->config,config,sizeof(struct dib3000_config)); | 839 | memcpy(&state->config,config,sizeof(struct dib3000_config)); |
840 | memcpy(&state->ops, &dib3000mc_ops, sizeof(struct dvb_frontend_ops)); | ||
841 | 840 | ||
842 | /* check for the correct demod */ | 841 | /* check for the correct demod */ |
843 | if (rd(DIB3000_REG_MANUFACTOR_ID) != DIB3000_I2C_ID_DIBCOM) | 842 | if (rd(DIB3000_REG_MANUFACTOR_ID) != DIB3000_I2C_ID_DIBCOM) |
@@ -857,7 +856,7 @@ struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config, | |||
857 | } | 856 | } |
858 | 857 | ||
859 | /* create dvb_frontend */ | 858 | /* create dvb_frontend */ |
860 | state->frontend.ops = &state->ops; | 859 | memcpy(&state->frontend.ops, &dib3000mc_ops, sizeof(struct dvb_frontend_ops)); |
861 | state->frontend.demodulator_priv = state; | 860 | state->frontend.demodulator_priv = state; |
862 | 861 | ||
863 | /* set the xfer operations */ | 862 | /* set the xfer operations */ |
@@ -874,6 +873,7 @@ error: | |||
874 | kfree(state); | 873 | kfree(state); |
875 | return NULL; | 874 | return NULL; |
876 | } | 875 | } |
876 | EXPORT_SYMBOL(dib3000mc_attach); | ||
877 | 877 | ||
878 | static struct dvb_frontend_ops dib3000mc_ops = { | 878 | static struct dvb_frontend_ops dib3000mc_ops = { |
879 | 879 | ||
@@ -912,5 +912,3 @@ static struct dvb_frontend_ops dib3000mc_ops = { | |||
912 | MODULE_AUTHOR(DRIVER_AUTHOR); | 912 | MODULE_AUTHOR(DRIVER_AUTHOR); |
913 | MODULE_DESCRIPTION(DRIVER_DESC); | 913 | MODULE_DESCRIPTION(DRIVER_DESC); |
914 | MODULE_LICENSE("GPL"); | 914 | MODULE_LICENSE("GPL"); |
915 | |||
916 | EXPORT_SYMBOL(dib3000mc_attach); | ||