All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org,
	Richard Gong <richard.gong@linux.intel.com>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: [PATCH v2 02/10] uio: uio_fsl_elbc_gpcm: convert platform driver to use dev_groups
Date: Wed, 31 Jul 2019 14:43:41 +0200	[thread overview]
Message-ID: <20190731124349.4474-3-gregkh@linuxfoundation.org> (raw)
In-Reply-To: <20190731124349.4474-1-gregkh@linuxfoundation.org>

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" a sysfs group of attributes.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/uio/uio_fsl_elbc_gpcm.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/drivers/uio/uio_fsl_elbc_gpcm.c b/drivers/uio/uio_fsl_elbc_gpcm.c
index 450e2f5c9b43..be8a6905f507 100644
--- a/drivers/uio/uio_fsl_elbc_gpcm.c
+++ b/drivers/uio/uio_fsl_elbc_gpcm.c
@@ -71,6 +71,13 @@ static ssize_t reg_store(struct device *dev, struct device_attribute *attr,
 static DEVICE_ATTR(reg_br, 0664, reg_show, reg_store);
 static DEVICE_ATTR(reg_or, 0664, reg_show, reg_store);
 
+static struct attribute *uio_fsl_elbc_gpcm_attrs[] = {
+	&dev_attr_reg_br.attr,
+	&dev_attr_reg_or.attr,
+	NULL,
+};
+ATTRIBUTE_GROUPS(uio_fsl_elbc_gpcm);
+
 static ssize_t reg_show(struct device *dev, struct device_attribute *attr,
 			char *buf)
 {
@@ -411,25 +418,12 @@ static int uio_fsl_elbc_gpcm_probe(struct platform_device *pdev)
 	/* store private data */
 	platform_set_drvdata(pdev, info);
 
-	/* create sysfs files */
-	ret = device_create_file(priv->dev, &dev_attr_reg_br);
-	if (ret)
-		goto out_err3;
-	ret = device_create_file(priv->dev, &dev_attr_reg_or);
-	if (ret)
-		goto out_err4;
-
 	dev_info(priv->dev,
 		 "eLBC/GPCM device (%s) at 0x%llx, bank %d, irq=%d\n",
 		 priv->name, (unsigned long long)res.start, priv->bank,
 		 irq != NO_IRQ ? irq : -1);
 
 	return 0;
-out_err4:
-	device_remove_file(priv->dev, &dev_attr_reg_br);
-out_err3:
-	platform_set_drvdata(pdev, NULL);
-	uio_unregister_device(info);
 out_err2:
 	if (priv->shutdown)
 		priv->shutdown(info, true);
@@ -448,8 +442,6 @@ static int uio_fsl_elbc_gpcm_remove(struct platform_device *pdev)
 	struct uio_info *info = platform_get_drvdata(pdev);
 	struct fsl_elbc_gpcm *priv = info->priv;
 
-	device_remove_file(priv->dev, &dev_attr_reg_or);
-	device_remove_file(priv->dev, &dev_attr_reg_br);
 	platform_set_drvdata(pdev, NULL);
 	uio_unregister_device(info);
 	if (priv->shutdown)
@@ -474,6 +466,7 @@ static struct platform_driver uio_fsl_elbc_gpcm_driver = {
 	.driver = {
 		.name = "fsl,elbc-gpcm-uio",
 		.of_match_table = uio_fsl_elbc_gpcm_match,
+		.dev_groups = uio_fsl_elbc_gpcm_groups,
 	},
 	.probe = uio_fsl_elbc_gpcm_probe,
 	.remove = uio_fsl_elbc_gpcm_remove,
-- 
2.22.0


  parent reply	other threads:[~2019-07-31 12:44 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-31 12:43 [PATCH v2 00/10] drivers, provide a way to add sysfs groups easily Greg Kroah-Hartman
2019-07-31 12:43 ` Greg Kroah-Hartman
2019-07-31 12:43 ` Greg Kroah-Hartman
2019-07-31 12:43 ` Greg Kroah-Hartman
2019-07-31 12:43 ` [PATCH v2 01/10] driver core: add dev_groups to all drivers Greg Kroah-Hartman
2019-07-31 12:49   ` Takashi Iwai
2019-07-31 12:51     ` Greg Kroah-Hartman
2019-07-31 13:08       ` Dmitry Torokhov
2019-07-31 13:21         ` Greg Kroah-Hartman
2019-07-31 15:51   ` Richard Gong
2019-07-31 12:43 ` Greg Kroah-Hartman [this message]
2019-07-31 12:43 ` [PATCH v2 03/10] input: keyboard: gpio_keys: convert platform driver to use dev_groups Greg Kroah-Hartman
2019-07-31 12:43   ` Greg Kroah-Hartman
2019-07-31 12:43   ` Greg Kroah-Hartman
2019-08-12  6:59   ` Dmitry Torokhov
2019-08-12  6:59     ` Dmitry Torokhov
2019-07-31 12:43 ` [PATCH v2 04/10] input: axp20x-pek: " Greg Kroah-Hartman
2019-08-12  6:59   ` Dmitry Torokhov
2019-07-31 12:43 ` [PATCH v2 05/10] firmware: arm_scpi: " Greg Kroah-Hartman
2019-07-31 12:43   ` Greg Kroah-Hartman
2019-07-31 12:43 ` [PATCH v2 06/10] olpc: x01: " Greg Kroah-Hartman
2019-07-31 12:43 ` [PATCH v2 07/10] platform: x86: hp-wmi: " Greg Kroah-Hartman
2019-07-31 12:43 ` [PATCH v2 08/10] video: fbdev: wm8505fb: " Greg Kroah-Hartman
2019-07-31 12:43   ` Greg Kroah-Hartman
2019-07-31 12:43   ` Greg Kroah-Hartman
2019-07-31 12:43   ` Greg Kroah-Hartman
2019-07-31 12:43 ` [PATCH v2 09/10] video: fbdev: w100fb: " Greg Kroah-Hartman
2019-07-31 12:43   ` Greg Kroah-Hartman
2019-07-31 12:43   ` Greg Kroah-Hartman
2019-07-31 12:43   ` Greg Kroah-Hartman
2019-07-31 12:43 ` [PATCH v2 10/10] video: fbdev: sm501fb: " Greg Kroah-Hartman
2019-07-31 12:43   ` Greg Kroah-Hartman
2019-07-31 13:10 ` [PATCH v2 00/10] drivers, provide a way to add sysfs groups easily Dmitry Torokhov
2019-07-31 13:10   ` Dmitry Torokhov
2019-07-31 13:10   ` Dmitry Torokhov
2019-07-31 13:22   ` Greg Kroah-Hartman
2019-07-31 13:22     ` Greg Kroah-Hartman
2019-07-31 13:22     ` Greg Kroah-Hartman
2019-07-31 13:22     ` Greg Kroah-Hartman
2019-07-31 13:38   ` Andy Shevchenko
2019-07-31 13:38     ` Andy Shevchenko
2019-07-31 13:38     ` Andy Shevchenko
2019-07-31 13:46     ` Dmitry Torokhov
2019-07-31 13:46       ` Dmitry Torokhov
2019-07-31 13:46       ` Dmitry Torokhov
2019-08-02 10:46   ` Greg Kroah-Hartman
2019-08-02 10:46     ` Greg Kroah-Hartman
2019-08-02 10:46     ` Greg Kroah-Hartman
2019-08-02 10:46     ` Greg Kroah-Hartman
2020-05-13 22:18     ` Emil Velikov
2020-05-13 22:18       ` Emil Velikov
2020-05-13 22:18       ` Emil Velikov
2020-05-13 22:18       ` Emil Velikov
2020-05-13 22:18       ` Emil Velikov
2020-05-14  7:16       ` Greg Kroah-Hartman
2020-05-14  7:16         ` Greg Kroah-Hartman
2020-05-14  7:16         ` Greg Kroah-Hartman
2020-05-14  7:16         ` Greg Kroah-Hartman
2020-05-14  7:16         ` Greg Kroah-Hartman
2020-05-14 11:48         ` Emil Velikov
2020-05-14 11:48           ` Emil Velikov
2020-05-14 11:48           ` Emil Velikov
2020-05-14 11:48           ` Emil Velikov
2020-05-14 11:48           ` Emil Velikov

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=20190731124349.4474-3-gregkh@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=richard.gong@linux.intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.