diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2008-05-21 15:52:33 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-07-22 00:54:46 -0400 |
commit | bc00bc924295f02295fe5eeeba3618ba0d0db1ef (patch) | |
tree | d13f926c627f2d892c20b714288ff85aeae89e37 | |
parent | 3d81252ddb10f63ae4db713d9b32faabe641b850 (diff) |
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>
-rw-r--r-- | drivers/usb/core/devio.c | 6 | ||||
-rw-r--r-- | drivers/usb/core/file.c | 5 | ||||
-rw-r--r-- | drivers/usb/gadget/printer.c | 4 | ||||
-rw-r--r-- | drivers/usb/mon/mon_bin.c | 5 |
4 files changed, 11 insertions, 9 deletions
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 6fbc8f5ab80c..20290c5b1562 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -1729,9 +1729,9 @@ static int usb_classdev_add(struct usb_device *dev) | |||
1729 | { | 1729 | { |
1730 | struct device *cldev; | 1730 | struct device *cldev; |
1731 | 1731 | ||
1732 | cldev = device_create(usb_classdev_class, &dev->dev, dev->dev.devt, | 1732 | cldev = device_create_drvdata(usb_classdev_class, &dev->dev, |
1733 | "usbdev%d.%d", dev->bus->busnum, | 1733 | dev->dev.devt, NULL, "usbdev%d.%d", |
1734 | dev->devnum); | 1734 | dev->bus->busnum, dev->devnum); |
1735 | if (IS_ERR(cldev)) | 1735 | if (IS_ERR(cldev)) |
1736 | return PTR_ERR(cldev); | 1736 | return PTR_ERR(cldev); |
1737 | dev->usb_classdev = cldev; | 1737 | dev->usb_classdev = cldev; |
diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c index 913fb8667899..6b1b229e38cd 100644 --- a/drivers/usb/core/file.c +++ b/drivers/usb/core/file.c | |||
@@ -196,8 +196,9 @@ int usb_register_dev(struct usb_interface *intf, | |||
196 | ++temp; | 196 | ++temp; |
197 | else | 197 | else |
198 | temp = name; | 198 | temp = name; |
199 | intf->usb_dev = device_create(usb_class->class, &intf->dev, | 199 | intf->usb_dev = device_create_drvdata(usb_class->class, &intf->dev, |
200 | MKDEV(USB_MAJOR, minor), "%s", temp); | 200 | MKDEV(USB_MAJOR, minor), NULL, |
201 | "%s", temp); | ||
201 | if (IS_ERR(intf->usb_dev)) { | 202 | if (IS_ERR(intf->usb_dev)) { |
202 | down_write(&minor_rwsem); | 203 | down_write(&minor_rwsem); |
203 | usb_minors[intf->minor] = NULL; | 204 | usb_minors[intf->minor] = NULL; |
diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c index 9caaec3ae9a3..49cd9e145a9b 100644 --- a/drivers/usb/gadget/printer.c +++ b/drivers/usb/gadget/printer.c | |||
@@ -1360,8 +1360,8 @@ printer_bind(struct usb_gadget *gadget) | |||
1360 | 1360 | ||
1361 | 1361 | ||
1362 | /* Setup the sysfs files for the printer gadget. */ | 1362 | /* Setup the sysfs files for the printer gadget. */ |
1363 | dev->pdev = device_create(usb_gadget_class, NULL, g_printer_devno, | 1363 | dev->pdev = device_create_drvdata(usb_gadget_class, NULL, |
1364 | "g_printer"); | 1364 | g_printer_devno, NULL, "g_printer"); |
1365 | if (IS_ERR(dev->pdev)) { | 1365 | if (IS_ERR(dev->pdev)) { |
1366 | ERROR(dev, "Failed to create device: g_printer\n"); | 1366 | ERROR(dev, "Failed to create device: g_printer\n"); |
1367 | goto fail; | 1367 | goto fail; |
diff --git a/drivers/usb/mon/mon_bin.c b/drivers/usb/mon/mon_bin.c index 293a46247c3b..6566fc0a3228 100644 --- a/drivers/usb/mon/mon_bin.c +++ b/drivers/usb/mon/mon_bin.c | |||
@@ -1162,8 +1162,9 @@ int mon_bin_add(struct mon_bus *mbus, const struct usb_bus *ubus) | |||
1162 | if (minor >= MON_BIN_MAX_MINOR) | 1162 | if (minor >= MON_BIN_MAX_MINOR) |
1163 | return 0; | 1163 | return 0; |
1164 | 1164 | ||
1165 | dev = device_create(mon_bin_class, ubus? ubus->controller: NULL, | 1165 | dev = device_create_drvdata(mon_bin_class, ubus? ubus->controller: NULL, |
1166 | MKDEV(MAJOR(mon_bin_dev0), minor), "usbmon%d", minor); | 1166 | MKDEV(MAJOR(mon_bin_dev0), minor), NULL, |
1167 | "usbmon%d", minor); | ||
1167 | if (IS_ERR(dev)) | 1168 | if (IS_ERR(dev)) |
1168 | return 0; | 1169 | return 0; |
1169 | 1170 | ||