]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
[media] dvb_usb_v2: move (struct usb_data_stream) to one level up
authorAntti Palosaari <crope@iki.fi>
Tue, 29 May 2012 00:34:15 +0000 (21:34 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 4 Aug 2012 10:56:23 +0000 (07:56 -0300)
Move stream from the frontend to adapter. There could be only
one stream per adapter. One adapter can has multiple frontends
but only one can stream at the time.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/dvb-usb/dvb_usb.h
drivers/media/dvb/dvb-usb/dvb_usb_dvb.c
drivers/media/dvb/dvb-usb/dvb_usb_urb.c

index 49df6fbeb1ad1c9b1fc6b88992f18e5e95dfb9aa..08d148b23c718d35669fce5816b8369b298ed9ac 100644 (file)
@@ -314,8 +314,6 @@ struct dvb_usb_fe_adapter {
        int (*fe_init)  (struct dvb_frontend *);
        int (*fe_sleep) (struct dvb_frontend *);
 
-       struct usb_data_stream stream;
-
        int pid_filtering;
        int max_feed_count;
 
@@ -325,6 +323,7 @@ struct dvb_usb_fe_adapter {
 struct dvb_usb_adapter {
        struct dvb_usb_device *dev;
        struct dvb_usb_adapter_properties props;
+       struct usb_data_stream stream;
 
 #define DVB_USB_ADAP_STATE_INIT 0x000
 #define DVB_USB_ADAP_STATE_DVB  0x001
index 9ada473773d565e11c19b90c59712e9a3e580a5b..841b2d9a40584bd31f6a555d3b31ead47e28e749 100644 (file)
@@ -27,7 +27,7 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)
        /* stop feed before setting a new pid if there will be no pid anymore */
        if (newfeedcount == 0) {
                deb_ts("stop feeding\n");
-               usb_urb_kill(&adap->fe_adap[adap->active_fe].stream);
+               usb_urb_kill(&adap->stream);
 
                if (adap->props.fe[adap->active_fe].streaming_ctrl != NULL) {
                        ret = adap->props.fe[adap->active_fe].streaming_ctrl(
@@ -70,8 +70,7 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)
                }
 
                deb_ts("submitting all URBs\n");
-               usb_urb_submit(&adap->fe_adap[adap->active_fe].stream,
-                               &stream_props);
+               usb_urb_submit(&adap->stream, &stream_props);
 
                deb_ts("controlling pid parser\n");
                if (adap->props.fe[adap->active_fe].caps & DVB_USB_ADAP_HAS_PID_FILTER &&
index 903f77afb1425ffb1d54f664e59ee137a2988277..8200e0983f07c876487a1ed5904f8280fdb62238 100644 (file)
@@ -93,43 +93,39 @@ static void dvb_usb_data_complete_raw(struct usb_data_stream *stream,
 
 int dvb_usb_adapter_stream_init(struct dvb_usb_adapter *adap)
 {
-       int i, ret = 0;
+       int ret;
        struct usb_data_stream_properties stream_props;
 
-       for (i = 0; i < adap->props.num_frontends; i++) {
-               adap->fe_adap[i].stream.udev      = adap->dev->udev;
-               if (adap->props.fe[i].caps & DVB_USB_ADAP_RECEIVES_204_BYTE_TS)
-                       adap->fe_adap[i].stream.complete =
-                               dvb_usb_data_complete_204;
-               else
-               if (adap->props.fe[i].caps & DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD)
-                       adap->fe_adap[i].stream.complete =
-                               dvb_usb_data_complete_raw;
-               else
-               adap->fe_adap[i].stream.complete  = dvb_usb_data_complete;
-               adap->fe_adap[i].stream.user_priv = adap;
-
-               /* resolve USB stream configuration */
-               if (adap->dev->props.get_usb_stream_config) {
-                       ret = adap->dev->props.get_usb_stream_config(NULL,
-                                       &stream_props);
-                       if (ret < 0)
-                               break;
-               } else {
-                       stream_props = adap->props.fe[i].stream;
-               }
+       /*
+        * FIXME: We should config demux callback for each time streaming is
+        * started. Same for the USB data stream config.
+        */
+
+       adap->stream.udev = adap->dev->udev;
+       if (adap->props.fe[0].caps & DVB_USB_ADAP_RECEIVES_204_BYTE_TS)
+               adap->stream.complete = dvb_usb_data_complete_204;
+       else if (adap->props.fe[0].caps & DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD)
+               adap->stream.complete = dvb_usb_data_complete_raw;
+       else
+               adap->stream.complete = dvb_usb_data_complete;
 
-               ret = usb_urb_init(&adap->fe_adap[i].stream, &stream_props);
+       adap->stream.user_priv = adap;
+
+       /* resolve USB stream configuration */
+       if (adap->dev->props.get_usb_stream_config) {
+               ret = adap->dev->props.get_usb_stream_config(NULL,
+                               &stream_props);
                if (ret < 0)
-                       break;
+                       return ret;
+       } else {
+               stream_props = adap->props.fe[0].stream;
        }
-       return ret;
+
+       return usb_urb_init(&adap->stream, &stream_props);
 }
 
 int dvb_usb_adapter_stream_exit(struct dvb_usb_adapter *adap)
 {
-       int i;
-       for (i = 0; i < adap->props.num_frontends; i++)
-               usb_urb_exit(&adap->fe_adap[i].stream);
+       usb_urb_exit(&adap->stream);
        return 0;
 }