aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/core/sysfs.c')
-rw-r--r--drivers/usb/core/sysfs.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
index b04afd06e50..32bd130b1ee 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)
735 struct usb_host_interface *alt = intf->cur_altsetting; 735 struct usb_host_interface *alt = intf->cur_altsetting;
736 int retval; 736 int retval;
737 737
738 if (intf->sysfs_files_created)
739 return 0;
738 retval = sysfs_create_group(&dev->kobj, &intf_attr_grp); 740 retval = sysfs_create_group(&dev->kobj, &intf_attr_grp);
739 if (retval) 741 if (retval)
740 return retval; 742 return retval;
@@ -746,6 +748,7 @@ int usb_create_sysfs_intf_files(struct usb_interface *intf)
746 if (intf->intf_assoc) 748 if (intf->intf_assoc)
747 retval = sysfs_create_group(&dev->kobj, &intf_assoc_attr_grp); 749 retval = sysfs_create_group(&dev->kobj, &intf_assoc_attr_grp);
748 usb_create_intf_ep_files(intf, udev); 750 usb_create_intf_ep_files(intf, udev);
751 intf->sysfs_files_created = 1;
749 return 0; 752 return 0;
750} 753}
751 754
@@ -753,8 +756,11 @@ void usb_remove_sysfs_intf_files(struct usb_interface *intf)
753{ 756{
754 struct device *dev = &intf->dev; 757 struct device *dev = &intf->dev;
755 758
759 if (!intf->sysfs_files_created)
760 return;
756 usb_remove_intf_ep_files(intf); 761 usb_remove_intf_ep_files(intf);
757 device_remove_file(dev, &dev_attr_interface); 762 device_remove_file(dev, &dev_attr_interface);
758 sysfs_remove_group(&dev->kobj, &intf_attr_grp); 763 sysfs_remove_group(&dev->kobj, &intf_attr_grp);
759 sysfs_remove_group(&intf->dev.kobj, &intf_assoc_attr_grp); 764 sysfs_remove_group(&intf->dev.kobj, &intf_assoc_attr_grp);
765 intf->sysfs_files_created = 0;
760} 766}