diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-20 20:20:23 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-20 20:20:23 -0400 |
commit | 57312b75aa06b09c28acd9c5a9c70827da3696d2 (patch) | |
tree | c35b230739f4b9a8e50b1651854ad830ca2b9fdf /drivers | |
parent | 1b5e2a7e23439c13f73cacab1cf227f30cb9ae9f (diff) | |
parent | 24b42566c3fcbb5a9011d1446783d0f5844ccd45 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6:
SCSI: fix race in device_create
USB: Core: fix race in device_create
USB: Phidget: fix race in device_create
s390: fix race in device_create
SOUND: fix race in device_create
UIO: fix race in device_create
Power Supply: fix race in device_create
LEDS: fix race in device_create
IB: fix race in device_create
ide: fix race in device_create
fbdev: fix race in device_create
mm: bdi: fix race in bdi_class device creation
Driver core: add device_create_vargs and device_create_drvdata
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/base/core.c | 85 | ||||
-rw-r--r-- | drivers/ide/ide-probe.c | 5 | ||||
-rw-r--r-- | drivers/infiniband/core/user_mad.c | 14 | ||||
-rw-r--r-- | drivers/infiniband/core/uverbs_main.c | 11 | ||||
-rw-r--r-- | drivers/leds/led-class.c | 6 | ||||
-rw-r--r-- | drivers/power/power_supply_core.c | 6 | ||||
-rw-r--r-- | drivers/s390/char/vmlogrdr.c | 9 | ||||
-rw-r--r-- | drivers/scsi/ch.c | 7 | ||||
-rw-r--r-- | drivers/scsi/osst.c | 3 | ||||
-rw-r--r-- | drivers/scsi/sg.c | 11 | ||||
-rw-r--r-- | drivers/scsi/st.c | 12 | ||||
-rw-r--r-- | drivers/uio/uio.c | 7 | ||||
-rw-r--r-- | drivers/usb/core/hcd.c | 6 | ||||
-rw-r--r-- | drivers/usb/misc/phidgetkit.c | 6 | ||||
-rw-r--r-- | drivers/usb/misc/phidgetmotorcontrol.c | 7 | ||||
-rw-r--r-- | drivers/usb/misc/phidgetservo.c | 6 | ||||
-rw-r--r-- | drivers/video/display/display-sysfs.c | 10 |
17 files changed, 140 insertions, 71 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index be288b5e4180..f861c2b1dcff 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -1084,11 +1084,13 @@ static void device_create_release(struct device *dev) | |||
1084 | } | 1084 | } |
1085 | 1085 | ||
1086 | /** | 1086 | /** |
1087 | * device_create - creates a device and registers it with sysfs | 1087 | * device_create_vargs - creates a device and registers it with sysfs |
1088 | * @class: pointer to the struct class that this device should be registered to | 1088 | * @class: pointer to the struct class that this device should be registered to |
1089 | * @parent: pointer to the parent struct device of this new device, if any | 1089 | * @parent: pointer to the parent struct device of this new device, if any |
1090 | * @devt: the dev_t for the char device to be added | 1090 | * @devt: the dev_t for the char device to be added |
1091 | * @drvdata: the data to be added to the device for callbacks | ||
1091 | * @fmt: string for the device's name | 1092 | * @fmt: string for the device's name |
1093 | * @args: va_list for the device's name | ||
1092 | * | 1094 | * |
1093 | * This function can be used by char device classes. A struct device | 1095 | * This function can be used by char device classes. A struct device |
1094 | * will be created in sysfs, registered to the specified class. | 1096 | * will be created in sysfs, registered to the specified class. |
@@ -1104,10 +1106,10 @@ static void device_create_release(struct device *dev) | |||
1104 | * Note: the struct class passed to this function must have previously | 1106 | * Note: the struct class passed to this function must have previously |
1105 | * been created with a call to class_create(). | 1107 | * been created with a call to class_create(). |
1106 | */ | 1108 | */ |
1107 | struct device *device_create(struct class *class, struct device *parent, | 1109 | struct device *device_create_vargs(struct class *class, struct device *parent, |
1108 | dev_t devt, const char *fmt, ...) | 1110 | dev_t devt, void *drvdata, const char *fmt, |
1111 | va_list args) | ||
1109 | { | 1112 | { |
1110 | va_list args; | ||
1111 | struct device *dev = NULL; | 1113 | struct device *dev = NULL; |
1112 | int retval = -ENODEV; | 1114 | int retval = -ENODEV; |
1113 | 1115 | ||
@@ -1124,10 +1126,9 @@ struct device *device_create(struct class *class, struct device *parent, | |||
1124 | dev->class = class; | 1126 | dev->class = class; |
1125 | dev->parent = parent; | 1127 | dev->parent = parent; |
1126 | dev->release = device_create_release; | 1128 | dev->release = device_create_release; |
1129 | dev_set_drvdata(dev, drvdata); | ||
1127 | 1130 | ||
1128 | va_start(args, fmt); | ||
1129 | vsnprintf(dev->bus_id, BUS_ID_SIZE, fmt, args); | 1131 | vsnprintf(dev->bus_id, BUS_ID_SIZE, fmt, args); |
1130 | va_end(args); | ||
1131 | retval = device_register(dev); | 1132 | retval = device_register(dev); |
1132 | if (retval) | 1133 | if (retval) |
1133 | goto error; | 1134 | goto error; |
@@ -1138,6 +1139,78 @@ error: | |||
1138 | kfree(dev); | 1139 | kfree(dev); |
1139 | return ERR_PTR(retval); | 1140 | return ERR_PTR(retval); |
1140 | } | 1141 | } |
1142 | EXPORT_SYMBOL_GPL(device_create_vargs); | ||
1143 | |||
1144 | /** | ||
1145 | * device_create_drvdata - creates a device and registers it with sysfs | ||
1146 | * @class: pointer to the struct class that this device should be registered to | ||
1147 | * @parent: pointer to the parent struct device of this new device, if any | ||
1148 | * @devt: the dev_t for the char device to be added | ||
1149 | * @drvdata: the data to be added to the device for callbacks | ||
1150 | * @fmt: string for the device's name | ||
1151 | * | ||
1152 | * This function can be used by char device classes. A struct device | ||
1153 | * will be created in sysfs, registered to the specified class. | ||
1154 | * | ||
1155 | * A "dev" file will be created, showing the dev_t for the device, if | ||
1156 | * the dev_t is not 0,0. | ||
1157 | * If a pointer to a parent struct device is passed in, the newly created | ||
1158 | * struct device will be a child of that device in sysfs. | ||
1159 | * The pointer to the struct device will be returned from the call. | ||
1160 | * Any further sysfs files that might be required can be created using this | ||
1161 | * pointer. | ||
1162 | * | ||
1163 | * Note: the struct class passed to this function must have previously | ||
1164 | * been created with a call to class_create(). | ||
1165 | */ | ||
1166 | struct device *device_create_drvdata(struct class *class, | ||
1167 | struct device *parent, | ||
1168 | dev_t devt, | ||
1169 | void *drvdata, | ||
1170 | const char *fmt, ...) | ||
1171 | { | ||
1172 | va_list vargs; | ||
1173 | struct device *dev; | ||
1174 | |||
1175 | va_start(vargs, fmt); | ||
1176 | dev = device_create_vargs(class, parent, devt, drvdata, fmt, vargs); | ||
1177 | va_end(vargs); | ||
1178 | return dev; | ||
1179 | } | ||
1180 | EXPORT_SYMBOL_GPL(device_create_drvdata); | ||
1181 | |||
1182 | /** | ||
1183 | * device_create - creates a device and registers it with sysfs | ||
1184 | * @class: pointer to the struct class that this device should be registered to | ||
1185 | * @parent: pointer to the parent struct device of this new device, if any | ||
1186 | * @devt: the dev_t for the char device to be added | ||
1187 | * @fmt: string for the device's name | ||
1188 | * | ||
1189 | * This function can be used by char device classes. A struct device | ||
1190 | * will be created in sysfs, registered to the specified class. | ||
1191 | * | ||
1192 | * A "dev" file will be created, showing the dev_t for the device, if | ||
1193 | * the dev_t is not 0,0. | ||
1194 | * If a pointer to a parent struct device is passed in, the newly created | ||
1195 | * struct device will be a child of that device in sysfs. | ||
1196 | * The pointer to the struct device will be returned from the call. | ||
1197 | * Any further sysfs files that might be required can be created using this | ||
1198 | * pointer. | ||
1199 | * | ||
1200 | * Note: the struct class passed to this function must have previously | ||
1201 | * been created with a call to class_create(). | ||
1202 | */ | ||
1203 | struct device *device_create(struct class *class, struct device *parent, | ||
1204 | dev_t devt, const char *fmt, ...) | ||
1205 | { | ||
1206 | va_list vargs; | ||
1207 | struct device *dev; | ||
1208 | |||
1209 | va_start(vargs, fmt); | ||
1210 | dev = device_create_vargs(class, parent, devt, NULL, fmt, vargs); | ||
1211 | va_end(vargs); | ||
1212 | return dev; | ||
1213 | } | ||
1141 | EXPORT_SYMBOL_GPL(device_create); | 1214 | EXPORT_SYMBOL_GPL(device_create); |
1142 | 1215 | ||
1143 | static int __match_devt(struct device *dev, void *data) | 1216 | static int __match_devt(struct device *dev, void *data) |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 34b0d4f26b58..655ec7ef568a 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -648,13 +648,12 @@ static int ide_register_port(ide_hwif_t *hwif) | |||
648 | 648 | ||
649 | get_device(&hwif->gendev); | 649 | get_device(&hwif->gendev); |
650 | 650 | ||
651 | hwif->portdev = device_create(ide_port_class, &hwif->gendev, | 651 | hwif->portdev = device_create_drvdata(ide_port_class, &hwif->gendev, |
652 | MKDEV(0, 0), hwif->name); | 652 | MKDEV(0, 0), hwif, hwif->name); |
653 | if (IS_ERR(hwif->portdev)) { | 653 | if (IS_ERR(hwif->portdev)) { |
654 | ret = PTR_ERR(hwif->portdev); | 654 | ret = PTR_ERR(hwif->portdev); |
655 | device_unregister(&hwif->gendev); | 655 | device_unregister(&hwif->gendev); |
656 | } | 656 | } |
657 | dev_set_drvdata(hwif->portdev, hwif); | ||
658 | out: | 657 | out: |
659 | return ret; | 658 | return ret; |
660 | } | 659 | } |
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c index 3aa2db54eae4..840ede9ae965 100644 --- a/drivers/infiniband/core/user_mad.c +++ b/drivers/infiniband/core/user_mad.c | |||
@@ -1005,8 +1005,9 @@ static int ib_umad_init_port(struct ib_device *device, int port_num, | |||
1005 | if (cdev_add(port->cdev, base_dev + port->dev_num, 1)) | 1005 | if (cdev_add(port->cdev, base_dev + port->dev_num, 1)) |
1006 | goto err_cdev; | 1006 | goto err_cdev; |
1007 | 1007 | ||
1008 | port->dev = device_create(umad_class, device->dma_device, | 1008 | port->dev = device_create_drvdata(umad_class, device->dma_device, |
1009 | port->cdev->dev, "umad%d", port->dev_num); | 1009 | port->cdev->dev, port, |
1010 | "umad%d", port->dev_num); | ||
1010 | if (IS_ERR(port->dev)) | 1011 | if (IS_ERR(port->dev)) |
1011 | goto err_cdev; | 1012 | goto err_cdev; |
1012 | 1013 | ||
@@ -1024,15 +1025,12 @@ static int ib_umad_init_port(struct ib_device *device, int port_num, | |||
1024 | if (cdev_add(port->sm_cdev, base_dev + port->dev_num + IB_UMAD_MAX_PORTS, 1)) | 1025 | if (cdev_add(port->sm_cdev, base_dev + port->dev_num + IB_UMAD_MAX_PORTS, 1)) |
1025 | goto err_sm_cdev; | 1026 | goto err_sm_cdev; |
1026 | 1027 | ||
1027 | port->sm_dev = device_create(umad_class, device->dma_device, | 1028 | port->sm_dev = device_create_drvdata(umad_class, device->dma_device, |
1028 | port->sm_cdev->dev, | 1029 | port->sm_cdev->dev, port, |
1029 | "issm%d", port->dev_num); | 1030 | "issm%d", port->dev_num); |
1030 | if (IS_ERR(port->sm_dev)) | 1031 | if (IS_ERR(port->sm_dev)) |
1031 | goto err_sm_cdev; | 1032 | goto err_sm_cdev; |
1032 | 1033 | ||
1033 | dev_set_drvdata(port->dev, port); | ||
1034 | dev_set_drvdata(port->sm_dev, port); | ||
1035 | |||
1036 | if (device_create_file(port->sm_dev, &dev_attr_ibdev)) | 1034 | if (device_create_file(port->sm_dev, &dev_attr_ibdev)) |
1037 | goto err_sm_dev; | 1035 | goto err_sm_dev; |
1038 | if (device_create_file(port->sm_dev, &dev_attr_port)) | 1036 | if (device_create_file(port->sm_dev, &dev_attr_port)) |
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c index cc1afa28c181..f806da184b51 100644 --- a/drivers/infiniband/core/uverbs_main.c +++ b/drivers/infiniband/core/uverbs_main.c | |||
@@ -755,14 +755,15 @@ static void ib_uverbs_add_one(struct ib_device *device) | |||
755 | if (cdev_add(uverbs_dev->cdev, IB_UVERBS_BASE_DEV + uverbs_dev->devnum, 1)) | 755 | if (cdev_add(uverbs_dev->cdev, IB_UVERBS_BASE_DEV + uverbs_dev->devnum, 1)) |
756 | goto err_cdev; | 756 | goto err_cdev; |
757 | 757 | ||
758 | uverbs_dev->dev = device_create(uverbs_class, device->dma_device, | 758 | uverbs_dev->dev = device_create_drvdata(uverbs_class, |
759 | uverbs_dev->cdev->dev, | 759 | device->dma_device, |
760 | "uverbs%d", uverbs_dev->devnum); | 760 | uverbs_dev->cdev->dev, |
761 | uverbs_dev, | ||
762 | "uverbs%d", | ||
763 | uverbs_dev->devnum); | ||
761 | if (IS_ERR(uverbs_dev->dev)) | 764 | if (IS_ERR(uverbs_dev->dev)) |
762 | goto err_cdev; | 765 | goto err_cdev; |
763 | 766 | ||
764 | dev_set_drvdata(uverbs_dev->dev, uverbs_dev); | ||
765 | |||
766 | if (device_create_file(uverbs_dev->dev, &dev_attr_ibdev)) | 767 | if (device_create_file(uverbs_dev->dev, &dev_attr_ibdev)) |
767 | goto err_class; | 768 | goto err_class; |
768 | if (device_create_file(uverbs_dev->dev, &dev_attr_abi_version)) | 769 | if (device_create_file(uverbs_dev->dev, &dev_attr_abi_version)) |
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index b3c54be74556..559a40861c39 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c | |||
@@ -103,13 +103,11 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev) | |||
103 | { | 103 | { |
104 | int rc; | 104 | int rc; |
105 | 105 | ||
106 | led_cdev->dev = device_create(leds_class, parent, 0, "%s", | 106 | led_cdev->dev = device_create_drvdata(leds_class, parent, 0, led_cdev, |
107 | led_cdev->name); | 107 | "%s", led_cdev->name); |
108 | if (IS_ERR(led_cdev->dev)) | 108 | if (IS_ERR(led_cdev->dev)) |
109 | return PTR_ERR(led_cdev->dev); | 109 | return PTR_ERR(led_cdev->dev); |
110 | 110 | ||
111 | dev_set_drvdata(led_cdev->dev, led_cdev); | ||
112 | |||
113 | /* register the attributes */ | 111 | /* register the attributes */ |
114 | rc = device_create_file(led_cdev->dev, &dev_attr_brightness); | 112 | rc = device_create_file(led_cdev->dev, &dev_attr_brightness); |
115 | if (rc) | 113 | if (rc) |
diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c index 138dd76ee347..af1633eb3b70 100644 --- a/drivers/power/power_supply_core.c +++ b/drivers/power/power_supply_core.c | |||
@@ -91,15 +91,13 @@ int power_supply_register(struct device *parent, struct power_supply *psy) | |||
91 | { | 91 | { |
92 | int rc = 0; | 92 | int rc = 0; |
93 | 93 | ||
94 | psy->dev = device_create(power_supply_class, parent, 0, | 94 | psy->dev = device_create_drvdata(power_supply_class, parent, 0, |
95 | "%s", psy->name); | 95 | psy, "%s", psy->name); |
96 | if (IS_ERR(psy->dev)) { | 96 | if (IS_ERR(psy->dev)) { |
97 | rc = PTR_ERR(psy->dev); | 97 | rc = PTR_ERR(psy->dev); |
98 | goto dev_create_failed; | 98 | goto dev_create_failed; |
99 | } | 99 | } |
100 | 100 | ||
101 | dev_set_drvdata(psy->dev, psy); | ||
102 | |||
103 | INIT_WORK(&psy->changed_work, power_supply_changed_work); | 101 | INIT_WORK(&psy->changed_work, power_supply_changed_work); |
104 | 102 | ||
105 | rc = power_supply_create_attrs(psy); | 103 | rc = power_supply_create_attrs(psy); |
diff --git a/drivers/s390/char/vmlogrdr.c b/drivers/s390/char/vmlogrdr.c index e8487347e4d4..2c2428cc05d8 100644 --- a/drivers/s390/char/vmlogrdr.c +++ b/drivers/s390/char/vmlogrdr.c | |||
@@ -762,10 +762,10 @@ static int vmlogrdr_register_device(struct vmlogrdr_priv_t *priv) | |||
762 | device_unregister(dev); | 762 | device_unregister(dev); |
763 | return ret; | 763 | return ret; |
764 | } | 764 | } |
765 | priv->class_device = device_create(vmlogrdr_class, dev, | 765 | priv->class_device = device_create_drvdata(vmlogrdr_class, dev, |
766 | MKDEV(vmlogrdr_major, | 766 | MKDEV(vmlogrdr_major, |
767 | priv->minor_num), | 767 | priv->minor_num), |
768 | "%s", dev->bus_id); | 768 | priv, "%s", dev->bus_id); |
769 | if (IS_ERR(priv->class_device)) { | 769 | if (IS_ERR(priv->class_device)) { |
770 | ret = PTR_ERR(priv->class_device); | 770 | ret = PTR_ERR(priv->class_device); |
771 | priv->class_device=NULL; | 771 | priv->class_device=NULL; |
@@ -773,7 +773,6 @@ static int vmlogrdr_register_device(struct vmlogrdr_priv_t *priv) | |||
773 | device_unregister(dev); | 773 | device_unregister(dev); |
774 | return ret; | 774 | return ret; |
775 | } | 775 | } |
776 | dev->driver_data = priv; | ||
777 | priv->device = dev; | 776 | priv->device = dev; |
778 | return 0; | 777 | return 0; |
779 | } | 778 | } |
diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index 75c84d7b9ce8..c4b938bc30d3 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c | |||
@@ -910,9 +910,9 @@ static int ch_probe(struct device *dev) | |||
910 | ch->minor = minor; | 910 | ch->minor = minor; |
911 | sprintf(ch->name,"ch%d",ch->minor); | 911 | sprintf(ch->name,"ch%d",ch->minor); |
912 | 912 | ||
913 | class_dev = device_create(ch_sysfs_class, dev, | 913 | class_dev = device_create_drvdata(ch_sysfs_class, dev, |
914 | MKDEV(SCSI_CHANGER_MAJOR,ch->minor), | 914 | MKDEV(SCSI_CHANGER_MAJOR, ch->minor), |
915 | "s%s", ch->name); | 915 | ch, "s%s", ch->name); |
916 | if (IS_ERR(class_dev)) { | 916 | if (IS_ERR(class_dev)) { |
917 | printk(KERN_WARNING "ch%d: device_create failed\n", | 917 | printk(KERN_WARNING "ch%d: device_create failed\n", |
918 | ch->minor); | 918 | ch->minor); |
@@ -926,7 +926,6 @@ static int ch_probe(struct device *dev) | |||
926 | if (init) | 926 | if (init) |
927 | ch_init_elem(ch); | 927 | ch_init_elem(ch); |
928 | 928 | ||
929 | dev_set_drvdata(dev, ch); | ||
930 | sdev_printk(KERN_INFO, sd, "Attached scsi changer %s\n", ch->name); | 929 | sdev_printk(KERN_INFO, sd, "Attached scsi changer %s\n", ch->name); |
931 | 930 | ||
932 | return 0; | 931 | return 0; |
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c index 31f7aec44d90..243d8becd30f 100644 --- a/drivers/scsi/osst.c +++ b/drivers/scsi/osst.c | |||
@@ -5695,13 +5695,12 @@ static int osst_sysfs_add(dev_t dev, struct device *device, struct osst_tape * S | |||
5695 | struct device *osst_member; | 5695 | struct device *osst_member; |
5696 | int err; | 5696 | int err; |
5697 | 5697 | ||
5698 | osst_member = device_create(osst_sysfs_class, device, dev, "%s", name); | 5698 | osst_member = device_create_drvdata(osst_sysfs_class, device, dev, STp, "%s", name); |
5699 | if (IS_ERR(osst_member)) { | 5699 | if (IS_ERR(osst_member)) { |
5700 | printk(KERN_WARNING "osst :W: Unable to add sysfs class member %s\n", name); | 5700 | printk(KERN_WARNING "osst :W: Unable to add sysfs class member %s\n", name); |
5701 | return PTR_ERR(osst_member); | 5701 | return PTR_ERR(osst_member); |
5702 | } | 5702 | } |
5703 | 5703 | ||
5704 | dev_set_drvdata(osst_member, STp); | ||
5705 | err = device_create_file(osst_member, &dev_attr_ADR_rev); | 5704 | err = device_create_file(osst_member, &dev_attr_ADR_rev); |
5706 | if (err) | 5705 | if (err) |
5707 | goto err_out; | 5706 | goto err_out; |
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index c9d7f721b9e2..ea0edd1b2e76 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -1441,17 +1441,18 @@ sg_add(struct device *cl_dev, struct class_interface *cl_intf) | |||
1441 | if (sg_sysfs_valid) { | 1441 | if (sg_sysfs_valid) { |
1442 | struct device *sg_class_member; | 1442 | struct device *sg_class_member; |
1443 | 1443 | ||
1444 | sg_class_member = device_create(sg_sysfs_class, cl_dev->parent, | 1444 | sg_class_member = device_create_drvdata(sg_sysfs_class, |
1445 | MKDEV(SCSI_GENERIC_MAJOR, | 1445 | cl_dev->parent, |
1446 | sdp->index), | 1446 | MKDEV(SCSI_GENERIC_MAJOR, |
1447 | "%s", disk->disk_name); | 1447 | sdp->index), |
1448 | sdp, | ||
1449 | "%s", disk->disk_name); | ||
1448 | if (IS_ERR(sg_class_member)) { | 1450 | if (IS_ERR(sg_class_member)) { |
1449 | printk(KERN_ERR "sg_add: " | 1451 | printk(KERN_ERR "sg_add: " |
1450 | "device_create failed\n"); | 1452 | "device_create failed\n"); |
1451 | error = PTR_ERR(sg_class_member); | 1453 | error = PTR_ERR(sg_class_member); |
1452 | goto cdev_add_err; | 1454 | goto cdev_add_err; |
1453 | } | 1455 | } |
1454 | dev_set_drvdata(sg_class_member, sdp); | ||
1455 | error = sysfs_create_link(&scsidp->sdev_gendev.kobj, | 1456 | error = sysfs_create_link(&scsidp->sdev_gendev.kobj, |
1456 | &sg_class_member->kobj, "generic"); | 1457 | &sg_class_member->kobj, "generic"); |
1457 | if (error) | 1458 | if (error) |
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index e8db66ad0bde..6e5a5bb31311 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
@@ -4424,17 +4424,19 @@ static int do_create_class_files(struct scsi_tape *STp, int dev_num, int mode) | |||
4424 | snprintf(name, 10, "%s%s%s", rew ? "n" : "", | 4424 | snprintf(name, 10, "%s%s%s", rew ? "n" : "", |
4425 | STp->disk->disk_name, st_formats[i]); | 4425 | STp->disk->disk_name, st_formats[i]); |
4426 | st_class_member = | 4426 | st_class_member = |
4427 | device_create(st_sysfs_class, &STp->device->sdev_gendev, | 4427 | device_create_drvdata(st_sysfs_class, |
4428 | MKDEV(SCSI_TAPE_MAJOR, | 4428 | &STp->device->sdev_gendev, |
4429 | TAPE_MINOR(dev_num, mode, rew)), | 4429 | MKDEV(SCSI_TAPE_MAJOR, |
4430 | "%s", name); | 4430 | TAPE_MINOR(dev_num, |
4431 | mode, rew)), | ||
4432 | &STp->modes[mode], | ||
4433 | "%s", name); | ||
4431 | if (IS_ERR(st_class_member)) { | 4434 | if (IS_ERR(st_class_member)) { |
4432 | printk(KERN_WARNING "st%d: device_create failed\n", | 4435 | printk(KERN_WARNING "st%d: device_create failed\n", |
4433 | dev_num); | 4436 | dev_num); |
4434 | error = PTR_ERR(st_class_member); | 4437 | error = PTR_ERR(st_class_member); |
4435 | goto out; | 4438 | goto out; |
4436 | } | 4439 | } |
4437 | dev_set_drvdata(st_class_member, &STp->modes[mode]); | ||
4438 | 4440 | ||
4439 | error = device_create_file(st_class_member, | 4441 | error = device_create_file(st_class_member, |
4440 | &dev_attr_defined); | 4442 | &dev_attr_defined); |
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index 55cc7b80422a..0a12e90ad416 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c | |||
@@ -649,15 +649,14 @@ int __uio_register_device(struct module *owner, | |||
649 | if (ret) | 649 | if (ret) |
650 | goto err_get_minor; | 650 | goto err_get_minor; |
651 | 651 | ||
652 | idev->dev = device_create(uio_class->class, parent, | 652 | idev->dev = device_create_drvdata(uio_class->class, parent, |
653 | MKDEV(uio_major, idev->minor), | 653 | MKDEV(uio_major, idev->minor), idev, |
654 | "uio%d", idev->minor); | 654 | "uio%d", idev->minor); |
655 | if (IS_ERR(idev->dev)) { | 655 | if (IS_ERR(idev->dev)) { |
656 | printk(KERN_ERR "UIO: device register failed\n"); | 656 | printk(KERN_ERR "UIO: device register failed\n"); |
657 | ret = PTR_ERR(idev->dev); | 657 | ret = PTR_ERR(idev->dev); |
658 | goto err_device_create; | 658 | goto err_device_create; |
659 | } | 659 | } |
660 | dev_set_drvdata(idev->dev, idev); | ||
661 | 660 | ||
662 | ret = uio_dev_add_attributes(idev); | 661 | ret = uio_dev_add_attributes(idev); |
663 | if (ret) | 662 | if (ret) |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index bf10e9c4195e..09a53e7f3327 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -818,12 +818,12 @@ static int usb_register_bus(struct usb_bus *bus) | |||
818 | set_bit (busnum, busmap.busmap); | 818 | set_bit (busnum, busmap.busmap); |
819 | bus->busnum = busnum; | 819 | bus->busnum = busnum; |
820 | 820 | ||
821 | bus->dev = device_create(usb_host_class, bus->controller, MKDEV(0, 0), | 821 | bus->dev = device_create_drvdata(usb_host_class, bus->controller, |
822 | "usb_host%d", busnum); | 822 | MKDEV(0, 0), bus, |
823 | "usb_host%d", busnum); | ||
823 | result = PTR_ERR(bus->dev); | 824 | result = PTR_ERR(bus->dev); |
824 | if (IS_ERR(bus->dev)) | 825 | if (IS_ERR(bus->dev)) |
825 | goto error_create_class_dev; | 826 | goto error_create_class_dev; |
826 | dev_set_drvdata(bus->dev, bus); | ||
827 | 827 | ||
828 | /* Add it to the local list of buses */ | 828 | /* Add it to the local list of buses */ |
829 | list_add (&bus->bus_list, &usb_bus_list); | 829 | list_add (&bus->bus_list, &usb_bus_list); |
diff --git a/drivers/usb/misc/phidgetkit.c b/drivers/usb/misc/phidgetkit.c index 24230c638b8e..4cfa25b0f44e 100644 --- a/drivers/usb/misc/phidgetkit.c +++ b/drivers/usb/misc/phidgetkit.c | |||
@@ -595,14 +595,14 @@ static int interfacekit_probe(struct usb_interface *intf, const struct usb_devic | |||
595 | } while(value); | 595 | } while(value); |
596 | kit->dev_no = bit; | 596 | kit->dev_no = bit; |
597 | 597 | ||
598 | kit->dev = device_create(phidget_class, &kit->udev->dev, 0, | 598 | kit->dev = device_create_drvdata(phidget_class, &kit->udev->dev, |
599 | "interfacekit%d", kit->dev_no); | 599 | MKDEV(0, 0), kit, |
600 | "interfacekit%d", kit->dev_no); | ||
600 | if (IS_ERR(kit->dev)) { | 601 | if (IS_ERR(kit->dev)) { |
601 | rc = PTR_ERR(kit->dev); | 602 | rc = PTR_ERR(kit->dev); |
602 | kit->dev = NULL; | 603 | kit->dev = NULL; |
603 | goto out; | 604 | goto out; |
604 | } | 605 | } |
605 | dev_set_drvdata(kit->dev, kit); | ||
606 | 606 | ||
607 | if (usb_submit_urb(kit->irq, GFP_KERNEL)) { | 607 | if (usb_submit_urb(kit->irq, GFP_KERNEL)) { |
608 | rc = -EIO; | 608 | rc = -EIO; |
diff --git a/drivers/usb/misc/phidgetmotorcontrol.c b/drivers/usb/misc/phidgetmotorcontrol.c index f0113c17cc5a..9b4696f21b22 100644 --- a/drivers/usb/misc/phidgetmotorcontrol.c +++ b/drivers/usb/misc/phidgetmotorcontrol.c | |||
@@ -365,16 +365,15 @@ static int motorcontrol_probe(struct usb_interface *intf, const struct usb_devic | |||
365 | } while(value); | 365 | } while(value); |
366 | mc->dev_no = bit; | 366 | mc->dev_no = bit; |
367 | 367 | ||
368 | mc->dev = device_create(phidget_class, &mc->udev->dev, 0, | 368 | mc->dev = device_create_drvdata(phidget_class, &mc->udev->dev, |
369 | "motorcontrol%d", mc->dev_no); | 369 | MKDEV(0, 0), mc, |
370 | "motorcontrol%d", mc->dev_no); | ||
370 | if (IS_ERR(mc->dev)) { | 371 | if (IS_ERR(mc->dev)) { |
371 | rc = PTR_ERR(mc->dev); | 372 | rc = PTR_ERR(mc->dev); |
372 | mc->dev = NULL; | 373 | mc->dev = NULL; |
373 | goto out; | 374 | goto out; |
374 | } | 375 | } |
375 | 376 | ||
376 | dev_set_drvdata(mc->dev, mc); | ||
377 | |||
378 | if (usb_submit_urb(mc->irq, GFP_KERNEL)) { | 377 | if (usb_submit_urb(mc->irq, GFP_KERNEL)) { |
379 | rc = -EIO; | 378 | rc = -EIO; |
380 | goto out; | 379 | goto out; |
diff --git a/drivers/usb/misc/phidgetservo.c b/drivers/usb/misc/phidgetservo.c index 7d590c09434a..1ca7ddb41d4d 100644 --- a/drivers/usb/misc/phidgetservo.c +++ b/drivers/usb/misc/phidgetservo.c | |||
@@ -275,14 +275,14 @@ servo_probe(struct usb_interface *interface, const struct usb_device_id *id) | |||
275 | } while (value); | 275 | } while (value); |
276 | dev->dev_no = bit; | 276 | dev->dev_no = bit; |
277 | 277 | ||
278 | dev->dev = device_create(phidget_class, &dev->udev->dev, 0, | 278 | dev->dev = device_create_drvdata(phidget_class, &dev->udev->dev, |
279 | "servo%d", dev->dev_no); | 279 | MKDEV(0, 0), dev, |
280 | "servo%d", dev->dev_no); | ||
280 | if (IS_ERR(dev->dev)) { | 281 | if (IS_ERR(dev->dev)) { |
281 | rc = PTR_ERR(dev->dev); | 282 | rc = PTR_ERR(dev->dev); |
282 | dev->dev = NULL; | 283 | dev->dev = NULL; |
283 | goto out; | 284 | goto out; |
284 | } | 285 | } |
285 | dev_set_drvdata(dev->dev, dev); | ||
286 | 286 | ||
287 | servo_count = dev->type & SERVO_COUNT_QUAD ? 4 : 1; | 287 | servo_count = dev->type & SERVO_COUNT_QUAD ? 4 : 1; |
288 | 288 | ||
diff --git a/drivers/video/display/display-sysfs.c b/drivers/video/display/display-sysfs.c index 35477177bef4..6ef800bdf482 100644 --- a/drivers/video/display/display-sysfs.c +++ b/drivers/video/display/display-sysfs.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/ctype.h> | 26 | #include <linux/ctype.h> |
27 | #include <linux/idr.h> | 27 | #include <linux/idr.h> |
28 | #include <linux/err.h> | 28 | #include <linux/err.h> |
29 | #include <linux/kdev_t.h> | ||
29 | 30 | ||
30 | static ssize_t display_show_name(struct device *dev, | 31 | static ssize_t display_show_name(struct device *dev, |
31 | struct device_attribute *attr, char *buf) | 32 | struct device_attribute *attr, char *buf) |
@@ -152,10 +153,13 @@ struct display_device *display_device_register(struct display_driver *driver, | |||
152 | mutex_unlock(&allocated_dsp_lock); | 153 | mutex_unlock(&allocated_dsp_lock); |
153 | 154 | ||
154 | if (!ret) { | 155 | if (!ret) { |
155 | new_dev->dev = device_create(display_class, parent, 0, | 156 | new_dev->dev = device_create_drvdata(display_class, |
156 | "display%d", new_dev->idx); | 157 | parent, |
158 | MKDEV(0,0), | ||
159 | new_dev, | ||
160 | "display%d", | ||
161 | new_dev->idx); | ||
157 | if (!IS_ERR(new_dev->dev)) { | 162 | if (!IS_ERR(new_dev->dev)) { |
158 | dev_set_drvdata(new_dev->dev, new_dev); | ||
159 | new_dev->parent = parent; | 163 | new_dev->parent = parent; |
160 | new_dev->driver = driver; | 164 | new_dev->driver = driver; |
161 | mutex_init(&new_dev->lock); | 165 | mutex_init(&new_dev->lock); |