video: fbdev: w100fb: convert platform driver to use dev_groups
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 31 Jul 2019 12:43:48 +0000 (14:43 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 Aug 2019 11:21:23 +0000 (13:21 +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: Tony Prisk <linux@prisktech.co.nz>
Cc: linux-arm-kernel@lists.infradead.org
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-10-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/video/fbdev/w100fb.c

index 597ffaa..3be0780 100644 (file)
@@ -164,6 +164,15 @@ static ssize_t fastpllclk_store(struct device *dev, struct device_attribute *att
 
 static DEVICE_ATTR_RW(fastpllclk);
 
+static struct attribute *w100fb_attrs[] = {
+       &dev_attr_fastpllclk.attr,
+       &dev_attr_reg_read.attr,
+       &dev_attr_reg_write.attr,
+       &dev_attr_flip.attr,
+       NULL,
+};
+ATTRIBUTE_GROUPS(w100fb);
+
 /*
  * Some touchscreens need hsync information from the video driver to
  * function correctly. We export it here.
@@ -752,14 +761,6 @@ int w100fb_probe(struct platform_device *pdev)
                goto out;
        }
 
-       err = device_create_file(&pdev->dev, &dev_attr_fastpllclk);
-       err |= device_create_file(&pdev->dev, &dev_attr_reg_read);
-       err |= device_create_file(&pdev->dev, &dev_attr_reg_write);
-       err |= device_create_file(&pdev->dev, &dev_attr_flip);
-
-       if (err != 0)
-               fb_warn(info, "failed to register attributes (%d)\n", err);
-
        fb_info(info, "%s frame buffer device\n", info->fix.id);
        return 0;
 out:
@@ -784,11 +785,6 @@ static int w100fb_remove(struct platform_device *pdev)
        struct fb_info *info = platform_get_drvdata(pdev);
        struct w100fb_par *par=info->par;
 
-       device_remove_file(&pdev->dev, &dev_attr_fastpllclk);
-       device_remove_file(&pdev->dev, &dev_attr_reg_read);
-       device_remove_file(&pdev->dev, &dev_attr_reg_write);
-       device_remove_file(&pdev->dev, &dev_attr_flip);
-
        unregister_framebuffer(info);
 
        vfree(par->saved_intmem);
@@ -1625,6 +1621,7 @@ static struct platform_driver w100fb_driver = {
        .resume         = w100fb_resume,
        .driver         = {
                .name   = "w100fb",
+               .dev_groups     = w100fb_groups,
        },
 };