[media] dvb_usb_v2: move few callbacks one level up

Move frontend_attach, tuner_attach, frontend_ctrl and streaming_ctrl
from adapter to device.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Antti Palosaari 2012-06-12 01:05:20 -03:00 committed by Mauro Carvalho Chehab
parent b00a901801
commit 2d2b37c75a
3 changed files with 20 additions and 25 deletions

View file

@ -1319,8 +1319,10 @@ static struct dvb_usb_device_properties af9015_props = {
.firmware = "dvb-usb-af9015.fw",
.download_firmware = af9015_download_firmware,
.read_config = af9015_read_config,
.i2c_algo = &af9015_i2c_algo,
.read_config = af9015_read_config,
.frontend_attach = af9015_af9013_frontend_attach,
.tuner_attach = af9015_tuner_attach,
.init = af9015_init,
.get_rc_config = af9015_get_rc_config,
.get_usb_stream_config = af9015_get_usb_stream_config,
@ -1333,13 +1335,7 @@ static struct dvb_usb_device_properties af9015_props = {
.pid_filter_count = 32,
.pid_filter = af9015_pid_filter,
.pid_filter_ctrl = af9015_pid_filter_ctrl,
.frontend_attach = af9015_af9013_frontend_attach,
.tuner_attach = af9015_tuner_attach,
},
{
.frontend_attach = af9015_af9013_frontend_attach,
.tuner_attach = af9015_tuner_attach,
}
},
};
@ -1427,9 +1423,9 @@ MODULE_DEVICE_TABLE(usb, af9015_id_table);
/* usb specific object needed to register this driver with the usb subsystem */
static struct usb_driver af9015_usb_driver = {
.name = KBUILD_MODNAME,
.id_table = af9015_id_table,
.probe = dvb_usbv2_probe,
.disconnect = dvb_usbv2_disconnect,
.id_table = af9015_id_table,
.no_dynamic_id = 1,
.soft_unbind = 1,
};

View file

@ -100,10 +100,6 @@ struct dvb_usb_adapter_properties {
int (*pid_filter_ctrl) (struct dvb_usb_adapter *, int);
int (*pid_filter) (struct dvb_usb_adapter *, int, u16, int);
int (*frontend_attach) (struct dvb_usb_adapter *);
int (*tuner_attach) (struct dvb_usb_adapter *);
int (*frontend_ctrl) (struct dvb_frontend *, int);
int (*streaming_ctrl) (struct dvb_usb_adapter *, int);
int (*fe_ioctl_override) (struct dvb_frontend *,
unsigned int, void *, unsigned int);
@ -189,7 +185,10 @@ struct dvb_usb_device_properties {
int (*power_ctrl) (struct dvb_usb_device *, int);
int (*read_config) (struct dvb_usb_device *d);
int (*read_mac_address) (struct dvb_usb_device *, u8 []);
int (*tuner_attach) (struct dvb_frontend *);
int (*frontend_attach) (struct dvb_usb_adapter *);
int (*tuner_attach) (struct dvb_usb_adapter *);
int (*frontend_ctrl) (struct dvb_frontend *, int);
int (*streaming_ctrl) (struct dvb_usb_adapter *, int);
#define WARM 0
#define COLD 1

View file

@ -80,8 +80,8 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)
pr_debug("%s: stop feeding\n", __func__);
usb_urb_killv2(&adap->stream);
if (adap->props.streaming_ctrl != NULL) {
ret = adap->props.streaming_ctrl(adap, 0);
if (adap->dev->props.streaming_ctrl != NULL) {
ret = adap->dev->props.streaming_ctrl(adap, 0);
if (ret < 0) {
pr_err("%s: error while stopping stream\n",
KBUILD_MODNAME);
@ -157,8 +157,8 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)
}
}
pr_debug("%s: start feeding\n", __func__);
if (adap->props.streaming_ctrl != NULL) {
ret = adap->props.streaming_ctrl(adap, 1);
if (adap->dev->props.streaming_ctrl != NULL) {
ret = adap->dev->props.streaming_ctrl(adap, 1);
if (ret < 0) {
pr_err("%s: error while enabling fifo\n",
KBUILD_MODNAME);
@ -279,8 +279,8 @@ static int dvb_usb_fe_wakeup(struct dvb_frontend *fe)
if (ret < 0)
goto err;
if (adap->props.frontend_ctrl) {
ret = adap->props.frontend_ctrl(fe, 1);
if (adap->dev->props.frontend_ctrl) {
ret = adap->dev->props.frontend_ctrl(fe, 1);
if (ret < 0)
goto err;
}
@ -310,8 +310,8 @@ static int dvb_usb_fe_sleep(struct dvb_frontend *fe)
goto err;
}
if (adap->props.frontend_ctrl) {
ret = adap->props.frontend_ctrl(fe, 0);
if (adap->dev->props.frontend_ctrl) {
ret = adap->dev->props.frontend_ctrl(fe, 0);
if (ret < 0)
goto err;
}
@ -337,8 +337,8 @@ int dvb_usbv2_adapter_frontend_init(struct dvb_usb_adapter *adap)
memset(adap->fe, 0, sizeof(adap->fe));
adap->active_fe = -1;
if (adap->props.frontend_attach) {
ret = adap->props.frontend_attach(adap);
if (adap->dev->props.frontend_attach) {
ret = adap->dev->props.frontend_attach(adap);
if (ret < 0) {
pr_debug("%s: frontend_attach() failed=%d\n", __func__,
ret);
@ -350,8 +350,8 @@ int dvb_usbv2_adapter_frontend_init(struct dvb_usb_adapter *adap)
goto err;
}
if (adap->props.tuner_attach) {
ret = adap->props.tuner_attach(adap);
if (adap->dev->props.tuner_attach) {
ret = adap->dev->props.tuner_attach(adap);
if (ret < 0) {
pr_debug("%s: tuner_attach() failed=%d\n", __func__,
ret);