From 4a9bee8256a2dec26290a3bfff86ab86b8992547 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Tue, 6 Nov 2007 15:01:52 -0500 Subject: 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 Cc: Kay Sievers Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/driver.c | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'drivers/usb/core/driver.c') diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 8586817698a..c51f8e9312e 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -585,9 +585,6 @@ static int usb_uevent(struct device *dev, struct kobj_uevent_env *env) { struct usb_device *usb_dev; - if (!dev) - return -ENODEV; - /* driver is often null here; dev_dbg() would oops */ pr_debug ("usb %s: uevent\n", dev->bus_id); @@ -631,14 +628,6 @@ static int usb_uevent(struct device *dev, struct kobj_uevent_env *env) usb_dev->descriptor.bDeviceProtocol)) return -ENOMEM; - if (add_uevent_var(env, "BUSNUM=%03d", - usb_dev->bus->busnum)) - return -ENOMEM; - - if (add_uevent_var(env, "DEVNUM=%03d", - usb_dev->devnum)) - return -ENOMEM; - return 0; } -- cgit v1.2.3