hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/drivers/video/fbdev/omap2/omapfb/omapfb-sysfs.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * linux/drivers/video/omap2/omapfb-sysfs.c
34 *
....@@ -6,18 +7,6 @@
67 *
78 * Some code and ideas taken from drivers/video/omap/ driver
89 * by Imre Deak.
9
- *
10
- * This program is free software; you can redistribute it and/or modify it
11
- * under the terms of the GNU General Public License version 2 as published by
12
- * the Free Software Foundation.
13
- *
14
- * This program is distributed in the hope that it will be useful, but WITHOUT
15
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17
- * more details.
18
- *
19
- * You should have received a copy of the GNU General Public License along with
20
- * this program. If not, see <http://www.gnu.org/licenses/>.
2110 */
2211
2312 #include <linux/fb.h>
....@@ -60,8 +49,7 @@
6049 if (rot_type != OMAP_DSS_ROT_DMA && rot_type != OMAP_DSS_ROT_VRFB)
6150 return -EINVAL;
6251
63
- if (!lock_fb_info(fbi))
64
- return -ENODEV;
52
+ lock_fb_info(fbi);
6553
6654 r = 0;
6755 if (rot_type == ofbi->rotation_type)
....@@ -112,8 +100,7 @@
112100 if (r)
113101 return r;
114102
115
- if (!lock_fb_info(fbi))
116
- return -ENODEV;
103
+ lock_fb_info(fbi);
117104
118105 ofbi->mirror = mirror;
119106
....@@ -149,8 +136,7 @@
149136 ssize_t l = 0;
150137 int t;
151138
152
- if (!lock_fb_info(fbi))
153
- return -ENODEV;
139
+ lock_fb_info(fbi);
154140 omapfb_lock(fbdev);
155141
156142 for (t = 0; t < ofbi->num_overlays; t++) {
....@@ -161,11 +147,11 @@
161147 if (ovl == fbdev->overlays[ovlnum])
162148 break;
163149
164
- l += snprintf(buf + l, PAGE_SIZE - l, "%s%d",
150
+ l += scnprintf(buf + l, PAGE_SIZE - l, "%s%d",
165151 t == 0 ? "" : ",", ovlnum);
166152 }
167153
168
- l += snprintf(buf + l, PAGE_SIZE - l, "\n");
154
+ l += scnprintf(buf + l, PAGE_SIZE - l, "\n");
169155
170156 omapfb_unlock(fbdev);
171157 unlock_fb_info(fbi);
....@@ -208,8 +194,7 @@
208194 if (buf[len - 1] == '\n')
209195 len = len - 1;
210196
211
- if (!lock_fb_info(fbi))
212
- return -ENODEV;
197
+ lock_fb_info(fbi);
213198 omapfb_lock(fbdev);
214199
215200 if (len > 0) {
....@@ -340,15 +325,14 @@
340325 ssize_t l = 0;
341326 int t;
342327
343
- if (!lock_fb_info(fbi))
344
- return -ENODEV;
328
+ lock_fb_info(fbi);
345329
346330 for (t = 0; t < ofbi->num_overlays; t++) {
347
- l += snprintf(buf + l, PAGE_SIZE - l, "%s%d",
331
+ l += scnprintf(buf + l, PAGE_SIZE - l, "%s%d",
348332 t == 0 ? "" : ",", ofbi->rotation[t]);
349333 }
350334
351
- l += snprintf(buf + l, PAGE_SIZE - l, "\n");
335
+ l += scnprintf(buf + l, PAGE_SIZE - l, "\n");
352336
353337 unlock_fb_info(fbi);
354338
....@@ -369,8 +353,7 @@
369353 if (buf[len - 1] == '\n')
370354 len = len - 1;
371355
372
- if (!lock_fb_info(fbi))
373
- return -ENODEV;
356
+ lock_fb_info(fbi);
374357
375358 if (len > 0) {
376359 char *p = (char *)buf;
....@@ -453,8 +436,7 @@
453436
454437 size = PAGE_ALIGN(size);
455438
456
- if (!lock_fb_info(fbi))
457
- return -ENODEV;
439
+ lock_fb_info(fbi);
458440
459441 if (display && display->driver->sync)
460442 display->driver->sync(display);