Commit bc00bc924295f02295fe5eeeba3618ba0d0db1ef

Authored by Greg Kroah-Hartman
1 parent 3d81252ddb

device create: usb: convert device_create to device_create_drvdata

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>

Showing 4 changed files with 11 additions and 9 deletions Side-by-side Diff

drivers/usb/core/devio.c
... ... @@ -1729,9 +1729,9 @@
1729 1729 {
1730 1730 struct device *cldev;
1731 1731  
1732   - cldev = device_create(usb_classdev_class, &dev->dev, dev->dev.devt,
1733   - "usbdev%d.%d", dev->bus->busnum,
1734   - dev->devnum);
  1732 + cldev = device_create_drvdata(usb_classdev_class, &dev->dev,
  1733 + dev->dev.devt, NULL, "usbdev%d.%d",
  1734 + dev->bus->busnum, dev->devnum);
1735 1735 if (IS_ERR(cldev))
1736 1736 return PTR_ERR(cldev);
1737 1737 dev->usb_classdev = cldev;
drivers/usb/core/file.c
... ... @@ -196,8 +196,9 @@
196 196 ++temp;
197 197 else
198 198 temp = name;
199   - intf->usb_dev = device_create(usb_class->class, &intf->dev,
200   - MKDEV(USB_MAJOR, minor), "%s", temp);
  199 + intf->usb_dev = device_create_drvdata(usb_class->class, &intf->dev,
  200 + MKDEV(USB_MAJOR, minor), NULL,
  201 + "%s", temp);
201 202 if (IS_ERR(intf->usb_dev)) {
202 203 down_write(&minor_rwsem);
203 204 usb_minors[intf->minor] = NULL;
drivers/usb/gadget/printer.c
... ... @@ -1360,8 +1360,8 @@
1360 1360  
1361 1361  
1362 1362 /* Setup the sysfs files for the printer gadget. */
1363   - dev->pdev = device_create(usb_gadget_class, NULL, g_printer_devno,
1364   - "g_printer");
  1363 + dev->pdev = device_create_drvdata(usb_gadget_class, NULL,
  1364 + g_printer_devno, NULL, "g_printer");
1365 1365 if (IS_ERR(dev->pdev)) {
1366 1366 ERROR(dev, "Failed to create device: g_printer\n");
1367 1367 goto fail;
drivers/usb/mon/mon_bin.c
... ... @@ -1162,8 +1162,9 @@
1162 1162 if (minor >= MON_BIN_MAX_MINOR)
1163 1163 return 0;
1164 1164  
1165   - dev = device_create(mon_bin_class, ubus? ubus->controller: NULL,
1166   - MKDEV(MAJOR(mon_bin_dev0), minor), "usbmon%d", minor);
  1165 + dev = device_create_drvdata(mon_bin_class, ubus? ubus->controller: NULL,
  1166 + MKDEV(MAJOR(mon_bin_dev0), minor), NULL,
  1167 + "usbmon%d", minor);
1167 1168 if (IS_ERR(dev))
1168 1169 return 0;
1169 1170