瀏覽代碼

[PATCH] USB: move usb_device_class class devices to be real devices

This moves the usb class devices that control the usbfs nodes to show up
in the proper place in the larger device tree.

No userspace changes is needed, this is compatible due to the symlinks
generated by the driver core.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Greg Kroah-Hartman 19 年之前
父節點
當前提交
c182274ffe
共有 2 個文件被更改,包括 11 次插入11 次删除
  1. 10 10
      drivers/usb/core/devio.c
  2. 1 1
      include/linux/usb.h

+ 10 - 10
drivers/usb/core/devio.c

@@ -515,19 +515,19 @@ static int check_ctrlrecip(struct dev_state *ps, unsigned int requesttype, unsig
 
 
 static struct usb_device *usbdev_lookup_minor(int minor)
 static struct usb_device *usbdev_lookup_minor(int minor)
 {
 {
-	struct class_device *class_dev;
-	struct usb_device *dev = NULL;
+	struct device *device;
+	struct usb_device *udev = NULL;
 
 
 	down(&usb_device_class->sem);
 	down(&usb_device_class->sem);
-	list_for_each_entry(class_dev, &usb_device_class->children, node) {
-		if (class_dev->devt == MKDEV(USB_DEVICE_MAJOR, minor)) {
-			dev = class_dev->class_data;
+	list_for_each_entry(device, &usb_device_class->devices, node) {
+		if (device->devt == MKDEV(USB_DEVICE_MAJOR, minor)) {
+			udev = device->platform_data;
 			break;
 			break;
 		}
 		}
 	}
 	}
 	up(&usb_device_class->sem);
 	up(&usb_device_class->sem);
 
 
-	return dev;
+	return udev;
 };
 };
 
 
 /*
 /*
@@ -1580,16 +1580,16 @@ static void usbdev_add(struct usb_device *dev)
 {
 {
 	int minor = ((dev->bus->busnum-1) * 128) + (dev->devnum-1);
 	int minor = ((dev->bus->busnum-1) * 128) + (dev->devnum-1);
 
 
-	dev->class_dev = class_device_create(usb_device_class, NULL,
-				MKDEV(USB_DEVICE_MAJOR, minor), &dev->dev,
+	dev->usbfs_dev = device_create(usb_device_class, &dev->dev,
+				MKDEV(USB_DEVICE_MAJOR, minor),
 				"usbdev%d.%d", dev->bus->busnum, dev->devnum);
 				"usbdev%d.%d", dev->bus->busnum, dev->devnum);
 
 
-	dev->class_dev->class_data = dev;
+	dev->usbfs_dev->platform_data = dev;
 }
 }
 
 
 static void usbdev_remove(struct usb_device *dev)
 static void usbdev_remove(struct usb_device *dev)
 {
 {
-	class_device_unregister(dev->class_dev);
+	device_unregister(dev->usbfs_dev);
 }
 }
 
 
 static int usbdev_notify(struct notifier_block *self, unsigned long action,
 static int usbdev_notify(struct notifier_block *self, unsigned long action,

+ 1 - 1
include/linux/usb.h

@@ -360,7 +360,7 @@ struct usb_device {
 	char *serial;			/* iSerialNumber string, if present */
 	char *serial;			/* iSerialNumber string, if present */
 
 
 	struct list_head filelist;
 	struct list_head filelist;
-	struct class_device *class_dev;
+	struct device *usbfs_dev;
 	struct dentry *usbfs_dentry;	/* usbfs dentry entry for the device */
 	struct dentry *usbfs_dentry;	/* usbfs dentry entry for the device */
 
 
 	/*
 	/*