Merge git://git.infradead.org/mtd-2.6
[pandora-kernel.git] / drivers / char / agp / generic.c
index ac9da0c..a92ab53 100644 (file)
@@ -57,7 +57,8 @@ int map_page_into_agp(struct page *page)
 {
        int i;
        i = change_page_attr(page, 1, PAGE_KERNEL_NOCACHE);
-       global_flush_tlb();
+       /* Caller's responsibility to call global_flush_tlb() for
+        * performance reasons */
        return i;
 }
 EXPORT_SYMBOL_GPL(map_page_into_agp);
@@ -66,7 +67,8 @@ int unmap_page_from_agp(struct page *page)
 {
        int i;
        i = change_page_attr(page, 1, PAGE_KERNEL);
-       global_flush_tlb();
+       /* Caller's responsibility to call global_flush_tlb() for
+        * performance reasons */
        return i;
 }
 EXPORT_SYMBOL_GPL(unmap_page_from_agp);
@@ -105,12 +107,10 @@ struct agp_memory *agp_create_memory(int scratch_pages)
 {
        struct agp_memory *new;
 
-       new = kmalloc(sizeof(struct agp_memory), GFP_KERNEL);
-
+       new = kzalloc(sizeof(struct agp_memory), GFP_KERNEL);
        if (new == NULL)
                return NULL;
 
-       memset(new, 0, sizeof(struct agp_memory));
        new->key = agp_get_key();
 
        if (new->key < 0) {
@@ -155,6 +155,7 @@ void agp_free_memory(struct agp_memory *curr)
                for (i = 0; i < curr->page_count; i++) {
                        curr->bridge->driver->agp_destroy_page(gart_to_virt(curr->memory[i]));
                }
+               flush_agp_mappings();
        }
        agp_free_key(curr->key);
        vfree(curr->memory);
@@ -212,7 +213,7 @@ struct agp_memory *agp_allocate_memory(struct agp_bridge_data *bridge,
                new->memory[i] = virt_to_gart(addr);
                new->page_count++;
        }
-       new->bridge = bridge;
+       new->bridge = bridge;
 
        flush_agp_mappings();
 
@@ -298,7 +299,7 @@ EXPORT_SYMBOL_GPL(agp_num_entries);
 /**
  *     agp_copy_info  -  copy bridge state information
  *
- *     @info:          agp_kern_info pointer.  The caller should insure that this pointer is valid. 
+ *     @info:          agp_kern_info pointer.  The caller should insure that this pointer is valid.
  *
  *     This function copies information about the agp bridge device and the state of
  *     the agp backend into an agp_kern_info pointer.
@@ -414,7 +415,8 @@ static void agp_v2_parse_one(u32 *requested_mode, u32 *bridge_agpstat, u32 *vga_
        u32 tmp;
 
        if (*requested_mode & AGP2_RESERVED_MASK) {
-               printk(KERN_INFO PFX "reserved bits set in mode 0x%x. Fixed.\n", *requested_mode);
+               printk(KERN_INFO PFX "reserved bits set (%x) in mode 0x%x. Fixed.\n",
+                       *requested_mode & AGP2_RESERVED_MASK, *requested_mode);
                *requested_mode &= ~AGP2_RESERVED_MASK;
        }
 
@@ -492,7 +494,8 @@ static void agp_v3_parse_one(u32 *requested_mode, u32 *bridge_agpstat, u32 *vga_
        u32 tmp;
 
        if (*requested_mode & AGP3_RESERVED_MASK) {
-               printk(KERN_INFO PFX "reserved bits set in mode 0x%x. Fixed.\n", *requested_mode);
+               printk(KERN_INFO PFX "reserved bits set (%x) in mode 0x%x. Fixed.\n",
+                       *requested_mode & AGP3_RESERVED_MASK, *requested_mode);
                *requested_mode &= ~AGP3_RESERVED_MASK;
        }
 
@@ -806,12 +809,10 @@ int agp_generic_create_gatt_table(struct agp_bridge_data *bridge)
                                case U32_APER_SIZE:
                                        bridge->current_size = A_IDX32(bridge);
                                        break;
-                                       /* This case will never really happen. */
+                               /* These cases will never really happen. */
                                case FIXED_APER_SIZE:
                                case LVL2_APER_SIZE:
                                default:
-                                       bridge->current_size =
-                                           bridge->current_size;
                                        break;
                                }
                                temp = bridge->current_size;