[media] dvb_usb_v2: move few callbacks one level up
authorAntti Palosaari <crope@iki.fi>
Tue, 12 Jun 2012 04:05:20 +0000 (01:05 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 4 Aug 2012 10:56:30 +0000 (07:56 -0300)
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>
drivers/media/dvb/dvb-usb/af9015.c
drivers/media/dvb/dvb-usb/dvb_usb.h
drivers/media/dvb/dvb-usb/dvb_usb_dvb.c

index 9d0bd9bed7399f3261bce9948a7056e14e2a4260..73ff4bbb89ce09909b49b707070856310bbebfec 100644 (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,
 };
index 7e4832664f5dfb59b11a3511de253d4690376c75..fd6237a3a4ceea4bdda29e035ebd80e1e4553c46 100644 (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
index a08d879fd177caf4b1e4aa05987a4ecafe66b9fc..11ac592270fe07508d171cdb6b3d9f22f472daa3 100644 (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);