forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-09 244b2c5ca8b14627e4a17755e5922221e121c771
kernel/drivers/video/fbdev/sm501fb.c
....@@ -1,12 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /* linux/drivers/video/sm501fb.c
23 *
34 * Copyright (c) 2006 Simtec Electronics
45 * Vincent Sanders <vince@simtec.co.uk>
56 * Ben Dooks <ben@simtec.co.uk>
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License version 2 as
9
- * published by the Free Software Foundation.
107 *
118 * Framebuffer driver for the Silicon Motion SM501
129 */
....@@ -1008,7 +1005,7 @@
10081005 case FB_BLANK_POWERDOWN:
10091006 ctrl &= ~SM501_DC_CRT_CONTROL_ENABLE;
10101007 sm501_misc_control(fbi->dev->parent, SM501_MISC_DAC_POWER, 0);
1011
- /* fall through */
1008
+ fallthrough;
10121009
10131010 case FB_BLANK_NORMAL:
10141011 ctrl |= SM501_DC_CRT_CONTROL_BLANK;
....@@ -1273,6 +1270,14 @@
12731270 }
12741271
12751272 static DEVICE_ATTR(fbregs_pnl, 0444, sm501fb_debug_show_pnl, NULL);
1273
+
1274
+static struct attribute *sm501fb_attrs[] = {
1275
+ &dev_attr_crt_src.attr,
1276
+ &dev_attr_fbregs_pnl.attr,
1277
+ &dev_attr_fbregs_crt.attr,
1278
+ NULL,
1279
+};
1280
+ATTRIBUTE_GROUPS(sm501fb);
12761281
12771282 /* acceleration operations */
12781283 static int sm501fb_sync(struct fb_info *info)
....@@ -1868,10 +1873,8 @@
18681873 }
18691874
18701875 fbi = framebuffer_alloc(sizeof(struct sm501fb_par), info->dev);
1871
- if (fbi == NULL) {
1872
- dev_err(info->dev, "cannot allocate %s framebuffer\n", name);
1876
+ if (!fbi)
18731877 return -ENOMEM;
1874
- }
18751878
18761879 par = fbi->par;
18771880 par->info = info;
....@@ -2016,32 +2019,8 @@
20162019 goto err_started_crt;
20172020 }
20182021
2019
- /* create device files */
2020
-
2021
- ret = device_create_file(dev, &dev_attr_crt_src);
2022
- if (ret)
2023
- goto err_started_panel;
2024
-
2025
- ret = device_create_file(dev, &dev_attr_fbregs_pnl);
2026
- if (ret)
2027
- goto err_attached_crtsrc_file;
2028
-
2029
- ret = device_create_file(dev, &dev_attr_fbregs_crt);
2030
- if (ret)
2031
- goto err_attached_pnlregs_file;
2032
-
20332022 /* we registered, return ok */
20342023 return 0;
2035
-
2036
-err_attached_pnlregs_file:
2037
- device_remove_file(dev, &dev_attr_fbregs_pnl);
2038
-
2039
-err_attached_crtsrc_file:
2040
- device_remove_file(dev, &dev_attr_crt_src);
2041
-
2042
-err_started_panel:
2043
- unregister_framebuffer(info->fb[HEAD_PANEL]);
2044
- sm501_free_init_fb(info, HEAD_PANEL);
20452024
20462025 err_started_crt:
20472026 unregister_framebuffer(info->fb[HEAD_CRT]);
....@@ -2071,10 +2050,6 @@
20712050 struct sm501fb_info *info = platform_get_drvdata(pdev);
20722051 struct fb_info *fbinfo_crt = info->fb[0];
20732052 struct fb_info *fbinfo_pnl = info->fb[1];
2074
-
2075
- device_remove_file(&pdev->dev, &dev_attr_fbregs_crt);
2076
- device_remove_file(&pdev->dev, &dev_attr_fbregs_pnl);
2077
- device_remove_file(&pdev->dev, &dev_attr_crt_src);
20782053
20792054 sm501_free_init_fb(info, HEAD_CRT);
20802055 sm501_free_init_fb(info, HEAD_PANEL);
....@@ -2239,6 +2214,7 @@
22392214 .resume = sm501fb_resume,
22402215 .driver = {
22412216 .name = "sm501-fb",
2217
+ .dev_groups = sm501fb_groups,
22422218 },
22432219 };
22442220