From: Antti Palosaari Date: Tue, 29 May 2012 00:34:15 +0000 (-0300) Subject: [media] dvb_usb_v2: move (struct usb_data_stream) to one level up X-Git-Tag: firefly_0821_release~3680^2~275^2~1695 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3256cdef6ea09776e587b23240b74ead733fb11c;p=firefly-linux-kernel-4.4.55.git [media] dvb_usb_v2: move (struct usb_data_stream) to one level up 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 Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/dvb/dvb-usb/dvb_usb.h b/drivers/media/dvb/dvb-usb/dvb_usb.h index 49df6fbeb1ad..08d148b23c71 100644 --- a/drivers/media/dvb/dvb-usb/dvb_usb.h +++ b/drivers/media/dvb/dvb-usb/dvb_usb.h @@ -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 diff --git a/drivers/media/dvb/dvb-usb/dvb_usb_dvb.c b/drivers/media/dvb/dvb-usb/dvb_usb_dvb.c index 9ada473773d5..841b2d9a4058 100644 --- a/drivers/media/dvb/dvb-usb/dvb_usb_dvb.c +++ b/drivers/media/dvb/dvb-usb/dvb_usb_dvb.c @@ -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 && diff --git a/drivers/media/dvb/dvb-usb/dvb_usb_urb.c b/drivers/media/dvb/dvb-usb/dvb_usb_urb.c index 903f77afb142..8200e0983f07 100644 --- a/drivers/media/dvb/dvb-usb/dvb_usb_urb.c +++ b/drivers/media/dvb/dvb-usb/dvb_usb_urb.c @@ -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; }