diff options
author | Patrick Boettcher <pb@linuxtv.org> | 2006-05-14 10:01:31 +0200 |
---|---|---|
committer | Patrick Boettcher <pb@linuxtv.org> | 2006-05-14 10:01:31 +0200 |
commit | d7e9bdcf5053c838a7421c8e52fed2a0bd4644fb (patch) | |
tree | 9e5d14895b19243fdfc53d2344a16d23e0e39586 /linux/drivers/media/dvb/dvb-usb | |
parent | b4179ae5b7a6fe509d2cf6ce601880e82c288d5c (diff) | |
download | mediapointer-dvb-s2-d7e9bdcf5053c838a7421c8e52fed2a0bd4644fb.tar.gz mediapointer-dvb-s2-d7e9bdcf5053c838a7421c8e52fed2a0bd4644fb.tar.bz2 |
Change dvb_frontend_ops to be a real field instead of a pointer field inside dvb_frontend
From: Patrick Boettcher <pb@linuxtv.org>
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>
Diffstat (limited to 'linux/drivers/media/dvb/dvb-usb')
-rw-r--r-- | linux/drivers/media/dvb/dvb-usb/cxusb.c | 12 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-usb/dibusb-common.c | 4 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-usb/dibusb-mb.c | 7 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-usb/digitv.c | 4 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-usb/dtt200u-fe.c | 4 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c | 8 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c | 8 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-usb/umt-010.c | 2 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-usb/vp702x-fe.c | 3 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-usb/vp7045-fe.c | 5 |
10 files changed, 27 insertions, 30 deletions
diff --git a/linux/drivers/media/dvb/dvb-usb/cxusb.c b/linux/drivers/media/dvb/dvb-usb/cxusb.c index f20925579..9004f1dfc 100644 --- a/linux/drivers/media/dvb/dvb-usb/cxusb.c +++ b/linux/drivers/media/dvb/dvb-usb/cxusb.c @@ -360,8 +360,8 @@ static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_device *d) memcpy(d->pll_init, bpll, 4); d->pll_desc = &dvb_pll_fmd1216me; - d->fe->ops->tuner_ops.init = dvb_usb_tuner_init_i2c; - d->fe->ops->tuner_ops.set_params = dvb_usb_tuner_set_params_i2c; + d->fe->ops.tuner_ops.init = dvb_usb_tuner_init_i2c; + d->fe->ops.tuner_ops.set_params = dvb_usb_tuner_set_params_i2c; return 0; } @@ -370,7 +370,7 @@ static int cxusb_dee1601_tuner_attach(struct dvb_usb_device *d) { d->pll_addr = 0x61; d->pll_desc = &dvb_pll_thomson_dtt7579; - d->fe->ops->tuner_ops.calc_regs = dvb_usb_tuner_calc_regs; + d->fe->ops.tuner_ops.calc_regs = dvb_usb_tuner_calc_regs; return 0; } @@ -378,7 +378,7 @@ static int cxusb_lgz201_tuner_attach(struct dvb_usb_device *d) { d->pll_addr = 0x61; d->pll_desc = &dvb_pll_lg_z201; - d->fe->ops->tuner_ops.calc_regs = dvb_usb_tuner_calc_regs; + d->fe->ops.tuner_ops.calc_regs = dvb_usb_tuner_calc_regs; return 0; } @@ -386,13 +386,13 @@ static int cxusb_dtt7579_tuner_attach(struct dvb_usb_device *d) { d->pll_addr = 0x60; d->pll_desc = &dvb_pll_thomson_dtt7579; - d->fe->ops->tuner_ops.calc_regs = dvb_usb_tuner_calc_regs; + d->fe->ops.tuner_ops.calc_regs = dvb_usb_tuner_calc_regs; return 0; } static int cxusb_lgdt3303_tuner_attach(struct dvb_usb_device *d) { - d->fe->ops->tuner_ops.set_params = cxusb_lgh064f_tuner_set_params; + d->fe->ops.tuner_ops.set_params = cxusb_lgh064f_tuner_set_params; return 0; } diff --git a/linux/drivers/media/dvb/dvb-usb/dibusb-common.c b/linux/drivers/media/dvb/dvb-usb/dibusb-common.c index f1c2b31fc..a0676b8ed 100644 --- a/linux/drivers/media/dvb/dvb-usb/dibusb-common.c +++ b/linux/drivers/media/dvb/dvb-usb/dibusb-common.c @@ -188,8 +188,8 @@ int dibusb_dib3000mc_tuner_attach (struct dvb_usb_device *d) d->pll_addr = 0x60; d->pll_desc = &dvb_pll_env57h1xd5; - d->fe->ops->tuner_ops.init = dvb_usb_tuner_init_i2c; - d->fe->ops->tuner_ops.set_params = dvb_usb_tuner_set_params_i2c; + d->fe->ops.tuner_ops.init = dvb_usb_tuner_init_i2c; + d->fe->ops.tuner_ops.set_params = dvb_usb_tuner_set_params_i2c; return 0; } diff --git a/linux/drivers/media/dvb/dvb-usb/dibusb-mb.c b/linux/drivers/media/dvb/dvb-usb/dibusb-mb.c index a7bcb9961..78acd6540 100644 --- a/linux/drivers/media/dvb/dvb-usb/dibusb-mb.c +++ b/linux/drivers/media/dvb/dvb-usb/dibusb-mb.c @@ -20,11 +20,12 @@ static int dibusb_dib3000mb_frontend_attach(struct dvb_usb_device *d) struct dibusb_state *st = d->priv; demod_cfg.demod_address = 0x8; - d->fe->ops->tuner_ops.init = dvb_usb_tuner_init_i2c; - d->fe->ops->tuner_ops.set_params = dvb_usb_tuner_set_params_i2c; - if ((d->fe = dib3000mb_attach(&demod_cfg,&d->i2c_adap,&st->ops)) == NULL) + if ((d->fe = dib3000mb_attach(&demod_cfg,&d->i2c_adap,&st->ops)) == NULL) { + d->fe->ops.tuner_ops.init = dvb_usb_tuner_init_i2c; + d->fe->ops.tuner_ops.set_params = dvb_usb_tuner_set_params_i2c; return -ENODEV; + } d->tuner_pass_ctrl = st->ops.tuner_pass_ctrl; diff --git a/linux/drivers/media/dvb/dvb-usb/digitv.c b/linux/drivers/media/dvb/dvb-usb/digitv.c index 34dbf1a49..9881e2720 100644 --- a/linux/drivers/media/dvb/dvb-usb/digitv.c +++ b/linux/drivers/media/dvb/dvb-usb/digitv.c @@ -129,11 +129,11 @@ static struct nxt6000_config digitv_nxt6000_config = { static int digitv_frontend_attach(struct dvb_usb_device *d) { if ((d->fe = mt352_attach(&digitv_mt352_config, &d->i2c_adap)) != NULL) { - d->fe->ops->tuner_ops.calc_regs = dvb_usb_tuner_calc_regs; + d->fe->ops.tuner_ops.calc_regs = dvb_usb_tuner_calc_regs; return 0; } if ((d->fe = nxt6000_attach(&digitv_nxt6000_config, &d->i2c_adap)) != NULL) { - d->fe->ops->tuner_ops.set_params = digitv_nxt6000_tuner_set_params; + d->fe->ops.tuner_ops.set_params = digitv_nxt6000_tuner_set_params; return 0; } return -EIO; diff --git a/linux/drivers/media/dvb/dvb-usb/dtt200u-fe.c b/linux/drivers/media/dvb/dvb-usb/dtt200u-fe.c index cd21ddbfd..08209564e 100644 --- a/linux/drivers/media/dvb/dvb-usb/dtt200u-fe.c +++ b/linux/drivers/media/dvb/dvb-usb/dtt200u-fe.c @@ -18,7 +18,6 @@ struct dtt200u_fe_state { struct dvb_frontend_parameters fep; struct dvb_frontend frontend; - struct dvb_frontend_ops ops; }; static int dtt200u_fe_read_status(struct dvb_frontend* fe, fe_status_t *stat) @@ -163,9 +162,8 @@ struct dvb_frontend* dtt200u_fe_attach(struct dvb_usb_device *d) deb_info("attaching frontend dtt200u\n"); state->d = d; - memcpy(&state->ops,&dtt200u_fe_ops,sizeof(struct dvb_frontend_ops)); - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops,&dtt200u_fe_ops,sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; goto success; diff --git a/linux/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c b/linux/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c index 500896d02..93e703a03 100644 --- a/linux/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c +++ b/linux/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c @@ -184,13 +184,13 @@ int dvb_usb_fe_init(struct dvb_usb_device* d) /* re-assign sleep and wakeup functions */ if (d->fe != NULL) { - d->fe_init = d->fe->ops->init; d->fe->ops->init = dvb_usb_fe_wakeup; - d->fe_sleep = d->fe->ops->sleep; d->fe->ops->sleep = dvb_usb_fe_sleep; + d->fe_init = d->fe->ops.init; d->fe->ops.init = dvb_usb_fe_wakeup; + d->fe_sleep = d->fe->ops.sleep; d->fe->ops.sleep = dvb_usb_fe_sleep; if (dvb_register_frontend(&d->dvb_adap, d->fe)) { err("Frontend registration failed."); - if (d->fe->ops->release) - d->fe->ops->release(d->fe); + if (d->fe->ops.release) + d->fe->ops.release(d->fe); d->fe = NULL; return -ENODEV; } diff --git a/linux/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c b/linux/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c index 6c868d667..6b611a725 100644 --- a/linux/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c +++ b/linux/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c @@ -63,8 +63,8 @@ int dvb_usb_tuner_init_i2c(struct dvb_frontend *fe) deb_pll("pll-buf: %x %x %x %x\n",d->pll_init[0],d->pll_init[1], d->pll_init[2],d->pll_init[3]); - if (fe->ops->i2c_gate_ctrl) - fe->ops->i2c_gate_ctrl(fe, 1); + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); if (i2c_transfer (&d->i2c_adap, &msg, 1) != 1) { err("tuner i2c write failed for pll_init."); ret = -EREMOTEIO; @@ -109,8 +109,8 @@ int dvb_usb_tuner_set_params_i2c(struct dvb_frontend *fe, struct dvb_frontend_pa if (d->tuner_pass_ctrl) d->tuner_pass_ctrl(fe,1,d->pll_addr); - if (fe->ops->i2c_gate_ctrl) - fe->ops->i2c_gate_ctrl(fe, 1); + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); if (i2c_transfer (&d->i2c_adap, &msg, 1) != 1) { err("tuner i2c write failed for pll_set."); ret = -EREMOTEIO; diff --git a/linux/drivers/media/dvb/dvb-usb/umt-010.c b/linux/drivers/media/dvb/dvb-usb/umt-010.c index 89d52df9e..33343968a 100644 --- a/linux/drivers/media/dvb/dvb-usb/umt-010.c +++ b/linux/drivers/media/dvb/dvb-usb/umt-010.c @@ -67,7 +67,7 @@ static int umt_tuner_attach (struct dvb_usb_device *d) { d->pll_addr = 0x61; d->pll_desc = &dvb_pll_tua6034; - d->fe->ops->tuner_ops.calc_regs = dvb_usb_tuner_calc_regs; + d->fe->ops.tuner_ops.calc_regs = dvb_usb_tuner_calc_regs; return 0; } diff --git a/linux/drivers/media/dvb/dvb-usb/vp702x-fe.c b/linux/drivers/media/dvb/dvb-usb/vp702x-fe.c index 2a89f8c5d..95e41fde2 100644 --- a/linux/drivers/media/dvb/dvb-usb/vp702x-fe.c +++ b/linux/drivers/media/dvb/dvb-usb/vp702x-fe.c @@ -287,7 +287,8 @@ struct dvb_frontend * vp702x_fe_attach(struct dvb_usb_device *d) goto error; s->d = d; - s->fe.ops = &vp702x_fe_ops; + + memcpy(&s->fe.ops,&vp702x_fe_ops,sizeof(struct dvb_frontend_ops)); s->fe.demodulator_priv = s; s->lnb_buf[1] = SET_LNB_POWER; diff --git a/linux/drivers/media/dvb/dvb-usb/vp7045-fe.c b/linux/drivers/media/dvb/dvb-usb/vp7045-fe.c index 9999336ae..2621c4252 100644 --- a/linux/drivers/media/dvb/dvb-usb/vp7045-fe.c +++ b/linux/drivers/media/dvb/dvb-usb/vp7045-fe.c @@ -23,8 +23,6 @@ struct vp7045_fe_state { struct dvb_frontend fe; - struct dvb_frontend_ops ops; - struct dvb_usb_device *d; }; @@ -151,8 +149,7 @@ struct dvb_frontend * vp7045_fe_attach(struct dvb_usb_device *d) goto error; s->d = d; - memcpy(&s->ops, &vp7045_fe_ops, sizeof(struct dvb_frontend_ops)); - s->fe.ops = &s->ops; + memcpy(&s->fe.ops, &vp7045_fe_ops, sizeof(struct dvb_frontend_ops)); s->fe.demodulator_priv = s; goto success; |