hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/hid/hid-picolcd_fb.c
....@@ -1,20 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /***************************************************************************
23 * Copyright (C) 2010-2012 by Bruno Prémont <bonbons@linux-vserver.org> *
34 * *
45 * Based on Logitech G13 driver (v0.4) *
56 * Copyright (C) 2009 by Rick L. Vinyard, Jr. <rvinyard@cs.nmsu.edu> *
67 * *
7
- * This program is free software: you can redistribute it and/or modify *
8
- * it under the terms of the GNU General Public License as published by *
9
- * the Free Software Foundation, version 2 of the License. *
10
- * *
11
- * This driver is distributed in the hope that it will be useful, but *
12
- * WITHOUT ANY WARRANTY; without even the implied warranty of *
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14
- * General Public License for more details. *
15
- * *
16
- * You should have received a copy of the GNU General Public License *
17
- * along with this software. If not see <http://www.gnu.org/licenses/>. *
188 ***************************************************************************/
199
2010 #include <linux/hid.h>
....@@ -427,8 +417,7 @@
427417 return 0;
428418 }
429419
430
-/* Note this can't be const because of struct fb_info definition */
431
-static struct fb_ops picolcdfb_ops = {
420
+static const struct fb_ops picolcdfb_ops = {
432421 .owner = THIS_MODULE,
433422 .fb_destroy = picolcd_fb_destroy,
434423 .fb_read = fb_sys_read,
....@@ -469,9 +458,9 @@
469458 if (ret >= PAGE_SIZE)
470459 break;
471460 else if (i == fb_update_rate)
472
- ret += snprintf(buf+ret, PAGE_SIZE-ret, "[%u] ", i);
461
+ ret += scnprintf(buf+ret, PAGE_SIZE-ret, "[%u] ", i);
473462 else
474
- ret += snprintf(buf+ret, PAGE_SIZE-ret, "%u ", i);
463
+ ret += scnprintf(buf+ret, PAGE_SIZE-ret, "%u ", i);
475464 if (ret > 0)
476465 buf[min(ret, (size_t)PAGE_SIZE)-1] = '\n';
477466 return ret;
....@@ -522,10 +511,8 @@
522511 sizeof(struct fb_deferred_io) +
523512 sizeof(struct picolcd_fb_data) +
524513 PICOLCDFB_SIZE, dev);
525
- if (info == NULL) {
526
- dev_err(dev, "failed to allocate a framebuffer\n");
514
+ if (!info)
527515 goto err_nomem;
528
- }
529516
530517 info->fbdefio = info->par;
531518 *info->fbdefio = picolcd_fb_defio;