diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2007-11-06 23:01:52 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-11-29 00:58:35 +0300 |
commit | 4a9bee8256a2dec26290a3bfff86ab86b8992547 (patch) | |
tree | 8e30db88d70d67d6be81f0b0bdd5e52d618f8ba0 /drivers/usb/core/message.c | |
parent | 7e61559f6199bb387037abfc7d10a893973561fc (diff) | |
download | linux-4a9bee8256a2dec26290a3bfff86ab86b8992547.tar.xz |
USB: uevent environment key fix
This patch (as1010) was written by both Kay Sievers and me. It solves
the problem of duplicated keys in USB uevent structures by refactoring
the uevent subroutines, taking advantage of the way the hotplug core
calls uevent handlers for the device's bus and for the device's type.
Keys needed for both USB-device and USB-interface events are added in
usb_uevent(), which is the bus handler. Keys appropriate only for
USB-device or USB-interface events are added in usb_dev_uevent() or
usb_if_uevent() respectively, the type handlers.
In addition, unnecessary tests for NULL pointers are removed as are
duplicated debugging log statements.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core/message.c')
-rw-r--r-- | drivers/usb/core/message.c | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 40fd39de5bf9..fcd40ecbeecc 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -1346,34 +1346,10 @@ static int usb_if_uevent(struct device *dev, struct kobj_uevent_env *env) struct usb_interface *intf; struct usb_host_interface *alt; - if (!dev) - return -ENODEV; - - /* driver is often null here; dev_dbg() would oops */ - pr_debug ("usb %s: uevent\n", dev->bus_id); - intf = to_usb_interface(dev); usb_dev = interface_to_usbdev(intf); alt = intf->cur_altsetting; -#ifdef CONFIG_USB_DEVICEFS - if (add_uevent_var(env, "DEVICE=/proc/bus/usb/%03d/%03d", - usb_dev->bus->busnum, usb_dev->devnum)) - return -ENOMEM; -#endif - - if (add_uevent_var(env, "PRODUCT=%x/%x/%x", - le16_to_cpu(usb_dev->descriptor.idVendor), - le16_to_cpu(usb_dev->descriptor.idProduct), - le16_to_cpu(usb_dev->descriptor.bcdDevice))) - return -ENOMEM; - - if (add_uevent_var(env, "TYPE=%d/%d/%d", - usb_dev->descriptor.bDeviceClass, - usb_dev->descriptor.bDeviceSubClass, - usb_dev->descriptor.bDeviceProtocol)) - return -ENOMEM; - if (add_uevent_var(env, "INTERFACE=%d/%d/%d", alt->desc.bInterfaceClass, alt->desc.bInterfaceSubClass, |