[patch 08/16] usb: usb_register_bus() - add sysfs group for authorized_default

[email protected]
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
07-usb-usb-register-bus-add-sysfs-group-for-authorized-default.patch (text/plain, 1.8 KB)
This patch adds the hookup of the
/sys/class/usb_host/*/authorized_default to usb_register_bus() and
usb_unregister_bus().

Signed-off-by: Inaky Perez-Gonzalez <[email protected]>


---
 drivers/usb/core/hcd.c |    9 +++++++++
 1 file changed, 9 insertions(+)

Index: linux.hg/drivers/usb/core/hcd.c
===================================================================
--- linux.hg.orig/drivers/usb/core/hcd.c	2007-07-09 14:16:39.000000000 -0700
+++ linux.hg/drivers/usb/core/hcd.c	2007-07-09 14:16:39.000000000 -0700
@@ -788,6 +788,12 @@
 	if (IS_ERR(bus->class_dev))
 		goto error_create_class_dev;
 	class_set_devdata(bus->class_dev, bus);
+	result = sysfs_create_group(&bus->class_dev->kobj, &usb_bus_attr_group);
+	if (result < 0) {
+		printk(KERN_ERR "Cannot register USB bus attributes: %d\n",
+		       result);
+		goto error_create_attr_group;
+	}
 
 	/* Add it to the local list of buses */
 	list_add (&bus->bus_list, &usb_bus_list);
@@ -799,6 +805,8 @@
 		  "number %d\n", bus->busnum);
 	return 0;
 
+error_create_attr_group:
+	class_device_unregister(bus->class_dev);
 error_create_class_dev:
 	clear_bit(busnum, busmap.busmap);
 error_find_busnum:
@@ -831,6 +839,7 @@
 
 	clear_bit (bus->busnum, busmap.busmap);
 
+	sysfs_remove_group(&bus->class_dev->kobj, &usb_bus_attr_group);
 	class_device_unregister(bus->class_dev);
 }
 

--

Inaky

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.