From dea74869f3c62b0b7addd67017b22b394e942aac Mon Sep 17 00:00:00 2001 From: Patrick Boettcher Date: Sun, 14 May 2006 05:01:31 -0300 Subject: 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 Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/dib3000mc.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'drivers/media/dvb/frontends/dib3000mc.c') diff --git a/drivers/media/dvb/frontends/dib3000mc.c b/drivers/media/dvb/frontends/dib3000mc.c index 68a443b3d50..6c3be252998 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, int search_state,auto_val; u16 val; - if (tuner && fe->ops->tuner_ops.set_params) { /* initial call from dvb */ - fe->ops->tuner_ops.set_params(fe, fep); - if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + if (tuner && fe->ops.tuner_ops.set_params) { /* initial call from dvb */ + fe->ops.tuner_ops.set_params(fe, fep); + if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); state->last_tuned_freq = fep->frequency; // if (!scanboost) { @@ -837,7 +837,6 @@ struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config, /* setup the state */ state->i2c = i2c; memcpy(&state->config,config,sizeof(struct dib3000_config)); - memcpy(&state->ops, &dib3000mc_ops, sizeof(struct dvb_frontend_ops)); /* check for the correct demod */ if (rd(DIB3000_REG_MANUFACTOR_ID) != DIB3000_I2C_ID_DIBCOM) @@ -857,7 +856,7 @@ struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config, } /* create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &dib3000mc_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; /* set the xfer operations */ @@ -874,6 +873,7 @@ error: kfree(state); return NULL; } +EXPORT_SYMBOL(dib3000mc_attach); static struct dvb_frontend_ops dib3000mc_ops = { @@ -912,5 +912,3 @@ static struct dvb_frontend_ops dib3000mc_ops = { MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); - -EXPORT_SYMBOL(dib3000mc_attach); -- cgit v1.2.3