| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * linux/drivers/video/omap2/omapfb-sysfs.c |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 6 | 7 | * |
|---|
| 7 | 8 | * Some code and ideas taken from drivers/video/omap/ driver |
|---|
| 8 | 9 | * 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/>. |
|---|
| 21 | 10 | */ |
|---|
| 22 | 11 | |
|---|
| 23 | 12 | #include <linux/fb.h> |
|---|
| .. | .. |
|---|
| 60 | 49 | if (rot_type != OMAP_DSS_ROT_DMA && rot_type != OMAP_DSS_ROT_VRFB) |
|---|
| 61 | 50 | return -EINVAL; |
|---|
| 62 | 51 | |
|---|
| 63 | | - if (!lock_fb_info(fbi)) |
|---|
| 64 | | - return -ENODEV; |
|---|
| 52 | + lock_fb_info(fbi); |
|---|
| 65 | 53 | |
|---|
| 66 | 54 | r = 0; |
|---|
| 67 | 55 | if (rot_type == ofbi->rotation_type) |
|---|
| .. | .. |
|---|
| 112 | 100 | if (r) |
|---|
| 113 | 101 | return r; |
|---|
| 114 | 102 | |
|---|
| 115 | | - if (!lock_fb_info(fbi)) |
|---|
| 116 | | - return -ENODEV; |
|---|
| 103 | + lock_fb_info(fbi); |
|---|
| 117 | 104 | |
|---|
| 118 | 105 | ofbi->mirror = mirror; |
|---|
| 119 | 106 | |
|---|
| .. | .. |
|---|
| 149 | 136 | ssize_t l = 0; |
|---|
| 150 | 137 | int t; |
|---|
| 151 | 138 | |
|---|
| 152 | | - if (!lock_fb_info(fbi)) |
|---|
| 153 | | - return -ENODEV; |
|---|
| 139 | + lock_fb_info(fbi); |
|---|
| 154 | 140 | omapfb_lock(fbdev); |
|---|
| 155 | 141 | |
|---|
| 156 | 142 | for (t = 0; t < ofbi->num_overlays; t++) { |
|---|
| .. | .. |
|---|
| 161 | 147 | if (ovl == fbdev->overlays[ovlnum]) |
|---|
| 162 | 148 | break; |
|---|
| 163 | 149 | |
|---|
| 164 | | - l += snprintf(buf + l, PAGE_SIZE - l, "%s%d", |
|---|
| 150 | + l += scnprintf(buf + l, PAGE_SIZE - l, "%s%d", |
|---|
| 165 | 151 | t == 0 ? "" : ",", ovlnum); |
|---|
| 166 | 152 | } |
|---|
| 167 | 153 | |
|---|
| 168 | | - l += snprintf(buf + l, PAGE_SIZE - l, "\n"); |
|---|
| 154 | + l += scnprintf(buf + l, PAGE_SIZE - l, "\n"); |
|---|
| 169 | 155 | |
|---|
| 170 | 156 | omapfb_unlock(fbdev); |
|---|
| 171 | 157 | unlock_fb_info(fbi); |
|---|
| .. | .. |
|---|
| 208 | 194 | if (buf[len - 1] == '\n') |
|---|
| 209 | 195 | len = len - 1; |
|---|
| 210 | 196 | |
|---|
| 211 | | - if (!lock_fb_info(fbi)) |
|---|
| 212 | | - return -ENODEV; |
|---|
| 197 | + lock_fb_info(fbi); |
|---|
| 213 | 198 | omapfb_lock(fbdev); |
|---|
| 214 | 199 | |
|---|
| 215 | 200 | if (len > 0) { |
|---|
| .. | .. |
|---|
| 340 | 325 | ssize_t l = 0; |
|---|
| 341 | 326 | int t; |
|---|
| 342 | 327 | |
|---|
| 343 | | - if (!lock_fb_info(fbi)) |
|---|
| 344 | | - return -ENODEV; |
|---|
| 328 | + lock_fb_info(fbi); |
|---|
| 345 | 329 | |
|---|
| 346 | 330 | 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", |
|---|
| 348 | 332 | t == 0 ? "" : ",", ofbi->rotation[t]); |
|---|
| 349 | 333 | } |
|---|
| 350 | 334 | |
|---|
| 351 | | - l += snprintf(buf + l, PAGE_SIZE - l, "\n"); |
|---|
| 335 | + l += scnprintf(buf + l, PAGE_SIZE - l, "\n"); |
|---|
| 352 | 336 | |
|---|
| 353 | 337 | unlock_fb_info(fbi); |
|---|
| 354 | 338 | |
|---|
| .. | .. |
|---|
| 369 | 353 | if (buf[len - 1] == '\n') |
|---|
| 370 | 354 | len = len - 1; |
|---|
| 371 | 355 | |
|---|
| 372 | | - if (!lock_fb_info(fbi)) |
|---|
| 373 | | - return -ENODEV; |
|---|
| 356 | + lock_fb_info(fbi); |
|---|
| 374 | 357 | |
|---|
| 375 | 358 | if (len > 0) { |
|---|
| 376 | 359 | char *p = (char *)buf; |
|---|
| .. | .. |
|---|
| 453 | 436 | |
|---|
| 454 | 437 | size = PAGE_ALIGN(size); |
|---|
| 455 | 438 | |
|---|
| 456 | | - if (!lock_fb_info(fbi)) |
|---|
| 457 | | - return -ENODEV; |
|---|
| 439 | + lock_fb_info(fbi); |
|---|
| 458 | 440 | |
|---|
| 459 | 441 | if (display && display->driver->sync) |
|---|
| 460 | 442 | display->driver->sync(display); |
|---|