History

[PATCH] USB: convert usb class devices to real devices

Greg Kroah-Hartman committed 20 years ago

Commit bd009491 parent c1822742 files · +9 −9Browse files

Unified · Split

2 files
  1. drivers/usb/core/file.c +6 −7
  2. include/linux/usb.h +3 −2
drivers/usb/core/file.c+6−7
@@ -158,14 +158,13 @@ int usb_register_dev(struct usb_interface *intf, · 157 unmodified lines
158 ++temp;158 ++temp;
159 else159 else
160 temp = name;160 temp = name;
161 intf->class_dev = class_device_create(usb_class, NULL,161 intf->usb_dev = device_create(usb_class, &intf->dev,
162 MKDEV(USB_MAJOR, minor),162 MKDEV(USB_MAJOR, minor), "%s", temp);
163 &intf->dev, "%s", temp);163 if (IS_ERR(intf->usb_dev)) {
164 if (IS_ERR(intf->class_dev)) {
165 spin_lock (&minor_lock);164 spin_lock (&minor_lock);
166 usb_minors[intf->minor] = NULL;165 usb_minors[intf->minor] = NULL;
167 spin_unlock (&minor_lock);166 spin_unlock (&minor_lock);
168 retval = PTR_ERR(intf->class_dev);167 retval = PTR_ERR(intf->usb_dev);
169 }168 }
170exit:169exit:
171 return retval;170 return retval;
@@ -206,8 +205,8 @@ void usb_deregister_dev(struct usb_interface *intf, · 34 unmodified lines
206 spin_unlock (&minor_lock);205 spin_unlock (&minor_lock);
207 206
208 snprintf(name, BUS_ID_SIZE, class_driver->name, intf->minor - minor_base);207 snprintf(name, BUS_ID_SIZE, class_driver->name, intf->minor - minor_base);
209 class_device_destroy(usb_class, MKDEV(USB_MAJOR, intf->minor));208 device_destroy(usb_class, MKDEV(USB_MAJOR, intf->minor));
210 intf->class_dev = NULL;209 intf->usb_dev = NULL;
211 intf->minor = -1;210 intf->minor = -1;
212}211}
213EXPORT_SYMBOL(usb_deregister_dev);212EXPORT_SYMBOL(usb_deregister_dev);
include/linux/usb.h+3−2
@@ -103,7 +103,8 @@ enum usb_interface_condition { · 102 unmodified lines
103 * @condition: binding state of the interface: not bound, binding103 * @condition: binding state of the interface: not bound, binding
104 * (in probe()), bound to a driver, or unbinding (in disconnect())104 * (in probe()), bound to a driver, or unbinding (in disconnect())
105 * @dev: driver model's view of this device105 * @dev: driver model's view of this device
106 * @class_dev: driver model's class view of this device.106 * @usb_dev: if an interface is bound to the USB major, this will point
107 * to the sysfs representation for that device.
107 *108 *
108 * USB device drivers attach to interfaces on a physical device. Each109 * USB device drivers attach to interfaces on a physical device. Each
109 * interface encapsulates a single high level function, such as feeding110 * interface encapsulates a single high level function, such as feeding
@@ -143,7 +144,7 @@ struct usb_interface { · 33 unmodified lines
143 * bound to */144 * bound to */
144 enum usb_interface_condition condition; /* state of binding */145 enum usb_interface_condition condition; /* state of binding */
145 struct device dev; /* interface specific device info */146 struct device dev; /* interface specific device info */
146 struct class_device *class_dev;147 struct device *usb_dev; /* pointer to the usb class's device, if any */
147};148};
148#define to_usb_interface(d) container_of(d, struct usb_interface, dev)149#define to_usb_interface(d) container_of(d, struct usb_interface, dev)
149#define interface_to_usbdev(intf) \150#define interface_to_usbdev(intf) \