Skip to content

Commit

Permalink
[media] dvb_usb_v2: add .bInterfaceNumber match
Browse files Browse the repository at this point in the history
There is no USB match flag for used USB interface. It is rather
common there is multiple interfaces offering different services.
For example one for television and one for remote controller.

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 6b8c8c4 commit 3676403
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions drivers/media/dvb/dvb-usb/dvb_usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ struct dvb_usb_device_properties {
const char *driver_name;
struct module *owner;
short *adapter_nr;
u8 bInterfaceNumber;

int size_of_priv;

Expand Down
11 changes: 10 additions & 1 deletion drivers/media/dvb/dvb-usb/dvb_usb_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,8 @@ int dvb_usbv2_probe(struct usb_interface *intf,
struct dvb_usb_driver_info *driver_info =
(struct dvb_usb_driver_info *) id->driver_info;

pr_debug("%s:\n", __func__);
pr_debug("%s: bInterfaceNumber=%d\n", __func__,
intf->cur_altsetting->desc.bInterfaceNumber);

if (!id->driver_info) {
pr_err("%s: driver_info failed\n", KBUILD_MODNAME);
Expand All @@ -371,6 +372,13 @@ int dvb_usbv2_probe(struct usb_interface *intf,
d->intf = intf;
memcpy(&d->props, driver_info->props,
sizeof(struct dvb_usb_device_properties));

if (d->intf->cur_altsetting->desc.bInterfaceNumber !=
d->props.bInterfaceNumber) {
ret = 0;
goto exit_kfree;
}

mutex_init(&d->usb_mutex);
mutex_init(&d->i2c_mutex);
INIT_WORK(&d->probe_work, dvb_usbv2_init_work);
Expand All @@ -384,6 +392,7 @@ int dvb_usbv2_probe(struct usb_interface *intf,
return 0;
err_kfree:
usb_set_intfdata(intf, NULL);
exit_kfree:
kfree(d);
err:
pr_debug("%s: failed=%d\n", __func__, ret);
Expand Down

0 comments on commit 3676403

Please sign in to comment.