]> err.no Git - linux-2.6/blobdiff - drivers/usb/core/devio.c
iwlwifi: fix printk newlines
[linux-2.6] / drivers / usb / core / devio.c
index 5580c6e59baefff99fc8553476e5b17f27f6b399..20290c5b15625c3b4272765ff95eefa3feb07b88 100644 (file)
@@ -552,14 +552,15 @@ static int check_ctrlrecip(struct dev_state *ps, unsigned int requesttype,
 
 static int match_devt(struct device *dev, void *data)
 {
-       return (dev->devt == (dev_t) data);
+       return dev->devt == (dev_t) (unsigned long) data;
 }
 
 static struct usb_device *usbdev_lookup_by_devt(dev_t devt)
 {
        struct device *dev;
 
-       dev = bus_find_device(&usb_bus_type, NULL, (void *) devt, match_devt);
+       dev = bus_find_device(&usb_bus_type, NULL,
+                             (void *) (unsigned long) devt, match_devt);
        if (!dev)
                return NULL;
        return container_of(dev, struct usb_device, dev);
@@ -1728,9 +1729,9 @@ static int usb_classdev_add(struct usb_device *dev)
 {
        struct device *cldev;
 
-       cldev = device_create(usb_classdev_class, &dev->dev, dev->dev.devt,
-                             "usbdev%d.%d", dev->bus->busnum,
-                             dev->devnum);
+       cldev = device_create_drvdata(usb_classdev_class, &dev->dev,
+                                     dev->dev.devt, NULL, "usbdev%d.%d",
+                                     dev->bus->busnum, dev->devnum);
        if (IS_ERR(cldev))
                return PTR_ERR(cldev);
        dev->usb_classdev = cldev;
@@ -1791,6 +1792,11 @@ int __init usb_devio_init(void)
                usb_classdev_class = NULL;
                goto out;
        }
+       /* devices of this class shadow the major:minor of their parent
+        * device, so clear ->dev_kobj to prevent adding duplicate entries
+        * to /sys/dev
+        */
+       usb_classdev_class->dev_kobj = NULL;
 
        usb_register_notify(&usbdev_nb);
 #endif