aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/usb/qmi_wwan.c
diff options
context:
space:
mode:
authorBjørn Mork <bjorn@mork.no>2012-07-17 11:14:32 +0000
committerDavid S. Miller <davem@davemloft.net>2012-07-18 09:31:25 -0700
commit1817e83d6ccf992164dd83522b2d1c22b1a85977 (patch)
tree3fbea43d4ea36ecdd61aec298d393e829e33f596 /drivers/net/usb/qmi_wwan.c
parenteeda8585522bcc173f91d6254dfa63e871087c54 (diff)
downloadlinaro-lsk-1817e83d6ccf992164dd83522b2d1c22b1a85977.tar.gz
net: qmi_wwan: make dynamic device IDs work
The usbnet API use the device ID table to store a pointer to a minidriver. Setting a generic pointer for dynamic device IDs will in most cases make them work as expected. usbnet will otherwise treat the dynamic IDs as blacklisted. That is rarely useful. There is no standard class describing devices supported by this driver, and most vendors don't even provide enough information to allow vendor specific wildcard matching. The result is that most of the supported devices must be explicitly listed in the device table. Allowing dynamic IDs to work both simplifies testing and verification of new devices, and provides a way for end users to use a device before the ID is added to the driver. Signed-off-by: Bjørn Mork <bjorn@mork.no> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb/qmi_wwan.c')
-rw-r--r--drivers/net/usb/qmi_wwan.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 85c983d5252..07743c14a6b 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -600,10 +600,27 @@ static const struct usb_device_id products[] = {
};
MODULE_DEVICE_TABLE(usb, products);
+static int qmi_wwan_probe(struct usb_interface *intf, const struct usb_device_id *prod)
+{
+ struct usb_device_id *id = (struct usb_device_id *)prod;
+
+ /* Workaround to enable dynamic IDs. This disables usbnet
+ * blacklisting functionality. Which, if required, can be
+ * reimplemented here by using a magic "blacklist" value
+ * instead of 0 in the static device id table
+ */
+ if (!id->driver_info) {
+ dev_dbg(&intf->dev, "setting defaults for dynamic device id\n");
+ id->driver_info = (unsigned long)&qmi_wwan_shared;
+ }
+
+ return usbnet_probe(intf, id);
+}
+
static struct usb_driver qmi_wwan_driver = {
.name = "qmi_wwan",
.id_table = products,
- .probe = usbnet_probe,
+ .probe = qmi_wwan_probe,
.disconnect = usbnet_disconnect,
.suspend = qmi_wwan_suspend,
.resume = qmi_wwan_resume,