]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] dvb_usb_v2: add .bInterfaceNumber match
authorAntti Palosaari <crope@iki.fi>
Thu, 7 Jun 2012 20:34:41 +0000 (17:34 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 4 Aug 2012 10:56:27 +0000 (07:56 -0300)
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>
drivers/media/dvb/dvb-usb/dvb_usb.h
drivers/media/dvb/dvb-usb/dvb_usb_init.c

index e67333b4a72689c710ae8afebe6e3dddd8897a68..4394a5d6f161e48b2133cfded48d32bbf504e082 100644 (file)
@@ -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;
 
index c0857d03275e943f56fcd8d1896b73beeb2062de..7c98a40562e4d8fe23a59cc0a8b9cd1520b74a15 100644 (file)
@@ -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);
@@ -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);
@@ -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);