Skip to content

Commit

Permalink
[media] dvb_usb_v2: change USB stream config logic
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Antti Palosaari authored and Mauro Carvalho Chehab committed Aug 4, 2012
1 parent 12077a3 commit 6400a8c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
2 changes: 1 addition & 1 deletion drivers/media/dvb/dvb-usb/dvb_usb_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ extern int dvb_usbv2_disable_rc_polling;
extern int dvb_usbv2_device_power_ctrl(struct dvb_usb_device *d, int onoff);

extern int usb_urb_initv2(struct usb_data_stream *stream,
struct usb_data_stream_properties *props);
const struct usb_data_stream_properties *props);
extern int usb_urb_exitv2(struct usb_data_stream *stream);
extern int usb_urb_submitv2(struct usb_data_stream *stream,
struct usb_data_stream_properties *props);
Expand Down
21 changes: 6 additions & 15 deletions drivers/media/dvb/dvb-usb/dvb_usb_dvb.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,31 +34,20 @@ static void dvb_usb_data_complete_raw(struct usb_data_stream *stream,

int dvb_usbv2_adapter_stream_init(struct dvb_usb_adapter *adap)
{
int ret;
struct usb_data_stream_properties stream_props;
pr_debug("%s: adap=%d\n", __func__, adap->id);

adap->stream.udev = adap->dev->udev;
adap->stream.user_priv = adap;

/* resolve USB stream configuration for buffer alloc */
if (adap->dev->props->get_usb_stream_config) {
ret = adap->dev->props->get_usb_stream_config(NULL,
&stream_props);
if (ret < 0)
return ret;
} else {
stream_props = adap->props->stream;
}

/* FIXME: can be removed as set later in anyway */
adap->stream.complete = dvb_usb_data_complete;

return usb_urb_initv2(&adap->stream, &stream_props);
return usb_urb_initv2(&adap->stream, &adap->props->stream);
}

int dvb_usbv2_adapter_stream_exit(struct dvb_usb_adapter *adap)
{
pr_debug("%s: adap=%d\n", __func__, adap->id);
usb_urb_exitv2(&adap->stream);

return 0;
}

Expand Down Expand Up @@ -133,6 +122,8 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)

/* resolve USB stream configuration */
if (adap->dev->props->get_usb_stream_config) {
memcpy(&stream_props, &adap->props->stream,
sizeof(struct usb_data_stream_properties));
ret = adap->dev->props->get_usb_stream_config(
adap->fe[adap->active_fe],
&stream_props);
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/dvb/dvb-usb/usb_urb.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ int usb_urb_reconfig(struct usb_data_stream *stream,
}

int usb_urb_initv2(struct usb_data_stream *stream,
struct usb_data_stream_properties *props)
const struct usb_data_stream_properties *props)
{
int ret;

Expand Down

0 comments on commit 6400a8c

Please sign in to comment.