]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/char/agp/amd-k7-agp.c
sx: prepare for BKL pushdown
[linux-2.6-omap-h63xx.git] / drivers / char / agp / amd-k7-agp.c
index f60bca70d1fba99f91cb6573b93d56bd3bea120c..96bdb9296b0758832214aad8393f37569d258916 100644 (file)
@@ -41,6 +41,7 @@ static int amd_create_page_map(struct amd_page_map *page_map)
        if (page_map->real == NULL)
                return -ENOMEM;
 
+#ifndef CONFIG_X86
        SetPageReserved(virt_to_page(page_map->real));
        global_cache_flush();
        page_map->remapped = ioremap_nocache(virt_to_gart(page_map->real),
@@ -52,6 +53,10 @@ static int amd_create_page_map(struct amd_page_map *page_map)
                return -ENOMEM;
        }
        global_cache_flush();
+#else
+       set_memory_uc((unsigned long)page_map->real, 1);
+       page_map->remapped = page_map->real;
+#endif
 
        for (i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++) {
                writel(agp_bridge->scratch_page, page_map->remapped+i);
@@ -63,8 +68,12 @@ static int amd_create_page_map(struct amd_page_map *page_map)
 
 static void amd_free_page_map(struct amd_page_map *page_map)
 {
+#ifndef CONFIG_X86
        iounmap(page_map->remapped);
        ClearPageReserved(virt_to_page(page_map->real));
+#else
+       set_memory_wb((unsigned long)page_map->real, 1);
+#endif
        free_page((unsigned long) page_map->real);
 }
 
@@ -100,21 +109,16 @@ static int amd_create_gatt_pages(int nr_tables)
 
        for (i = 0; i < nr_tables; i++) {
                entry = kzalloc(sizeof(struct amd_page_map), GFP_KERNEL);
+               tables[i] = entry;
                if (entry == NULL) {
-                       while (i > 0) {
-                               kfree(tables[i-1]);
-                               i--;
-                       }
-                       kfree(tables);
                        retval = -ENOMEM;
                        break;
                }
-               tables[i] = entry;
                retval = amd_create_page_map(entry);
                if (retval != 0)
                        break;
        }
-       amd_irongate_private.num_tables = nr_tables;
+       amd_irongate_private.num_tables = i;
        amd_irongate_private.gatt_pages = tables;
 
        if (retval != 0)
@@ -432,8 +436,9 @@ static int __devinit agp_amdk7_probe(struct pci_dev *pdev,
           system controller may experience noise due to strong drive strengths
         */
        if (agp_bridge->dev->device == PCI_DEVICE_ID_AMD_FE_GATE_7006) {
-               u8 cap_ptr=0;
                struct pci_dev *gfxcard=NULL;
+
+               cap_ptr = 0;
                while (!cap_ptr) {
                        gfxcard = pci_get_class(PCI_CLASS_DISPLAY_VGA<<8, gfxcard);
                        if (!gfxcard) {
@@ -441,10 +446,6 @@ static int __devinit agp_amdk7_probe(struct pci_dev *pdev,
                                return -ENODEV;
                        }
                        cap_ptr = pci_find_capability(gfxcard, PCI_CAP_ID_AGP);
-                       if (!cap_ptr) {
-                               pci_dev_put(gfxcard);
-                               continue;
-                       }
                }
 
                /* With so many variants of NVidia cards, it's simpler just