Skip to content

Commit

Permalink
USB: musb: move to sysfs_groups
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Felipe Balbi authored and Greg Kroah-Hartman committed Mar 2, 2010
1 parent b3b1cc3 commit 9437575
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions drivers/usb/musb/musb_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1759,6 +1759,19 @@ static DEVICE_ATTR(srp, 0644, NULL, musb_srp_store);

#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 */

/* Only used to provide driver mode change events */
Expand Down Expand Up @@ -1833,11 +1846,7 @@ static void musb_free(struct musb *musb)
*/

#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
sysfs_remove_group(&musb->controller->kobj, &musb_attr_group);
#endif

#ifdef CONFIG_USB_GADGET_MUSB_HDRC
Expand Down Expand Up @@ -2079,26 +2088,14 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
}

#ifdef CONFIG_SYSFS
status = device_create_file(dev, &dev_attr_mode);
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;
status = sysfs_create_group(&musb->controller->kobj, &musb_attr_group);
#endif
if (status)
goto fail2;

return 0;

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);
fail:
dev_err(musb->controller,
Expand Down

0 comments on commit 9437575

Please sign in to comment.