]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
USB: musb: convert platform driver to use dev_groups
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 5 Aug 2019 19:36:32 +0000 (21:36 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Aug 2019 05:52:04 +0000 (07:52 +0200)
Platform drivers now have the option to have the platform core create
and remove any needed sysfs attribute files.  So take advantage of that
and do not register "by hand" any sysfs files.

Acked-by: Bin Liu <b-liu@ti.com>
Link: https://lore.kernel.org/r/20190805193636.25560-2-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/musb/musb_core.c

index 2bc55e0ceacecdefd3fab62b804717ef6e2766e3..bd63450af76a95d1cb2bd069acf8d2ae41b5c6e6 100644 (file)
@@ -1829,16 +1829,13 @@ static ssize_t srp_store(struct device *dev, struct device_attribute *attr,
 }
 static DEVICE_ATTR_WO(srp);
 
-static struct attribute *musb_attributes[] = {
+static struct attribute *musb_attrs[] = {
        &dev_attr_mode.attr,
        &dev_attr_vbus.attr,
        &dev_attr_srp.attr,
        NULL
 };
-
-static const struct attribute_group musb_attr_group = {
-       .attrs = musb_attributes,
-};
+ATTRIBUTE_GROUPS(musb);
 
 #define MUSB_QUIRK_B_INVALID_VBUS_91   (MUSB_DEVCTL_BDEVICE | \
                                         (2 << MUSB_DEVCTL_VBUS_SHIFT) | \
@@ -2038,10 +2035,6 @@ static void musb_free(struct musb *musb)
         * cleanup after everything's been de-activated.
         */
 
-#ifdef CONFIG_SYSFS
-       sysfs_remove_group(&musb->controller->kobj, &musb_attr_group);
-#endif
-
        if (musb->nIrq >= 0) {
                if (musb->irq_wake)
                        disable_irq_wake(musb->nIrq);
@@ -2390,22 +2383,12 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
 
        musb_init_debugfs(musb);
 
-       status = sysfs_create_group(&musb->controller->kobj, &musb_attr_group);
-       if (status)
-               goto fail5;
-
        musb->is_initialized = 1;
        pm_runtime_mark_last_busy(musb->controller);
        pm_runtime_put_autosuspend(musb->controller);
 
        return 0;
 
-fail5:
-       musb_exit_debugfs(musb);
-
-       musb_gadget_cleanup(musb);
-       musb_host_cleanup(musb);
-
 fail3:
        cancel_delayed_work_sync(&musb->irq_work);
        cancel_delayed_work_sync(&musb->finish_resume_work);
@@ -2798,6 +2781,7 @@ static struct platform_driver musb_driver = {
                .name           = (char *)musb_driver_name,
                .bus            = &platform_bus_type,
                .pm             = MUSB_DEV_PM_OPS,
+               .dev_groups     = musb_groups,
        },
        .probe          = musb_probe,
        .remove         = musb_remove,