diff options
Diffstat (limited to 'drivers/usb/core/file.c')
-rw-r--r-- | drivers/usb/core/file.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c index 65ca131cc44c..e695308095ae 100644 --- a/drivers/usb/core/file.c +++ b/drivers/usb/core/file.c | |||
@@ -17,7 +17,6 @@ | |||
17 | 17 | ||
18 | #include <linux/config.h> | 18 | #include <linux/config.h> |
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/devfs_fs_kernel.h> | ||
21 | #include <linux/spinlock.h> | 20 | #include <linux/spinlock.h> |
22 | #include <linux/errno.h> | 21 | #include <linux/errno.h> |
23 | 22 | ||
@@ -88,8 +87,6 @@ int usb_major_init(void) | |||
88 | goto out; | 87 | goto out; |
89 | } | 88 | } |
90 | 89 | ||
91 | devfs_mk_dir("usb"); | ||
92 | |||
93 | out: | 90 | out: |
94 | return error; | 91 | return error; |
95 | } | 92 | } |
@@ -97,7 +94,6 @@ out: | |||
97 | void usb_major_cleanup(void) | 94 | void usb_major_cleanup(void) |
98 | { | 95 | { |
99 | class_destroy(usb_class); | 96 | class_destroy(usb_class); |
100 | devfs_remove("usb"); | ||
101 | unregister_chrdev(USB_MAJOR, "usb"); | 97 | unregister_chrdev(USB_MAJOR, "usb"); |
102 | } | 98 | } |
103 | 99 | ||
@@ -112,8 +108,7 @@ void usb_major_cleanup(void) | |||
112 | * enabled, the minor number will be based on the next available free minor, | 108 | * enabled, the minor number will be based on the next available free minor, |
113 | * starting at the class_driver->minor_base. | 109 | * starting at the class_driver->minor_base. |
114 | * | 110 | * |
115 | * This function also creates the devfs file for the usb device, if devfs | 111 | * This function also creates a usb class device in the sysfs tree. |
116 | * is enabled, and creates a usb class device in the sysfs tree. | ||
117 | * | 112 | * |
118 | * usb_deregister_dev() must be called when the driver is done with | 113 | * usb_deregister_dev() must be called when the driver is done with |
119 | * the minor numbers given out by this function. | 114 | * the minor numbers given out by this function. |
@@ -162,22 +157,20 @@ int usb_register_dev(struct usb_interface *intf, | |||
162 | 157 | ||
163 | intf->minor = minor; | 158 | intf->minor = minor; |
164 | 159 | ||
165 | /* handle the devfs registration */ | ||
166 | snprintf(name, BUS_ID_SIZE, class_driver->name, minor - minor_base); | ||
167 | devfs_mk_cdev(MKDEV(USB_MAJOR, minor), class_driver->mode, name); | ||
168 | |||
169 | /* create a usb class device for this usb interface */ | 160 | /* create a usb class device for this usb interface */ |
161 | snprintf(name, BUS_ID_SIZE, class_driver->name, minor - minor_base); | ||
170 | temp = strrchr(name, '/'); | 162 | temp = strrchr(name, '/'); |
171 | if (temp && (temp[1] != 0x00)) | 163 | if (temp && (temp[1] != 0x00)) |
172 | ++temp; | 164 | ++temp; |
173 | else | 165 | else |
174 | temp = name; | 166 | temp = name; |
175 | intf->class_dev = class_device_create(usb_class, MKDEV(USB_MAJOR, minor), &intf->dev, "%s", temp); | 167 | intf->class_dev = class_device_create(usb_class, NULL, |
168 | MKDEV(USB_MAJOR, minor), | ||
169 | &intf->dev, "%s", temp); | ||
176 | if (IS_ERR(intf->class_dev)) { | 170 | if (IS_ERR(intf->class_dev)) { |
177 | spin_lock (&minor_lock); | 171 | spin_lock (&minor_lock); |
178 | usb_minors[intf->minor] = NULL; | 172 | usb_minors[intf->minor] = NULL; |
179 | spin_unlock (&minor_lock); | 173 | spin_unlock (&minor_lock); |
180 | devfs_remove (name); | ||
181 | retval = PTR_ERR(intf->class_dev); | 174 | retval = PTR_ERR(intf->class_dev); |
182 | } | 175 | } |
183 | exit: | 176 | exit: |
@@ -195,9 +188,8 @@ EXPORT_SYMBOL(usb_register_dev); | |||
195 | * call to usb_register_dev() (usually when the device is disconnected | 188 | * call to usb_register_dev() (usually when the device is disconnected |
196 | * from the system.) | 189 | * from the system.) |
197 | * | 190 | * |
198 | * This function also cleans up the devfs file for the usb device, if devfs | 191 | * This function also removes the usb class device from the sysfs tree. |
199 | * is enabled, and removes the usb class device from the sysfs tree. | 192 | * |
200 | * | ||
201 | * This should be called by all drivers that use the USB major number. | 193 | * This should be called by all drivers that use the USB major number. |
202 | */ | 194 | */ |
203 | void usb_deregister_dev(struct usb_interface *intf, | 195 | void usb_deregister_dev(struct usb_interface *intf, |
@@ -220,7 +212,6 @@ void usb_deregister_dev(struct usb_interface *intf, | |||
220 | spin_unlock (&minor_lock); | 212 | spin_unlock (&minor_lock); |
221 | 213 | ||
222 | snprintf(name, BUS_ID_SIZE, class_driver->name, intf->minor - minor_base); | 214 | snprintf(name, BUS_ID_SIZE, class_driver->name, intf->minor - minor_base); |
223 | devfs_remove (name); | ||
224 | class_device_destroy(usb_class, MKDEV(USB_MAJOR, intf->minor)); | 215 | class_device_destroy(usb_class, MKDEV(USB_MAJOR, intf->minor)); |
225 | intf->class_dev = NULL; | 216 | intf->class_dev = NULL; |
226 | intf->minor = -1; | 217 | intf->minor = -1; |