hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/drivers/video/fbdev/omap/omapfb_main.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Framebuffer driver for TI OMAP boards
34 *
....@@ -9,20 +10,6 @@
910 * Juha Yrjola <juha.yrjola@nokia.com> - Original driver and improvements
1011 * Dirk Behme <dirk.behme@de.bosch.com> - changes for 2.6 kernel API
1112 * Texas Instruments - H3 support
12
- *
13
- * This program is free software; you can redistribute it and/or modify it
14
- * under the terms of the GNU General Public License as published by the
15
- * Free Software Foundation; either version 2 of the License, or (at your
16
- * option) any later version.
17
- *
18
- * This program is distributed in the hope that it will be useful, but
19
- * WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21
- * General Public License for more details.
22
- *
23
- * You should have received a copy of the GNU General Public License along
24
- * with this program; if not, write to the Free Software Foundation, Inc.,
25
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2613 */
2714 #include <linux/platform_device.h>
2815 #include <linux/mm.h>
....@@ -47,11 +34,7 @@
4734 static unsigned int def_rotate;
4835 static unsigned int def_mirror;
4936
50
-#ifdef CONFIG_FB_OMAP_MANUAL_UPDATE
51
-static bool manual_update = 1;
52
-#else
53
-static bool manual_update;
54
-#endif
37
+static bool manual_update = IS_BUILTIN(CONFIG_FB_OMAP_MANUAL_UPDATE);
5538
5639 static struct platform_device *fbdev_pdev;
5740 static struct lcd_panel *fbdev_panel;
....@@ -270,7 +253,7 @@
270253 if (fbdev->ctrl->setcolreg)
271254 r = fbdev->ctrl->setcolreg(regno, red, green, blue,
272255 transp, update_hw_pal);
273
- /* Fallthrough */
256
+ fallthrough;
274257 case OMAPFB_COLOR_RGB565:
275258 case OMAPFB_COLOR_RGB444:
276259 if (r != 0)
....@@ -460,6 +443,7 @@
460443 return 0;
461444 case 12:
462445 var->bits_per_pixel = 16;
446
+ fallthrough;
463447 case 16:
464448 if (plane->fbdev->panel->bpp == 12)
465449 plane->color_mode = OMAPFB_COLOR_RGB444;
....@@ -1064,7 +1048,7 @@
10641048 {
10651049 struct omapfb_plane_struct *plane = fbi->par;
10661050 struct omapfb_device *fbdev = plane->fbdev;
1067
- struct fb_ops *ops = fbi->fbops;
1051
+ const struct fb_ops *ops = fbi->fbops;
10681052 union {
10691053 struct omapfb_update_window update_window;
10701054 struct omapfb_plane_info plane_info;
....@@ -1259,7 +1243,7 @@
12591243 size = 0;
12601244 while (size < PAGE_SIZE && plane < OMAPFB_PLANE_NUM) {
12611245 omapfb_get_caps(fbdev, plane, &caps);
1262
- size += snprintf(&buf[size], PAGE_SIZE - size,
1246
+ size += scnprintf(&buf[size], PAGE_SIZE - size,
12631247 "plane#%d %#010x %#010x %#010x\n",
12641248 plane, caps.ctrl, caps.plane_color, caps.wnd_color);
12651249 plane++;
....@@ -1280,28 +1264,28 @@
12801264 size = 0;
12811265 while (size < PAGE_SIZE && plane < OMAPFB_PLANE_NUM) {
12821266 omapfb_get_caps(fbdev, plane, &caps);
1283
- size += snprintf(&buf[size], PAGE_SIZE - size,
1267
+ size += scnprintf(&buf[size], PAGE_SIZE - size,
12841268 "plane#%d:\n", plane);
12851269 for (i = 0; i < ARRAY_SIZE(ctrl_caps) &&
12861270 size < PAGE_SIZE; i++) {
12871271 if (ctrl_caps[i].flag & caps.ctrl)
1288
- size += snprintf(&buf[size], PAGE_SIZE - size,
1272
+ size += scnprintf(&buf[size], PAGE_SIZE - size,
12891273 " %s\n", ctrl_caps[i].name);
12901274 }
1291
- size += snprintf(&buf[size], PAGE_SIZE - size,
1275
+ size += scnprintf(&buf[size], PAGE_SIZE - size,
12921276 " plane colors:\n");
12931277 for (i = 0; i < ARRAY_SIZE(color_caps) &&
12941278 size < PAGE_SIZE; i++) {
12951279 if (color_caps[i].flag & caps.plane_color)
1296
- size += snprintf(&buf[size], PAGE_SIZE - size,
1280
+ size += scnprintf(&buf[size], PAGE_SIZE - size,
12971281 " %s\n", color_caps[i].name);
12981282 }
1299
- size += snprintf(&buf[size], PAGE_SIZE - size,
1283
+ size += scnprintf(&buf[size], PAGE_SIZE - size,
13001284 " window colors:\n");
13011285 for (i = 0; i < ARRAY_SIZE(color_caps) &&
13021286 size < PAGE_SIZE; i++) {
13031287 if (color_caps[i].flag & caps.wnd_color)
1304
- size += snprintf(&buf[size], PAGE_SIZE - size,
1288
+ size += scnprintf(&buf[size], PAGE_SIZE - size,
13051289 " %s\n", color_caps[i].name);
13061290 }
13071291
....@@ -1515,8 +1499,6 @@
15151499 fbi = framebuffer_alloc(sizeof(struct omapfb_plane_struct),
15161500 fbdev->dev);
15171501 if (fbi == NULL) {
1518
- dev_err(fbdev->dev,
1519
- "unable to allocate memory for plane info\n");
15201502 planes_cleanup(fbdev);
15211503 return -ENOMEM;
15221504 }
....@@ -1549,20 +1531,27 @@
15491531 case OMAPFB_ACTIVE:
15501532 for (i = 0; i < fbdev->mem_desc.region_cnt; i++)
15511533 unregister_framebuffer(fbdev->fb_info[i]);
1534
+ fallthrough;
15521535 case 7:
15531536 omapfb_unregister_sysfs(fbdev);
1537
+ fallthrough;
15541538 case 6:
15551539 if (fbdev->panel->disable)
15561540 fbdev->panel->disable(fbdev->panel);
1541
+ fallthrough;
15571542 case 5:
15581543 omapfb_set_update_mode(fbdev, OMAPFB_UPDATE_DISABLED);
1544
+ fallthrough;
15591545 case 4:
15601546 planes_cleanup(fbdev);
1547
+ fallthrough;
15611548 case 3:
15621549 ctrl_cleanup(fbdev);
1550
+ fallthrough;
15631551 case 2:
15641552 if (fbdev->panel->cleanup)
15651553 fbdev->panel->cleanup(fbdev->panel);
1554
+ fallthrough;
15661555 case 1:
15671556 dev_set_drvdata(fbdev->dev, NULL);
15681557 kfree(fbdev);
....@@ -1865,7 +1854,7 @@
18651854 case 'm':
18661855 case 'M':
18671856 vram *= 1024;
1868
- /* Fall through */
1857
+ fallthrough;
18691858 case 'k':
18701859 case 'K':
18711860 vram *= 1024;