hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/video/fbdev/offb.c
....@@ -141,6 +141,7 @@
141141 /* Clear PALETTE_ACCESS_CNTL in DAC_CNTL */
142142 out_le32(par->cmap_adr + 0x58,
143143 in_le32(par->cmap_adr + 0x58) & ~0x20);
144
+ fallthrough;
144145 case cmap_r128:
145146 /* Set palette index & data */
146147 out_8(par->cmap_adr + 0xb0, regno);
....@@ -210,6 +211,7 @@
210211 /* Clear PALETTE_ACCESS_CNTL in DAC_CNTL */
211212 out_le32(par->cmap_adr + 0x58,
212213 in_le32(par->cmap_adr + 0x58) & ~0x20);
214
+ fallthrough;
213215 case cmap_r128:
214216 /* Set palette index & data */
215217 out_8(par->cmap_adr + 0xb0, i);
....@@ -284,7 +286,7 @@
284286 framebuffer_release(info);
285287 }
286288
287
-static struct fb_ops offb_ops = {
289
+static const struct fb_ops offb_ops = {
288290 .owner = THIS_MODULE,
289291 .fb_destroy = offb_destroy,
290292 .fb_setcolreg = offb_setcolreg,
....@@ -318,28 +320,28 @@
318320 }
319321
320322 static void offb_init_palette_hacks(struct fb_info *info, struct device_node *dp,
321
- const char *name, unsigned long address)
323
+ unsigned long address)
322324 {
323325 struct offb_par *par = (struct offb_par *) info->par;
324326
325
- if (dp && !strncmp(name, "ATY,Rage128", 11)) {
327
+ if (of_node_name_prefix(dp, "ATY,Rage128")) {
326328 par->cmap_adr = offb_map_reg(dp, 2, 0, 0x1fff);
327329 if (par->cmap_adr)
328330 par->cmap_type = cmap_r128;
329
- } else if (dp && (!strncmp(name, "ATY,RageM3pA", 12)
330
- || !strncmp(name, "ATY,RageM3p12A", 14))) {
331
+ } else if (of_node_name_prefix(dp, "ATY,RageM3pA") ||
332
+ of_node_name_prefix(dp, "ATY,RageM3p12A")) {
331333 par->cmap_adr = offb_map_reg(dp, 2, 0, 0x1fff);
332334 if (par->cmap_adr)
333335 par->cmap_type = cmap_M3A;
334
- } else if (dp && !strncmp(name, "ATY,RageM3pB", 12)) {
336
+ } else if (of_node_name_prefix(dp, "ATY,RageM3pB")) {
335337 par->cmap_adr = offb_map_reg(dp, 2, 0, 0x1fff);
336338 if (par->cmap_adr)
337339 par->cmap_type = cmap_M3B;
338
- } else if (dp && !strncmp(name, "ATY,Rage6", 9)) {
340
+ } else if (of_node_name_prefix(dp, "ATY,Rage6")) {
339341 par->cmap_adr = offb_map_reg(dp, 1, 0, 0x1fff);
340342 if (par->cmap_adr)
341343 par->cmap_type = cmap_radeon;
342
- } else if (!strncmp(name, "ATY,", 4)) {
344
+ } else if (of_node_name_prefix(dp, "ATY,")) {
343345 unsigned long base = address & 0xff000000UL;
344346 par->cmap_adr =
345347 ioremap(base + 0x7ff000, 0x1000) + 0xcc0;
....@@ -350,7 +352,7 @@
350352 par->cmap_adr = offb_map_reg(dp, 0, 0x6000, 0x1000);
351353 if (par->cmap_adr)
352354 par->cmap_type = cmap_gxt2000;
353
- } else if (dp && !strncmp(name, "vga,Display-", 12)) {
355
+ } else if (of_node_name_prefix(dp, "vga,Display-")) {
354356 /* Look for AVIVO initialized by SLOF */
355357 struct device_node *pciparent = of_get_parent(dp);
356358 const u32 *vid, *did;
....@@ -419,9 +421,13 @@
419421 var = &info->var;
420422 info->par = par;
421423
422
- strcpy(fix->id, "OFfb ");
423
- strncat(fix->id, name, sizeof(fix->id) - sizeof("OFfb "));
424
- fix->id[sizeof(fix->id) - 1] = '\0';
424
+ if (name) {
425
+ strcpy(fix->id, "OFfb ");
426
+ strncat(fix->id, name, sizeof(fix->id) - sizeof("OFfb "));
427
+ fix->id[sizeof(fix->id) - 1] = '\0';
428
+ } else
429
+ snprintf(fix->id, sizeof(fix->id), "OFfb %pOFn", dp);
430
+
425431
426432 var->xres = var->xres_virtual = width;
427433 var->yres = var->yres_virtual = height;
....@@ -434,7 +440,7 @@
434440
435441 par->cmap_type = cmap_unknown;
436442 if (depth == 8)
437
- offb_init_palette_hacks(info, dp, name, address);
443
+ offb_init_palette_hacks(info, dp, address);
438444 else
439445 fix->visual = FB_VISUAL_TRUECOLOR;
440446
....@@ -642,9 +648,9 @@
642648 }
643649 #endif
644650 /* kludge for valkyrie */
645
- if (strcmp(dp->name, "valkyrie") == 0)
651
+ if (of_node_name_eq(dp, "valkyrie"))
646652 address += 0x1000;
647
- offb_init_fb(no_real_node ? "bootx" : dp->name,
653
+ offb_init_fb(no_real_node ? "bootx" : NULL,
648654 width, height, depth, pitch, address,
649655 foreign_endian, no_real_node ? NULL : dp);
650656 }