| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* linux/drivers/video/sm501fb.c |
|---|
| 2 | 3 | * |
|---|
| 3 | 4 | * Copyright (c) 2006 Simtec Electronics |
|---|
| 4 | 5 | * Vincent Sanders <vince@simtec.co.uk> |
|---|
| 5 | 6 | * 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. |
|---|
| 10 | 7 | * |
|---|
| 11 | 8 | * Framebuffer driver for the Silicon Motion SM501 |
|---|
| 12 | 9 | */ |
|---|
| .. | .. |
|---|
| 1008 | 1005 | case FB_BLANK_POWERDOWN: |
|---|
| 1009 | 1006 | ctrl &= ~SM501_DC_CRT_CONTROL_ENABLE; |
|---|
| 1010 | 1007 | sm501_misc_control(fbi->dev->parent, SM501_MISC_DAC_POWER, 0); |
|---|
| 1011 | | - /* fall through */ |
|---|
| 1008 | + fallthrough; |
|---|
| 1012 | 1009 | |
|---|
| 1013 | 1010 | case FB_BLANK_NORMAL: |
|---|
| 1014 | 1011 | ctrl |= SM501_DC_CRT_CONTROL_BLANK; |
|---|
| .. | .. |
|---|
| 1273 | 1270 | } |
|---|
| 1274 | 1271 | |
|---|
| 1275 | 1272 | 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); |
|---|
| 1276 | 1281 | |
|---|
| 1277 | 1282 | /* acceleration operations */ |
|---|
| 1278 | 1283 | static int sm501fb_sync(struct fb_info *info) |
|---|
| .. | .. |
|---|
| 1868 | 1873 | } |
|---|
| 1869 | 1874 | |
|---|
| 1870 | 1875 | 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) |
|---|
| 1873 | 1877 | return -ENOMEM; |
|---|
| 1874 | | - } |
|---|
| 1875 | 1878 | |
|---|
| 1876 | 1879 | par = fbi->par; |
|---|
| 1877 | 1880 | par->info = info; |
|---|
| .. | .. |
|---|
| 2016 | 2019 | goto err_started_crt; |
|---|
| 2017 | 2020 | } |
|---|
| 2018 | 2021 | |
|---|
| 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 | | - |
|---|
| 2033 | 2022 | /* we registered, return ok */ |
|---|
| 2034 | 2023 | 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); |
|---|
| 2045 | 2024 | |
|---|
| 2046 | 2025 | err_started_crt: |
|---|
| 2047 | 2026 | unregister_framebuffer(info->fb[HEAD_CRT]); |
|---|
| .. | .. |
|---|
| 2071 | 2050 | struct sm501fb_info *info = platform_get_drvdata(pdev); |
|---|
| 2072 | 2051 | struct fb_info *fbinfo_crt = info->fb[0]; |
|---|
| 2073 | 2052 | 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); |
|---|
| 2078 | 2053 | |
|---|
| 2079 | 2054 | sm501_free_init_fb(info, HEAD_CRT); |
|---|
| 2080 | 2055 | sm501_free_init_fb(info, HEAD_PANEL); |
|---|
| .. | .. |
|---|
| 2239 | 2214 | .resume = sm501fb_resume, |
|---|
| 2240 | 2215 | .driver = { |
|---|
| 2241 | 2216 | .name = "sm501-fb", |
|---|
| 2217 | + .dev_groups = sm501fb_groups, |
|---|
| 2242 | 2218 | }, |
|---|
| 2243 | 2219 | }; |
|---|
| 2244 | 2220 | |
|---|