Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
[safe/jmp/linux-2.6] / drivers / video / vermilion / vermilion.c
index de531c9..c18f188 100644 (file)
@@ -23,8 +23,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  *
  * Authors:
- *   Thomas Hellström <thomas-at-tungstengraphics-dot-com>
- *   Michel Dänzer <michel-at-tungstengraphics-dot-com>
+ *   Thomas Hellström <thomas-at-tungstengraphics-dot-com>
+ *   Michel Dänzer <michel-at-tungstengraphics-dot-com>
  *   Alan Hourihane <alanh-at-tungstengraphics-dot-com>
  */
 
@@ -39,7 +39,6 @@
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
 #include <linux/mmzone.h>
-#include <asm/uaccess.h>
 
 /* #define VERMILION_DEBUG */
 
@@ -89,9 +88,7 @@ static int vmlfb_alloc_vram_area(struct vram_area *va, unsigned max_order,
 {
        gfp_t flags;
        unsigned long i;
-       pgprot_t wc_pageprot;
 
-       wc_pageprot = PAGE_KERNEL_NOCACHE;
        max_order++;
        do {
                /*
@@ -115,8 +112,9 @@ static int vmlfb_alloc_vram_area(struct vram_area *va, unsigned max_order,
 
        /*
         * It seems like __get_free_pages only ups the usage count
-        * of the first page. This doesn't work with nopage mapping, so
-        * up the usage count once more.
+        * of the first page. This doesn't work with fault mapping, so
+        * up the usage count once more (XXX: should use split_page or
+        * compound page).
         */
 
        memset((void *)va->logical, 0x00, va->size);
@@ -127,14 +125,8 @@ static int vmlfb_alloc_vram_area(struct vram_area *va, unsigned max_order,
        /*
         * Change caching policy of the linear kernel map to avoid
         * mapping type conflicts with user-space mappings.
-        * The first global_flush_tlb() is really only there to do a global
-        * wbinvd().
         */
-
-       global_flush_tlb();
-       change_page_attr(virt_to_page(va->logical), va->size >> PAGE_SHIFT,
-                        wc_pageprot);
-       global_flush_tlb();
+       set_pages_uc(virt_to_page(va->logical), va->size >> PAGE_SHIFT);
 
        printk(KERN_DEBUG MODULE_NAME
               ": Allocated %ld bytes vram area at 0x%08lx\n",
@@ -158,9 +150,8 @@ static void vmlfb_free_vram_area(struct vram_area *va)
                 * Reset the linear kernel map caching policy.
                 */
 
-               change_page_attr(virt_to_page(va->logical),
-                                va->size >> PAGE_SHIFT, PAGE_KERNEL);
-               global_flush_tlb();
+               set_pages_wb(virt_to_page(va->logical),
+                                va->size >> PAGE_SHIFT);
 
                /*
                 * Decrease the usage count on the pages we've used
@@ -661,7 +652,7 @@ static int vmlfb_check_var_locked(struct fb_var_screeninfo *var,
                return -EINVAL;
        }
 
-       pitch = __ALIGN_MASK((var->xres * var->bits_per_pixel) >> 3, 0x3F);
+       pitch = ALIGN((var->xres * var->bits_per_pixel) >> 3, 0x40);
        mem = pitch * var->yres_virtual;
        if (mem > vinfo->vram_contig_size) {
                return -ENOMEM;
@@ -795,8 +786,7 @@ static int vmlfb_set_par_locked(struct vml_info *vinfo)
        int clock;
 
        vinfo->bytes_per_pixel = var->bits_per_pixel >> 3;
-       vinfo->stride =
-           __ALIGN_MASK(var->xres_virtual * vinfo->bytes_per_pixel, 0x3F);
+       vinfo->stride = ALIGN(var->xres_virtual * vinfo->bytes_per_pixel, 0x40);
        info->fix.line_length = vinfo->stride;
 
        if (!subsys)