linux-kernel.vger.kernel.org archive mirror
 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>,
	dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Subject: [PATCH v2 10/10] video: fbdev: sm501fb: convert platform driver to use dev_groups
Date: Wed, 31 Jul 2019 14:43:49 +0200	[thread overview]
Message-ID: <20190731124349.4474-11-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 bunch of sysfs files.

Cc: dri-devel@lists.freedesktop.org
Cc: linux-fbdev@vger.kernel.org
Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/video/fbdev/sm501fb.c | 37 +++++++++--------------------------
 1 file changed, 9 insertions(+), 28 deletions(-)

diff --git a/drivers/video/fbdev/sm501fb.c b/drivers/video/fbdev/sm501fb.c
index 6edb4492e675..3dd1b1d76e98 100644
--- a/drivers/video/fbdev/sm501fb.c
+++ b/drivers/video/fbdev/sm501fb.c
@@ -1271,6 +1271,14 @@ static ssize_t sm501fb_debug_show_pnl(struct device *dev,
 
 static DEVICE_ATTR(fbregs_pnl, 0444, sm501fb_debug_show_pnl, NULL);
 
+static struct attribute *sm501fb_attrs[] = {
+	&dev_attr_crt_src.attr,
+	&dev_attr_fbregs_pnl.attr,
+	&dev_attr_fbregs_crt.attr,
+	NULL,
+};
+ATTRIBUTE_GROUPS(sm501fb);
+
 /* acceleration operations */
 static int sm501fb_sync(struct fb_info *info)
 {
@@ -2011,33 +2019,9 @@ static int sm501fb_probe(struct platform_device *pdev)
 		goto err_started_crt;
 	}
 
-	/* create device files */
-
-	ret = device_create_file(dev, &dev_attr_crt_src);
-	if (ret)
-		goto err_started_panel;
-
-	ret = device_create_file(dev, &dev_attr_fbregs_pnl);
-	if (ret)
-		goto err_attached_crtsrc_file;
-
-	ret = device_create_file(dev, &dev_attr_fbregs_crt);
-	if (ret)
-		goto err_attached_pnlregs_file;
-
 	/* we registered, return ok */
 	return 0;
 
-err_attached_pnlregs_file:
-	device_remove_file(dev, &dev_attr_fbregs_pnl);
-
-err_attached_crtsrc_file:
-	device_remove_file(dev, &dev_attr_crt_src);
-
-err_started_panel:
-	unregister_framebuffer(info->fb[HEAD_PANEL]);
-	sm501_free_init_fb(info, HEAD_PANEL);
-
 err_started_crt:
 	unregister_framebuffer(info->fb[HEAD_CRT]);
 	sm501_free_init_fb(info, HEAD_CRT);
@@ -2067,10 +2051,6 @@ static int sm501fb_remove(struct platform_device *pdev)
 	struct fb_info	   *fbinfo_crt = info->fb[0];
 	struct fb_info	   *fbinfo_pnl = info->fb[1];
 
-	device_remove_file(&pdev->dev, &dev_attr_fbregs_crt);
-	device_remove_file(&pdev->dev, &dev_attr_fbregs_pnl);
-	device_remove_file(&pdev->dev, &dev_attr_crt_src);
-
 	sm501_free_init_fb(info, HEAD_CRT);
 	sm501_free_init_fb(info, HEAD_PANEL);
 
@@ -2234,6 +2214,7 @@ static struct platform_driver sm501fb_driver = {
 	.resume		= sm501fb_resume,
 	.driver		= {
 		.name	= "sm501-fb",
+		.dev_groups	= sm501fb_groups,
 	},
 };
 
-- 
2.22.0


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

Thread overview: 26+ 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 ` [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 ` [PATCH v2 02/10] uio: uio_fsl_elbc_gpcm: convert platform driver to use dev_groups Greg Kroah-Hartman
2019-07-31 12:43 ` [PATCH v2 03/10] input: keyboard: gpio_keys: " Greg Kroah-Hartman
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 ` [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 ` [PATCH v2 09/10] video: fbdev: w100fb: " Greg Kroah-Hartman
2019-07-31 12:43 ` Greg Kroah-Hartman [this message]
2019-07-31 13:10 ` [PATCH v2 00/10] drivers, provide a way to add sysfs groups easily Dmitry Torokhov
2019-07-31 13:22   ` Greg Kroah-Hartman
2019-07-31 13:38   ` Andy Shevchenko
2019-07-31 13:46     ` Dmitry Torokhov
2019-08-02 10:46   ` Greg Kroah-Hartman
2020-05-13 22:18     ` Emil Velikov
2020-05-14  7:16       ` Greg Kroah-Hartman
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-11-gregkh@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=b.zolnierkie@samsung.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-fbdev@vger.kernel.org \
    --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 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).