diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2007-11-06 11:43:42 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-11-28 13:58:35 -0800 |
commit | 7e61559f6199bb387037abfc7d10a893973561fc (patch) | |
tree | dd3e8f8cca77077bc4567a047cfe9ee74d100525 /drivers/usb/core/sysfs.c | |
parent | 5fdcd0396be443e36a4e2128f51818acca570ee7 (diff) | |
download | linux-7e61559f6199bb387037abfc7d10a893973561fc.tar.bz2 |
USB: keep track of whether interface sysfs files exist
This patch (as1009) solves the problem of multiple registrations for
USB sysfs files in a more satisfying way than the existing code. It
simply adds a flag to keep track of whether or not the files have been
created; that way the files can be created or removed as needed.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Diffstat (limited to 'drivers/usb/core/sysfs.c')
-rw-r--r-- | drivers/usb/core/sysfs.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index b04afd06e502..32bd130b1eed 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c @@ -735,6 +735,8 @@ int usb_create_sysfs_intf_files(struct usb_interface *intf) struct usb_host_interface *alt = intf->cur_altsetting; int retval; + if (intf->sysfs_files_created) + return 0; retval = sysfs_create_group(&dev->kobj, &intf_attr_grp); if (retval) return retval; @@ -746,6 +748,7 @@ int usb_create_sysfs_intf_files(struct usb_interface *intf) if (intf->intf_assoc) retval = sysfs_create_group(&dev->kobj, &intf_assoc_attr_grp); usb_create_intf_ep_files(intf, udev); + intf->sysfs_files_created = 1; return 0; } @@ -753,8 +756,11 @@ void usb_remove_sysfs_intf_files(struct usb_interface *intf) { struct device *dev = &intf->dev; + if (!intf->sysfs_files_created) + return; usb_remove_intf_ep_files(intf); device_remove_file(dev, &dev_attr_interface); sysfs_remove_group(&dev->kobj, &intf_attr_grp); sysfs_remove_group(&intf->dev.kobj, &intf_assoc_attr_grp); + intf->sysfs_files_created = 0; } |