device create: usb: convert device_create to device_create_drvdata
authorGreg Kroah-Hartman <gregkh@suse.de>
Wed, 21 May 2008 19:52:33 +0000 (12:52 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 22 Jul 2008 04:54:46 +0000 (21:54 -0700)
device_create() is race-prone, so use the race-free
device_create_drvdata() instead as device_create() is going away.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/devio.c
drivers/usb/core/file.c
drivers/usb/gadget/printer.c
drivers/usb/mon/mon_bin.c

index 6fbc8f5ab80cf3e114e26e1be58cf85214faa9b3..20290c5b15625c3b4272765ff95eefa3feb07b88 100644 (file)
@@ -1729,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;
index 913fb8667899f29a48333d17e3074d73b4f2ed50..6b1b229e38cd1d28790d5f29e54eebbe3efe2fb8 100644 (file)
@@ -196,8 +196,9 @@ int usb_register_dev(struct usb_interface *intf,
                ++temp;
        else
                temp = name;
-       intf->usb_dev = device_create(usb_class->class, &intf->dev,
-                                     MKDEV(USB_MAJOR, minor), "%s", temp);
+       intf->usb_dev = device_create_drvdata(usb_class->class, &intf->dev,
+                                             MKDEV(USB_MAJOR, minor), NULL,
+                                             "%s", temp);
        if (IS_ERR(intf->usb_dev)) {
                down_write(&minor_rwsem);
                usb_minors[intf->minor] = NULL;
index 9caaec3ae9a38aff14de8052bdfc285d38540ad9..49cd9e145a9bfbcdba12c76192f93ae3073b716d 100644 (file)
@@ -1360,8 +1360,8 @@ printer_bind(struct usb_gadget *gadget)
 
 
        /* Setup the sysfs files for the printer gadget. */
-       dev->pdev = device_create(usb_gadget_class, NULL, g_printer_devno,
-                       "g_printer");
+       dev->pdev = device_create_drvdata(usb_gadget_class, NULL,
+                                         g_printer_devno, NULL, "g_printer");
        if (IS_ERR(dev->pdev)) {
                ERROR(dev, "Failed to create device: g_printer\n");
                goto fail;
index 293a46247c3b3bc8e4c731ca45fac0493d526778..6566fc0a322853a50b8f212d6b82df868da9b4d5 100644 (file)
@@ -1162,8 +1162,9 @@ int mon_bin_add(struct mon_bus *mbus, const struct usb_bus *ubus)
        if (minor >= MON_BIN_MAX_MINOR)
                return 0;
 
-       dev = device_create(mon_bin_class, ubus? ubus->controller: NULL,
-                       MKDEV(MAJOR(mon_bin_dev0), minor), "usbmon%d", minor);
+       dev = device_create_drvdata(mon_bin_class, ubus? ubus->controller: NULL,
+                                   MKDEV(MAJOR(mon_bin_dev0), minor), NULL,
+                                   "usbmon%d", minor);
        if (IS_ERR(dev))
                return 0;