.. | .. |
---|
32 | 32 | #include <linux/nvram.h> |
---|
33 | 33 | #include <linux/of_device.h> |
---|
34 | 34 | #include <linux/of_platform.h> |
---|
35 | | -#include <asm/io.h> |
---|
36 | 35 | #include <asm/prom.h> |
---|
37 | | -#include <asm/pgtable.h> |
---|
38 | 36 | |
---|
39 | 37 | #include "macmodes.h" |
---|
40 | 38 | #include "platinumfb.h" |
---|
.. | .. |
---|
98 | 96 | * Interface used by the world |
---|
99 | 97 | */ |
---|
100 | 98 | |
---|
101 | | -static struct fb_ops platinumfb_ops = { |
---|
| 99 | +static const struct fb_ops platinumfb_ops = { |
---|
102 | 100 | .owner = THIS_MODULE, |
---|
103 | 101 | .fb_check_var = platinumfb_check_var, |
---|
104 | 102 | .fb_set_par = platinumfb_set_par, |
---|
.. | .. |
---|
347 | 345 | |
---|
348 | 346 | sense = read_platinum_sense(pinfo); |
---|
349 | 347 | printk(KERN_INFO "platinumfb: Monitor sense value = 0x%x, ", sense); |
---|
350 | | - if (default_vmode == VMODE_NVRAM) { |
---|
351 | | -#ifdef CONFIG_NVRAM |
---|
| 348 | + |
---|
| 349 | + if (IS_REACHABLE(CONFIG_NVRAM) && default_vmode == VMODE_NVRAM) |
---|
352 | 350 | default_vmode = nvram_read_byte(NV_VMODE); |
---|
353 | | - if (default_vmode <= 0 || default_vmode > VMODE_MAX || |
---|
354 | | - !platinum_reg_init[default_vmode-1]) |
---|
355 | | -#endif |
---|
356 | | - default_vmode = VMODE_CHOOSE; |
---|
357 | | - } |
---|
358 | | - if (default_vmode == VMODE_CHOOSE) { |
---|
| 351 | + if (default_vmode <= 0 || default_vmode > VMODE_MAX || |
---|
| 352 | + !platinum_reg_init[default_vmode - 1]) { |
---|
359 | 353 | default_vmode = mac_map_monitor_sense(sense); |
---|
| 354 | + if (!platinum_reg_init[default_vmode - 1]) |
---|
| 355 | + default_vmode = VMODE_640_480_60; |
---|
360 | 356 | } |
---|
361 | | - if (default_vmode <= 0 || default_vmode > VMODE_MAX) |
---|
362 | | - default_vmode = VMODE_640_480_60; |
---|
363 | | -#ifdef CONFIG_NVRAM |
---|
364 | | - if (default_cmode == CMODE_NVRAM) |
---|
| 357 | + |
---|
| 358 | + if (IS_REACHABLE(CONFIG_NVRAM) && default_cmode == CMODE_NVRAM) |
---|
365 | 359 | default_cmode = nvram_read_byte(NV_CMODE); |
---|
366 | | -#endif |
---|
367 | 360 | if (default_cmode < CMODE_8 || default_cmode > CMODE_32) |
---|
368 | 361 | default_cmode = CMODE_8; |
---|
369 | 362 | /* |
---|
.. | .. |
---|
545 | 538 | dev_info(&odev->dev, "Found Apple Platinum video hardware\n"); |
---|
546 | 539 | |
---|
547 | 540 | info = framebuffer_alloc(sizeof(*pinfo), &odev->dev); |
---|
548 | | - if (info == NULL) { |
---|
549 | | - dev_err(&odev->dev, "Failed to allocate fbdev !\n"); |
---|
| 541 | + if (!info) |
---|
550 | 542 | return -ENOMEM; |
---|
551 | | - } |
---|
| 543 | + |
---|
552 | 544 | pinfo = info->par; |
---|
553 | 545 | |
---|
554 | 546 | if (of_address_to_resource(dp, 0, &pinfo->rsrc_reg) || |
---|
.. | .. |
---|
577 | 569 | |
---|
578 | 570 | /* frame buffer - map only 4MB */ |
---|
579 | 571 | pinfo->frame_buffer_phys = pinfo->rsrc_fb.start; |
---|
580 | | - pinfo->frame_buffer = __ioremap(pinfo->rsrc_fb.start, 0x400000, |
---|
581 | | - _PAGE_WRITETHRU); |
---|
| 572 | + pinfo->frame_buffer = ioremap_wt(pinfo->rsrc_fb.start, 0x400000); |
---|
582 | 573 | pinfo->base_frame_buffer = pinfo->frame_buffer; |
---|
583 | 574 | |
---|
584 | 575 | /* registers */ |
---|