summaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/usb-serial.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2011-01-11 20:16:50 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2011-01-23 03:38:59 +0100
commit5620b5f7f19e9ee3fcf6ecf493fed7821b7b495b (patch)
tree59aa3c05bca4552fc92903deafc3181e3df273ec /drivers/usb/serial/usb-serial.c
parentUSB: ehci-fsl: Fix 'have_sysif_regs' detection (diff)
downloadlinux-5620b5f7f19e9ee3fcf6ecf493fed7821b7b495b.tar.xz
linux-5620b5f7f19e9ee3fcf6ecf493fed7821b7b495b.zip
USB serial: add missing .usb_driver field in serial drivers
This patch (as1443) fixes a bug found in many of the USB serial drivers: They don't set the .usb_driver field in their usb_serial_driver structure. This field is needed for assigning dynamic IDs for device matching. In addition, starting with the 2.6.37 kernel, the .usb_driver field is needed for proper autosuspend operation. Without it, attempts to open the device file will fail. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Reported-by: Dan Williams <dcbw@redhat.com> CC: <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/usb-serial.c')
-rw-r--r--drivers/usb/serial/usb-serial.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 6954de50c0ff..546a52179bec 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -1344,11 +1344,15 @@ int usb_serial_register(struct usb_serial_driver *driver)
return -ENODEV;
fixup_generic(driver);
- if (driver->usb_driver)
- driver->usb_driver->supports_autosuspend = 1;
if (!driver->description)
driver->description = driver->driver.name;
+ if (!driver->usb_driver) {
+ WARN(1, "Serial driver %s has no usb_driver\n",
+ driver->description);
+ return -EINVAL;
+ }
+ driver->usb_driver->supports_autosuspend = 1;
/* Add this device to our list of devices */
mutex_lock(&table_lock);