diff options
-rw-r--r-- | drivers/video/fbdev/vesafb.c | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/drivers/video/fbdev/vesafb.c b/drivers/video/fbdev/vesafb.c index 3db390885d71..528fe917dd49 100644 --- a/drivers/video/fbdev/vesafb.c +++ b/drivers/video/fbdev/vesafb.c | |||
@@ -19,10 +19,9 @@ | |||
19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/screen_info.h> | 21 | #include <linux/screen_info.h> |
22 | #include <linux/io.h> | ||
22 | 23 | ||
23 | #include <video/vga.h> | 24 | #include <video/vga.h> |
24 | #include <asm/io.h> | ||
25 | #include <asm/mtrr.h> | ||
26 | 25 | ||
27 | #define dac_reg (0x3c8) | 26 | #define dac_reg (0x3c8) |
28 | #define dac_val (0x3c9) | 27 | #define dac_val (0x3c9) |
@@ -180,16 +179,10 @@ static int vesafb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
180 | 179 | ||
181 | static void vesafb_destroy(struct fb_info *info) | 180 | static void vesafb_destroy(struct fb_info *info) |
182 | { | 181 | { |
183 | #ifdef CONFIG_MTRR | ||
184 | struct vesafb_par *par = info->par; | 182 | struct vesafb_par *par = info->par; |
185 | #endif | ||
186 | 183 | ||
187 | fb_dealloc_cmap(&info->cmap); | 184 | fb_dealloc_cmap(&info->cmap); |
188 | 185 | arch_phys_wc_del(par->wc_cookie); | |
189 | #ifdef CONFIG_MTRR | ||
190 | if (par->wc_cookie >= 0) | ||
191 | mtrr_del(par->wc_cookie, 0, 0); | ||
192 | #endif | ||
193 | if (info->screen_base) | 186 | if (info->screen_base) |
194 | iounmap(info->screen_base); | 187 | iounmap(info->screen_base); |
195 | release_mem_region(info->apertures->ranges[0].base, info->apertures->ranges[0].size); | 188 | release_mem_region(info->apertures->ranges[0].base, info->apertures->ranges[0].size); |
@@ -420,7 +413,6 @@ static int vesafb_probe(struct platform_device *dev) | |||
420 | request_region(0x3c0, 32, "vesafb"); | 413 | request_region(0x3c0, 32, "vesafb"); |
421 | 414 | ||
422 | if (mtrr == 3) { | 415 | if (mtrr == 3) { |
423 | #ifdef CONFIG_MTRR | ||
424 | unsigned int temp_size = size_total; | 416 | unsigned int temp_size = size_total; |
425 | 417 | ||
426 | /* Find the largest power-of-two */ | 418 | /* Find the largest power-of-two */ |
@@ -428,18 +420,16 @@ static int vesafb_probe(struct platform_device *dev) | |||
428 | 420 | ||
429 | /* Try and find a power of two to add */ | 421 | /* Try and find a power of two to add */ |
430 | do { | 422 | do { |
431 | par->wc_cookie = mtrr_add(vesafb_fix.smem_start, | 423 | par->wc_cookie = |
432 | temp_size, | 424 | arch_phys_wc_add(vesafb_fix.smem_start, |
433 | MTRR_TYPE_WRCOMB, 1); | 425 | temp_size); |
434 | temp_size >>= 1; | 426 | temp_size >>= 1; |
435 | } while (temp_size >= PAGE_SIZE && par->wc_cookie == -EINVAL); | 427 | } while (temp_size >= PAGE_SIZE && par->wc_cookie < 0); |
436 | #endif | 428 | |
437 | info->screen_base = ioremap_wc(vesafb_fix.smem_start, vesafb_fix.smem_len); | 429 | info->screen_base = ioremap_wc(vesafb_fix.smem_start, vesafb_fix.smem_len); |
438 | } else { | 430 | } else { |
439 | #ifdef CONFIG_MTRR | ||
440 | if (mtrr && mtrr != 3) | 431 | if (mtrr && mtrr != 3) |
441 | WARN_ONCE(1, "Only MTRR_TYPE_WRCOMB (3) make sense\n"); | 432 | WARN_ONCE(1, "Only MTRR_TYPE_WRCOMB (3) make sense\n"); |
442 | #endif | ||
443 | info->screen_base = ioremap(vesafb_fix.smem_start, vesafb_fix.smem_len); | 433 | info->screen_base = ioremap(vesafb_fix.smem_start, vesafb_fix.smem_len); |
444 | } | 434 | } |
445 | 435 | ||
@@ -477,10 +467,7 @@ static int vesafb_probe(struct platform_device *dev) | |||
477 | fb_info(info, "%s frame buffer device\n", info->fix.id); | 467 | fb_info(info, "%s frame buffer device\n", info->fix.id); |
478 | return 0; | 468 | return 0; |
479 | err: | 469 | err: |
480 | #ifdef CONFIG_MTRR | 470 | arch_phys_wc_del(par->wc_cookie); |
481 | if (par->wc_cookie >= 0) | ||
482 | mtrr_del(par->wc_cookie, 0, 0); | ||
483 | #endif | ||
484 | if (info->screen_base) | 471 | if (info->screen_base) |
485 | iounmap(info->screen_base); | 472 | iounmap(info->screen_base); |
486 | framebuffer_release(info); | 473 | framebuffer_release(info); |