linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-usb@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Bin Liu <b-liu@ti.com>
Subject: [PATCH] USB: musb: convert platform driver to use dev_groups
Date: Mon,  5 Aug 2019 21:36:32 +0200	[thread overview]
Message-ID: <20190805193636.25560-2-gregkh@linuxfoundation.org> (raw)

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.

Cc: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/musb/musb_core.c | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 2bc55e0ceace..bd63450af76a 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -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,
-- 
2.22.0


         reply	other threads:[~2019-08-05 19:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-06 14:44 [PATCH 00/12] USB: dev_groups support for usb drivers Greg Kroah-Hartman
2019-08-05 19:36 ` Greg Kroah-Hartman [this message]
2019-08-07 18:25   ` [PATCH] USB: musb: convert platform driver to use dev_groups Bin Liu
2019-08-06 14:44 ` [PATCH 01/12] USB: add support for dev_groups to struct usb_driver Greg Kroah-Hartman
2019-08-06 14:44 ` [PATCH 02/12] USB: add support for dev_groups to struct usb_device_driver Greg Kroah-Hartman
2019-08-06 14:44 ` [PATCH 03/12] USB: atm: cxacru: convert to use dev_groups Greg Kroah-Hartman
2019-08-06 14:44 ` [PATCH 04/12] USB: ueagle-atm: " Greg Kroah-Hartman
2019-08-06 14:44 ` [PATCH 05/12] USB: usblp: " Greg Kroah-Hartman
2019-08-08 20:35   ` Pete Zaitcev
2019-08-06 14:44 ` [PATCH 06/12] USB: usbtmc: " Greg Kroah-Hartman
2019-08-06 14:44 ` [PATCH 07/12] USB: cypress_cy7c63: " Greg Kroah-Hartman
2019-08-06 14:44 ` [PATCH 08/12] USB: cytherm: " Greg Kroah-Hartman
2019-08-06 14:44 ` [PATCH 09/12] USB: lvstest: " Greg Kroah-Hartman
2019-08-06 14:45 ` [PATCH 10/12] USB: trancevibrator: " Greg Kroah-Hartman
2019-08-06 14:45 ` [PATCH 11/12] USB: usbsevseg: " Greg Kroah-Hartman
2019-08-06 14:45 ` [PATCH 12/12] USB: usbip: " Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190805193636.25560-2-gregkh@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=b-liu@ti.com \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).