Commit 2d2b37c7 authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab

[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: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent b00a9018
...@@ -1319,8 +1319,10 @@ static struct dvb_usb_device_properties af9015_props = { ...@@ -1319,8 +1319,10 @@ static struct dvb_usb_device_properties af9015_props = {
.firmware = "dvb-usb-af9015.fw", .firmware = "dvb-usb-af9015.fw",
.download_firmware = af9015_download_firmware, .download_firmware = af9015_download_firmware,
.read_config = af9015_read_config,
.i2c_algo = &af9015_i2c_algo, .i2c_algo = &af9015_i2c_algo,
.read_config = af9015_read_config,
.frontend_attach = af9015_af9013_frontend_attach,
.tuner_attach = af9015_tuner_attach,
.init = af9015_init, .init = af9015_init,
.get_rc_config = af9015_get_rc_config, .get_rc_config = af9015_get_rc_config,
.get_usb_stream_config = af9015_get_usb_stream_config, .get_usb_stream_config = af9015_get_usb_stream_config,
...@@ -1333,13 +1335,7 @@ static struct dvb_usb_device_properties af9015_props = { ...@@ -1333,13 +1335,7 @@ static struct dvb_usb_device_properties af9015_props = {
.pid_filter_count = 32, .pid_filter_count = 32,
.pid_filter = af9015_pid_filter, .pid_filter = af9015_pid_filter,
.pid_filter_ctrl = af9015_pid_filter_ctrl, .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); ...@@ -1427,9 +1423,9 @@ MODULE_DEVICE_TABLE(usb, af9015_id_table);
/* usb specific object needed to register this driver with the usb subsystem */ /* usb specific object needed to register this driver with the usb subsystem */
static struct usb_driver af9015_usb_driver = { static struct usb_driver af9015_usb_driver = {
.name = KBUILD_MODNAME, .name = KBUILD_MODNAME,
.id_table = af9015_id_table,
.probe = dvb_usbv2_probe, .probe = dvb_usbv2_probe,
.disconnect = dvb_usbv2_disconnect, .disconnect = dvb_usbv2_disconnect,
.id_table = af9015_id_table,
.no_dynamic_id = 1, .no_dynamic_id = 1,
.soft_unbind = 1, .soft_unbind = 1,
}; };
......
...@@ -100,10 +100,6 @@ struct dvb_usb_adapter_properties { ...@@ -100,10 +100,6 @@ struct dvb_usb_adapter_properties {
int (*pid_filter_ctrl) (struct dvb_usb_adapter *, int); int (*pid_filter_ctrl) (struct dvb_usb_adapter *, int);
int (*pid_filter) (struct dvb_usb_adapter *, int, u16, 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 *, int (*fe_ioctl_override) (struct dvb_frontend *,
unsigned int, void *, unsigned int); unsigned int, void *, unsigned int);
...@@ -189,7 +185,10 @@ struct dvb_usb_device_properties { ...@@ -189,7 +185,10 @@ struct dvb_usb_device_properties {
int (*power_ctrl) (struct dvb_usb_device *, int); int (*power_ctrl) (struct dvb_usb_device *, int);
int (*read_config) (struct dvb_usb_device *d); int (*read_config) (struct dvb_usb_device *d);
int (*read_mac_address) (struct dvb_usb_device *, u8 []); 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 WARM 0
#define COLD 1 #define COLD 1
......
...@@ -80,8 +80,8 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff) ...@@ -80,8 +80,8 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)
pr_debug("%s: stop feeding\n", __func__); pr_debug("%s: stop feeding\n", __func__);
usb_urb_killv2(&adap->stream); usb_urb_killv2(&adap->stream);
if (adap->props.streaming_ctrl != NULL) { if (adap->dev->props.streaming_ctrl != NULL) {
ret = adap->props.streaming_ctrl(adap, 0); ret = adap->dev->props.streaming_ctrl(adap, 0);
if (ret < 0) { if (ret < 0) {
pr_err("%s: error while stopping stream\n", pr_err("%s: error while stopping stream\n",
KBUILD_MODNAME); KBUILD_MODNAME);
...@@ -157,8 +157,8 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff) ...@@ -157,8 +157,8 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)
} }
} }
pr_debug("%s: start feeding\n", __func__); pr_debug("%s: start feeding\n", __func__);
if (adap->props.streaming_ctrl != NULL) { if (adap->dev->props.streaming_ctrl != NULL) {
ret = adap->props.streaming_ctrl(adap, 1); ret = adap->dev->props.streaming_ctrl(adap, 1);
if (ret < 0) { if (ret < 0) {
pr_err("%s: error while enabling fifo\n", pr_err("%s: error while enabling fifo\n",
KBUILD_MODNAME); KBUILD_MODNAME);
...@@ -279,8 +279,8 @@ static int dvb_usb_fe_wakeup(struct dvb_frontend *fe) ...@@ -279,8 +279,8 @@ static int dvb_usb_fe_wakeup(struct dvb_frontend *fe)
if (ret < 0) if (ret < 0)
goto err; goto err;
if (adap->props.frontend_ctrl) { if (adap->dev->props.frontend_ctrl) {
ret = adap->props.frontend_ctrl(fe, 1); ret = adap->dev->props.frontend_ctrl(fe, 1);
if (ret < 0) if (ret < 0)
goto err; goto err;
} }
...@@ -310,8 +310,8 @@ static int dvb_usb_fe_sleep(struct dvb_frontend *fe) ...@@ -310,8 +310,8 @@ static int dvb_usb_fe_sleep(struct dvb_frontend *fe)
goto err; goto err;
} }
if (adap->props.frontend_ctrl) { if (adap->dev->props.frontend_ctrl) {
ret = adap->props.frontend_ctrl(fe, 0); ret = adap->dev->props.frontend_ctrl(fe, 0);
if (ret < 0) if (ret < 0)
goto err; goto err;
} }
...@@ -337,8 +337,8 @@ int dvb_usbv2_adapter_frontend_init(struct dvb_usb_adapter *adap) ...@@ -337,8 +337,8 @@ int dvb_usbv2_adapter_frontend_init(struct dvb_usb_adapter *adap)
memset(adap->fe, 0, sizeof(adap->fe)); memset(adap->fe, 0, sizeof(adap->fe));
adap->active_fe = -1; adap->active_fe = -1;
if (adap->props.frontend_attach) { if (adap->dev->props.frontend_attach) {
ret = adap->props.frontend_attach(adap); ret = adap->dev->props.frontend_attach(adap);
if (ret < 0) { if (ret < 0) {
pr_debug("%s: frontend_attach() failed=%d\n", __func__, pr_debug("%s: frontend_attach() failed=%d\n", __func__,
ret); ret);
...@@ -350,8 +350,8 @@ int dvb_usbv2_adapter_frontend_init(struct dvb_usb_adapter *adap) ...@@ -350,8 +350,8 @@ int dvb_usbv2_adapter_frontend_init(struct dvb_usb_adapter *adap)
goto err; goto err;
} }
if (adap->props.tuner_attach) { if (adap->dev->props.tuner_attach) {
ret = adap->props.tuner_attach(adap); ret = adap->dev->props.tuner_attach(adap);
if (ret < 0) { if (ret < 0) {
pr_debug("%s: tuner_attach() failed=%d\n", __func__, pr_debug("%s: tuner_attach() failed=%d\n", __func__,
ret); ret);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment