Commit bc00bc92 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

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: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 3d81252d
...@@ -1729,9 +1729,9 @@ static int usb_classdev_add(struct usb_device *dev) ...@@ -1729,9 +1729,9 @@ static int usb_classdev_add(struct usb_device *dev)
{ {
struct device *cldev; struct device *cldev;
cldev = device_create(usb_classdev_class, &dev->dev, dev->dev.devt, cldev = device_create_drvdata(usb_classdev_class, &dev->dev,
"usbdev%d.%d", dev->bus->busnum, dev->dev.devt, NULL, "usbdev%d.%d",
dev->devnum); dev->bus->busnum, dev->devnum);
if (IS_ERR(cldev)) if (IS_ERR(cldev))
return PTR_ERR(cldev); return PTR_ERR(cldev);
dev->usb_classdev = cldev; dev->usb_classdev = cldev;
......
...@@ -196,8 +196,9 @@ int usb_register_dev(struct usb_interface *intf, ...@@ -196,8 +196,9 @@ int usb_register_dev(struct usb_interface *intf,
++temp; ++temp;
else else
temp = name; temp = name;
intf->usb_dev = device_create(usb_class->class, &intf->dev, intf->usb_dev = device_create_drvdata(usb_class->class, &intf->dev,
MKDEV(USB_MAJOR, minor), "%s", temp); MKDEV(USB_MAJOR, minor), NULL,
"%s", temp);
if (IS_ERR(intf->usb_dev)) { if (IS_ERR(intf->usb_dev)) {
down_write(&minor_rwsem); down_write(&minor_rwsem);
usb_minors[intf->minor] = NULL; usb_minors[intf->minor] = NULL;
......
...@@ -1360,8 +1360,8 @@ printer_bind(struct usb_gadget *gadget) ...@@ -1360,8 +1360,8 @@ printer_bind(struct usb_gadget *gadget)
/* Setup the sysfs files for the printer gadget. */ /* Setup the sysfs files for the printer gadget. */
dev->pdev = device_create(usb_gadget_class, NULL, g_printer_devno, dev->pdev = device_create_drvdata(usb_gadget_class, NULL,
"g_printer"); g_printer_devno, NULL, "g_printer");
if (IS_ERR(dev->pdev)) { if (IS_ERR(dev->pdev)) {
ERROR(dev, "Failed to create device: g_printer\n"); ERROR(dev, "Failed to create device: g_printer\n");
goto fail; goto fail;
......
...@@ -1162,8 +1162,9 @@ int mon_bin_add(struct mon_bus *mbus, const struct usb_bus *ubus) ...@@ -1162,8 +1162,9 @@ int mon_bin_add(struct mon_bus *mbus, const struct usb_bus *ubus)
if (minor >= MON_BIN_MAX_MINOR) if (minor >= MON_BIN_MAX_MINOR)
return 0; return 0;
dev = device_create(mon_bin_class, ubus? ubus->controller: NULL, dev = device_create_drvdata(mon_bin_class, ubus? ubus->controller: NULL,
MKDEV(MAJOR(mon_bin_dev0), minor), "usbmon%d", minor); MKDEV(MAJOR(mon_bin_dev0), minor), NULL,
"usbmon%d", minor);
if (IS_ERR(dev)) if (IS_ERR(dev))
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment