浏览代码

USB: add the usbfs devices file to debugfs

People are very used to the devices file in usbfs.  Now that we have
moved usbfs to be an "embedded" option only, the developers miss the
file, they had grown quite attached to it over all of these years.  This
patch brings it back and puts it in the usb debugfs directory, so that
the developers don't feel sad anymore.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Greg Kroah-Hartman 16 年之前
父节点
当前提交
97d7b7a41b
共有 2 个文件被更改,包括 15 次插入2 次删除
  1. 2 2
      drivers/usb/core/Makefile
  2. 13 0
      drivers/usb/core/usb.c

+ 2 - 2
drivers/usb/core/Makefile

@@ -4,14 +4,14 @@
 
 
 usbcore-objs	:= usb.o hub.o hcd.o urb.o message.o driver.o \
 usbcore-objs	:= usb.o hub.o hcd.o urb.o message.o driver.o \
 			config.o file.o buffer.o sysfs.o endpoint.o \
 			config.o file.o buffer.o sysfs.o endpoint.o \
-			devio.o notify.o generic.o quirks.o
+			devio.o notify.o generic.o quirks.o devices.o
 
 
 ifeq ($(CONFIG_PCI),y)
 ifeq ($(CONFIG_PCI),y)
 	usbcore-objs	+= hcd-pci.o
 	usbcore-objs	+= hcd-pci.o
 endif
 endif
 
 
 ifeq ($(CONFIG_USB_DEVICEFS),y)
 ifeq ($(CONFIG_USB_DEVICEFS),y)
-	usbcore-objs	+= inode.o devices.o
+	usbcore-objs	+= inode.o
 endif
 endif
 
 
 obj-$(CONFIG_USB)	+= usbcore.o
 obj-$(CONFIG_USB)	+= usbcore.o

+ 13 - 0
drivers/usb/core/usb.c

@@ -1005,16 +1005,29 @@ static struct notifier_block usb_bus_nb = {
 struct dentry *usb_debug_root;
 struct dentry *usb_debug_root;
 EXPORT_SYMBOL_GPL(usb_debug_root);
 EXPORT_SYMBOL_GPL(usb_debug_root);
 
 
+struct dentry *usb_debug_devices;
+
 static int usb_debugfs_init(void)
 static int usb_debugfs_init(void)
 {
 {
 	usb_debug_root = debugfs_create_dir("usb", NULL);
 	usb_debug_root = debugfs_create_dir("usb", NULL);
 	if (!usb_debug_root)
 	if (!usb_debug_root)
 		return -ENOENT;
 		return -ENOENT;
+
+	usb_debug_devices = debugfs_create_file("devices", 0444,
+						usb_debug_root, NULL,
+						&usbfs_devices_fops);
+	if (!usb_debug_devices) {
+		debugfs_remove(usb_debug_root);
+		usb_debug_root = NULL;
+		return -ENOENT;
+	}
+
 	return 0;
 	return 0;
 }
 }
 
 
 static void usb_debugfs_cleanup(void)
 static void usb_debugfs_cleanup(void)
 {
 {
+	debugfs_remove(usb_debug_devices);
 	debugfs_remove(usb_debug_root);
 	debugfs_remove(usb_debug_root);
 }
 }