aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/core/file.c13
-rw-r--r--include/linux/usb.h5
2 files changed, 9 insertions, 9 deletions
diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c
index f794f07cfb33..01c857ac27af 100644
--- a/drivers/usb/core/file.c
+++ b/drivers/usb/core/file.c
@@ -194,14 +194,13 @@ int usb_register_dev(struct usb_interface *intf,
194 ++temp; 194 ++temp;
195 else 195 else
196 temp = name; 196 temp = name;
197 intf->class_dev = class_device_create(usb_class->class, NULL, 197 intf->usb_dev = device_create(usb_class->class, &intf->dev,
198 MKDEV(USB_MAJOR, minor), 198 MKDEV(USB_MAJOR, minor), "%s", temp);
199 &intf->dev, "%s", temp); 199 if (IS_ERR(intf->usb_dev)) {
200 if (IS_ERR(intf->class_dev)) {
201 spin_lock (&minor_lock); 200 spin_lock (&minor_lock);
202 usb_minors[intf->minor] = NULL; 201 usb_minors[intf->minor] = NULL;
203 spin_unlock (&minor_lock); 202 spin_unlock (&minor_lock);
204 retval = PTR_ERR(intf->class_dev); 203 retval = PTR_ERR(intf->usb_dev);
205 } 204 }
206exit: 205exit:
207 return retval; 206 return retval;
@@ -242,8 +241,8 @@ void usb_deregister_dev(struct usb_interface *intf,
242 spin_unlock (&minor_lock); 241 spin_unlock (&minor_lock);
243 242
244 snprintf(name, BUS_ID_SIZE, class_driver->name, intf->minor - minor_base); 243 snprintf(name, BUS_ID_SIZE, class_driver->name, intf->minor - minor_base);
245 class_device_destroy(usb_class->class, MKDEV(USB_MAJOR, intf->minor)); 244 device_destroy(usb_class->class, MKDEV(USB_MAJOR, intf->minor));
246 intf->class_dev = NULL; 245 intf->usb_dev = NULL;
247 intf->minor = -1; 246 intf->minor = -1;
248 destroy_usb_class(); 247 destroy_usb_class();
249} 248}
diff --git a/include/linux/usb.h b/include/linux/usb.h
index f18ced001924..d6bf1297d886 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -107,7 +107,8 @@ enum usb_interface_condition {
107 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup 107 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup
108 * capability during autosuspend. 108 * capability during autosuspend.
109 * @dev: driver model's view of this device 109 * @dev: driver model's view of this device
110 * @class_dev: driver model's class view of this device. 110 * @usb_dev: if an interface is bound to the USB major, this will point
111 * to the sysfs representation for that device.
111 * @pm_usage_cnt: PM usage counter for this interface; autosuspend is not 112 * @pm_usage_cnt: PM usage counter for this interface; autosuspend is not
112 * allowed unless the counter is 0. 113 * allowed unless the counter is 0.
113 * 114 *
@@ -152,7 +153,7 @@ struct usb_interface {
152 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */ 153 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */
153 154
154 struct device dev; /* interface specific device info */ 155 struct device dev; /* interface specific device info */
155 struct class_device *class_dev; 156 struct device *usb_dev; /* pointer to the usb class's device, if any */
156 int pm_usage_cnt; /* usage counter for autosuspend */ 157 int pm_usage_cnt; /* usage counter for autosuspend */
157}; 158};
158#define to_usb_interface(d) container_of(d, struct usb_interface, dev) 159#define to_usb_interface(d) container_of(d, struct usb_interface, dev)