Commit 36764037 authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab

[media] dvb_usb_v2: add .bInterfaceNumber match

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: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 6b8c8c40
...@@ -172,6 +172,7 @@ struct dvb_usb_device_properties { ...@@ -172,6 +172,7 @@ struct dvb_usb_device_properties {
const char *driver_name; const char *driver_name;
struct module *owner; struct module *owner;
short *adapter_nr; short *adapter_nr;
u8 bInterfaceNumber;
int size_of_priv; int size_of_priv;
......
...@@ -350,7 +350,8 @@ int dvb_usbv2_probe(struct usb_interface *intf, ...@@ -350,7 +350,8 @@ int dvb_usbv2_probe(struct usb_interface *intf,
struct dvb_usb_driver_info *driver_info = struct dvb_usb_driver_info *driver_info =
(struct dvb_usb_driver_info *) id->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) { if (!id->driver_info) {
pr_err("%s: driver_info failed\n", KBUILD_MODNAME); pr_err("%s: driver_info failed\n", KBUILD_MODNAME);
...@@ -371,6 +372,13 @@ int dvb_usbv2_probe(struct usb_interface *intf, ...@@ -371,6 +372,13 @@ int dvb_usbv2_probe(struct usb_interface *intf,
d->intf = intf; d->intf = intf;
memcpy(&d->props, driver_info->props, memcpy(&d->props, driver_info->props,
sizeof(struct dvb_usb_device_properties)); 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->usb_mutex);
mutex_init(&d->i2c_mutex); mutex_init(&d->i2c_mutex);
INIT_WORK(&d->probe_work, dvb_usbv2_init_work); INIT_WORK(&d->probe_work, dvb_usbv2_init_work);
...@@ -384,6 +392,7 @@ int dvb_usbv2_probe(struct usb_interface *intf, ...@@ -384,6 +392,7 @@ int dvb_usbv2_probe(struct usb_interface *intf,
return 0; return 0;
err_kfree: err_kfree:
usb_set_intfdata(intf, NULL); usb_set_intfdata(intf, NULL);
exit_kfree:
kfree(d); kfree(d);
err: err:
pr_debug("%s: failed=%d\n", __func__, ret); pr_debug("%s: failed=%d\n", __func__, ret);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment