hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/video/fbdev/cg14.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /* cg14.c: CGFOURTEEN frame buffer driver
23 *
34 * Copyright (C) 2003, 2006 David S. Miller (davem@davemloft.net)
....@@ -38,7 +39,7 @@
3839 * Frame buffer operations
3940 */
4041
41
-static struct fb_ops cg14_ops = {
42
+static const struct fb_ops cg14_ops = {
4243 .owner = THIS_MODULE,
4344 .fb_setcolreg = cg14_setcolreg,
4445 .fb_pan_display = cg14_pan_display,
....@@ -355,9 +356,7 @@
355356 static void cg14_init_fix(struct fb_info *info, int linebytes,
356357 struct device_node *dp)
357358 {
358
- const char *name = dp->name;
359
-
360
- strlcpy(info->fix.id, name, sizeof(info->fix.id));
359
+ snprintf(info->fix.id, sizeof(info->fix.id), "%pOFn", dp);
361360
362361 info->fix.type = FB_TYPE_PACKED_PIXELS;
363362 info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
....@@ -488,8 +487,8 @@
488487 info->var.xres);
489488 info->fix.smem_len = PAGE_ALIGN(linebytes * info->var.yres);
490489
491
- if (!strcmp(dp->parent->name, "sbus") ||
492
- !strcmp(dp->parent->name, "sbi")) {
490
+ if (of_node_name_eq(dp->parent, "sbus") ||
491
+ of_node_name_eq(dp->parent, "sbi")) {
493492 info->fix.smem_start = op->resource[0].start;
494493 par->iospace = op->resource[0].flags & IORESOURCE_BITS;
495494 } else {
....@@ -510,8 +509,7 @@
510509 if (!par->regs || !par->clut || !par->cursor || !info->screen_base)
511510 goto out_unmap_regs;
512511
513
- is_8mb = (((op->resource[1].end - op->resource[1].start) + 1) ==
514
- (8 * 1024 * 1024));
512
+ is_8mb = (resource_size(&op->resource[1]) == (8 * 1024 * 1024));
515513
516514 BUILD_BUG_ON(sizeof(par->mmap_map) != sizeof(__cg14_mmap_map));
517515