diff options
author | Felipe Balbi <felipe.balbi@nokia.com> | 2009-12-15 04:08:38 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-02 17:53:29 -0500 |
commit | 94375751d1d8af70df08beebdc32595f9e4537e1 (patch) | |
tree | 557511b3bc5d6806d04e191856d4e1eacb5f81a6 /drivers/usb/musb | |
parent | b3b1cc3ba62374e71155ba8c09ee481c3c2d923e (diff) |
USB: musb: move to sysfs_groups
it's easier to keep up and add more sysfs entries
as necessary.
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/musb')
-rw-r--r-- | drivers/usb/musb/musb_core.c | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 91c31f2e0edc..52295bcf2313 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -1759,6 +1759,19 @@ static DEVICE_ATTR(srp, 0644, NULL, musb_srp_store); | |||
1759 | 1759 | ||
1760 | #endif /* CONFIG_USB_GADGET_MUSB_HDRC */ | 1760 | #endif /* CONFIG_USB_GADGET_MUSB_HDRC */ |
1761 | 1761 | ||
1762 | static struct attribute *musb_attributes[] = { | ||
1763 | &dev_attr_mode.attr, | ||
1764 | &dev_attr_vbus.attr, | ||
1765 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
1766 | &dev_attr_srp.attr, | ||
1767 | #endif | ||
1768 | NULL | ||
1769 | }; | ||
1770 | |||
1771 | static const struct attribute_group musb_attr_group = { | ||
1772 | .attrs = musb_attributes, | ||
1773 | }; | ||
1774 | |||
1762 | #endif /* sysfs */ | 1775 | #endif /* sysfs */ |
1763 | 1776 | ||
1764 | /* Only used to provide driver mode change events */ | 1777 | /* Only used to provide driver mode change events */ |
@@ -1833,11 +1846,7 @@ static void musb_free(struct musb *musb) | |||
1833 | */ | 1846 | */ |
1834 | 1847 | ||
1835 | #ifdef CONFIG_SYSFS | 1848 | #ifdef CONFIG_SYSFS |
1836 | device_remove_file(musb->controller, &dev_attr_mode); | 1849 | sysfs_remove_group(&musb->controller->kobj, &musb_attr_group); |
1837 | device_remove_file(musb->controller, &dev_attr_vbus); | ||
1838 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
1839 | device_remove_file(musb->controller, &dev_attr_srp); | ||
1840 | #endif | ||
1841 | #endif | 1850 | #endif |
1842 | 1851 | ||
1843 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | 1852 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC |
@@ -2079,12 +2088,7 @@ bad_config: | |||
2079 | } | 2088 | } |
2080 | 2089 | ||
2081 | #ifdef CONFIG_SYSFS | 2090 | #ifdef CONFIG_SYSFS |
2082 | status = device_create_file(dev, &dev_attr_mode); | 2091 | status = sysfs_create_group(&musb->controller->kobj, &musb_attr_group); |
2083 | status = device_create_file(dev, &dev_attr_vbus); | ||
2084 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
2085 | status = device_create_file(dev, &dev_attr_srp); | ||
2086 | #endif /* CONFIG_USB_GADGET_MUSB_HDRC */ | ||
2087 | status = 0; | ||
2088 | #endif | 2092 | #endif |
2089 | if (status) | 2093 | if (status) |
2090 | goto fail2; | 2094 | goto fail2; |
@@ -2092,13 +2096,6 @@ bad_config: | |||
2092 | return 0; | 2096 | return 0; |
2093 | 2097 | ||
2094 | fail2: | 2098 | fail2: |
2095 | #ifdef CONFIG_SYSFS | ||
2096 | device_remove_file(musb->controller, &dev_attr_mode); | ||
2097 | device_remove_file(musb->controller, &dev_attr_vbus); | ||
2098 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
2099 | device_remove_file(musb->controller, &dev_attr_srp); | ||
2100 | #endif | ||
2101 | #endif | ||
2102 | musb_platform_exit(musb); | 2099 | musb_platform_exit(musb); |
2103 | fail: | 2100 | fail: |
2104 | dev_err(musb->controller, | 2101 | dev_err(musb->controller, |