diff options
author | Antti Palosaari <crope@iki.fi> | 2012-06-16 15:02:57 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-08-04 06:56:34 -0400 |
commit | 6400a8c5afb54a1018c4d01b7f1ad28c4e0ef659 (patch) | |
tree | 52e52fd37e8c2b14cda64099631818376d226be3 /drivers/media/dvb | |
parent | 12077a3aa4bfc1fb5ca779dcc6b3a1f45a475736 (diff) |
[media] dvb_usb_v2: change USB stream config logic
Initial / default USB stream configuration is now set always as a
dvb_usb_device_properties. Dynamic configuration is done top of
that if callback .get_usb_stream_config() exists. Default values
are set when callback is called so callback needs only change
values that are different than default.
In addition of that define two macros DVB_USB_STREAM_BULK() and
DVB_USB_STREAM_ISOC() for filling struct usb_data_stream_properties
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r-- | drivers/media/dvb/dvb-usb/dvb_usb_common.h | 2 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dvb_usb_dvb.c | 21 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/usb_urb.c | 2 |
3 files changed, 8 insertions, 17 deletions
diff --git a/drivers/media/dvb/dvb-usb/dvb_usb_common.h b/drivers/media/dvb/dvb-usb/dvb_usb_common.h index e1cff154c0ec..c94a900c3264 100644 --- a/drivers/media/dvb/dvb-usb/dvb_usb_common.h +++ b/drivers/media/dvb/dvb-usb/dvb_usb_common.h | |||
@@ -17,7 +17,7 @@ extern int dvb_usbv2_disable_rc_polling; | |||
17 | extern int dvb_usbv2_device_power_ctrl(struct dvb_usb_device *d, int onoff); | 17 | extern int dvb_usbv2_device_power_ctrl(struct dvb_usb_device *d, int onoff); |
18 | 18 | ||
19 | extern int usb_urb_initv2(struct usb_data_stream *stream, | 19 | extern int usb_urb_initv2(struct usb_data_stream *stream, |
20 | struct usb_data_stream_properties *props); | 20 | const struct usb_data_stream_properties *props); |
21 | extern int usb_urb_exitv2(struct usb_data_stream *stream); | 21 | extern int usb_urb_exitv2(struct usb_data_stream *stream); |
22 | extern int usb_urb_submitv2(struct usb_data_stream *stream, | 22 | extern int usb_urb_submitv2(struct usb_data_stream *stream, |
23 | struct usb_data_stream_properties *props); | 23 | struct usb_data_stream_properties *props); |
diff --git a/drivers/media/dvb/dvb-usb/dvb_usb_dvb.c b/drivers/media/dvb/dvb-usb/dvb_usb_dvb.c index 3cbae02ea51e..484114cbd0ba 100644 --- a/drivers/media/dvb/dvb-usb/dvb_usb_dvb.c +++ b/drivers/media/dvb/dvb-usb/dvb_usb_dvb.c | |||
@@ -34,31 +34,20 @@ static void dvb_usb_data_complete_raw(struct usb_data_stream *stream, | |||
34 | 34 | ||
35 | int dvb_usbv2_adapter_stream_init(struct dvb_usb_adapter *adap) | 35 | int dvb_usbv2_adapter_stream_init(struct dvb_usb_adapter *adap) |
36 | { | 36 | { |
37 | int ret; | 37 | pr_debug("%s: adap=%d\n", __func__, adap->id); |
38 | struct usb_data_stream_properties stream_props; | ||
39 | 38 | ||
40 | adap->stream.udev = adap->dev->udev; | 39 | adap->stream.udev = adap->dev->udev; |
41 | adap->stream.user_priv = adap; | 40 | adap->stream.user_priv = adap; |
42 | |||
43 | /* resolve USB stream configuration for buffer alloc */ | ||
44 | if (adap->dev->props->get_usb_stream_config) { | ||
45 | ret = adap->dev->props->get_usb_stream_config(NULL, | ||
46 | &stream_props); | ||
47 | if (ret < 0) | ||
48 | return ret; | ||
49 | } else { | ||
50 | stream_props = adap->props->stream; | ||
51 | } | ||
52 | |||
53 | /* FIXME: can be removed as set later in anyway */ | ||
54 | adap->stream.complete = dvb_usb_data_complete; | 41 | adap->stream.complete = dvb_usb_data_complete; |
55 | 42 | ||
56 | return usb_urb_initv2(&adap->stream, &stream_props); | 43 | return usb_urb_initv2(&adap->stream, &adap->props->stream); |
57 | } | 44 | } |
58 | 45 | ||
59 | int dvb_usbv2_adapter_stream_exit(struct dvb_usb_adapter *adap) | 46 | int dvb_usbv2_adapter_stream_exit(struct dvb_usb_adapter *adap) |
60 | { | 47 | { |
48 | pr_debug("%s: adap=%d\n", __func__, adap->id); | ||
61 | usb_urb_exitv2(&adap->stream); | 49 | usb_urb_exitv2(&adap->stream); |
50 | |||
62 | return 0; | 51 | return 0; |
63 | } | 52 | } |
64 | 53 | ||
@@ -133,6 +122,8 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff) | |||
133 | 122 | ||
134 | /* resolve USB stream configuration */ | 123 | /* resolve USB stream configuration */ |
135 | if (adap->dev->props->get_usb_stream_config) { | 124 | if (adap->dev->props->get_usb_stream_config) { |
125 | memcpy(&stream_props, &adap->props->stream, | ||
126 | sizeof(struct usb_data_stream_properties)); | ||
136 | ret = adap->dev->props->get_usb_stream_config( | 127 | ret = adap->dev->props->get_usb_stream_config( |
137 | adap->fe[adap->active_fe], | 128 | adap->fe[adap->active_fe], |
138 | &stream_props); | 129 | &stream_props); |
diff --git a/drivers/media/dvb/dvb-usb/usb_urb.c b/drivers/media/dvb/dvb-usb/usb_urb.c index 16e9fa03c847..32e80be2168d 100644 --- a/drivers/media/dvb/dvb-usb/usb_urb.c +++ b/drivers/media/dvb/dvb-usb/usb_urb.c | |||
@@ -306,7 +306,7 @@ int usb_urb_reconfig(struct usb_data_stream *stream, | |||
306 | } | 306 | } |
307 | 307 | ||
308 | int usb_urb_initv2(struct usb_data_stream *stream, | 308 | int usb_urb_initv2(struct usb_data_stream *stream, |
309 | struct usb_data_stream_properties *props) | 309 | const struct usb_data_stream_properties *props) |
310 | { | 310 | { |
311 | int ret; | 311 | int ret; |
312 | 312 | ||