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>
This commit is contained in:
Felipe Balbi 2009-12-15 11:08:38 +02:00 committed by Greg Kroah-Hartman
parent b3b1cc3ba6
commit 94375751d1
1 changed files with 15 additions and 18 deletions

View File

@ -1759,6 +1759,19 @@ static DEVICE_ATTR(srp, 0644, NULL, musb_srp_store);
#endif /* CONFIG_USB_GADGET_MUSB_HDRC */ #endif /* CONFIG_USB_GADGET_MUSB_HDRC */
static struct attribute *musb_attributes[] = {
&dev_attr_mode.attr,
&dev_attr_vbus.attr,
#ifdef CONFIG_USB_GADGET_MUSB_HDRC
&dev_attr_srp.attr,
#endif
NULL
};
static const struct attribute_group musb_attr_group = {
.attrs = musb_attributes,
};
#endif /* sysfs */ #endif /* sysfs */
/* Only used to provide driver mode change events */ /* Only used to provide driver mode change events */
@ -1833,11 +1846,7 @@ static void musb_free(struct musb *musb)
*/ */
#ifdef CONFIG_SYSFS #ifdef CONFIG_SYSFS
device_remove_file(musb->controller, &dev_attr_mode); sysfs_remove_group(&musb->controller->kobj, &musb_attr_group);
device_remove_file(musb->controller, &dev_attr_vbus);
#ifdef CONFIG_USB_GADGET_MUSB_HDRC
device_remove_file(musb->controller, &dev_attr_srp);
#endif
#endif #endif
#ifdef CONFIG_USB_GADGET_MUSB_HDRC #ifdef CONFIG_USB_GADGET_MUSB_HDRC
@ -2079,12 +2088,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
} }
#ifdef CONFIG_SYSFS #ifdef CONFIG_SYSFS
status = device_create_file(dev, &dev_attr_mode); status = sysfs_create_group(&musb->controller->kobj, &musb_attr_group);
status = device_create_file(dev, &dev_attr_vbus);
#ifdef CONFIG_USB_GADGET_MUSB_HDRC
status = device_create_file(dev, &dev_attr_srp);
#endif /* CONFIG_USB_GADGET_MUSB_HDRC */
status = 0;
#endif #endif
if (status) if (status)
goto fail2; goto fail2;
@ -2092,13 +2096,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
return 0; return 0;
fail2: fail2:
#ifdef CONFIG_SYSFS
device_remove_file(musb->controller, &dev_attr_mode);
device_remove_file(musb->controller, &dev_attr_vbus);
#ifdef CONFIG_USB_GADGET_MUSB_HDRC
device_remove_file(musb->controller, &dev_attr_srp);
#endif
#endif
musb_platform_exit(musb); musb_platform_exit(musb);
fail: fail:
dev_err(musb->controller, dev_err(musb->controller,