From 36764037640e1892d769cfcfe1df51b985d84563 Mon Sep 17 00:00:00 2001 From: Antti Palosaari Date: Thu, 7 Jun 2012 17:34:41 -0300 Subject: [PATCH] [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: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/dvb_usb.h | 1 + drivers/media/dvb/dvb-usb/dvb_usb_init.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb/dvb-usb/dvb_usb.h b/drivers/media/dvb/dvb-usb/dvb_usb.h index e67333b4a726..4394a5d6f161 100644 --- a/drivers/media/dvb/dvb-usb/dvb_usb.h +++ b/drivers/media/dvb/dvb-usb/dvb_usb.h @@ -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; diff --git a/drivers/media/dvb/dvb-usb/dvb_usb_init.c b/drivers/media/dvb/dvb-usb/dvb_usb_init.c index c0857d03275e..7c98a40562e4 100644 --- a/drivers/media/dvb/dvb-usb/dvb_usb_init.c +++ b/drivers/media/dvb/dvb-usb/dvb_usb_init.c @@ -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); -- 2.30.2