From: Greg Kroah-Hartman Date: Wed, 31 Jul 2019 12:43:49 +0000 (+0200) Subject: video: fbdev: sm501fb: convert platform driver to use dev_groups X-Git-Tag: v5.4-rc1~137^2~25 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=de3dacf0347e3dc6f63cd5abe944bc60077c5abf;p=linux.git video: fbdev: sm501fb: convert platform driver to use dev_groups 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 Signed-off-by: Greg Kroah-Hartman Link: https://lore.kernel.org/r/20190731124349.4474-11-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman --- 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, }, };