]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
video: fbdev: sm501fb: convert platform driver to use dev_groups
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 31 Jul 2019 12:43:49 +0000 (14:43 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 Aug 2019 11:22:37 +0000 (13:22 +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" 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>
Link: https://lore.kernel.org/r/20190731124349.4474-11-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/video/fbdev/sm501fb.c

index 6edb4492e67566d8d8ccba796b504588d22f725c..3dd1b1d76e983a799fd07536ed0edfb68dc7ed7f 100644 (file)
@@ -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,
        },
 };