esp: use tty_port
[safe/jmp/linux-2.6] / drivers / char / agp / efficeon-agp.c
index b788b0a..8ca6f26 100644 (file)
@@ -59,7 +59,7 @@ static struct _efficeon_private {
        unsigned long l1_table[EFFICEON_L1_SIZE];
 } efficeon_private;
 
-static struct gatt_mask efficeon_generic_masks[] =
+static const struct gatt_mask efficeon_generic_masks[] =
 {
        {.mask = 0x00000001, .type = 0}
 };
@@ -70,7 +70,7 @@ static inline unsigned long efficeon_mask_memory(unsigned long addr)
        return addr | 0x00000001;
 }
 
-static struct aper_size_info_lvl2 efficeon_generic_sizes[4] =
+static const struct aper_size_info_lvl2 efficeon_generic_sizes[4] =
 {
        {256, 65536, 0},
        {128, 32768, 32},
@@ -221,7 +221,7 @@ static int efficeon_create_gatt_table(struct agp_bridge_data *bridge)
                SetPageReserved(virt_to_page((char *)page));
 
                for (offset = 0; offset < PAGE_SIZE; offset += clflush_chunk)
-                       asm volatile("clflush %0" : : "m" (*(char *)(page+offset)));
+                       clflush((char *)page+offset);
 
                efficeon_private.l1_table[index] = page;
 
@@ -249,9 +249,9 @@ static int efficeon_insert_memory(struct agp_memory * mem, off_t pg_start, int t
        if (type != 0 || mem->type != 0)
                return -EINVAL;
 
-       if (mem->is_flushed == FALSE) {
+       if (!mem->is_flushed) {
                global_cache_flush();
-               mem->is_flushed = TRUE;
+               mem->is_flushed = true;
        }
 
        last_page = NULL;
@@ -268,15 +268,16 @@ static int efficeon_insert_memory(struct agp_memory * mem, off_t pg_start, int t
                *page = insert;
 
                /* clflush is slow, so don't clflush until we have to */
-               if ( last_page &&
-                    ((unsigned long)page^(unsigned long)last_page) & clflush_mask )
-                   asm volatile("clflush %0" : : "m" (*last_page));
+               if (last_page &&
+                   (((unsigned long)page^(unsigned long)last_page) &
+                    clflush_mask))
+                       clflush(last_page);
 
                last_page = page;
        }
 
        if ( last_page )
-               asm volatile("clflush %0" : : "m" (*last_page));
+               clflush(last_page);
 
        agp_bridge->driver->tlb_flush(mem);
        return 0;
@@ -309,7 +310,7 @@ static int efficeon_remove_memory(struct agp_memory * mem, off_t pg_start, int t
 }
 
 
-static struct agp_bridge_driver efficeon_driver = {
+static const struct agp_bridge_driver efficeon_driver = {
        .owner                  = THIS_MODULE,
        .aperture_sizes         = efficeon_generic_sizes,
        .size_type              = LVL2_APER_SIZE,
@@ -328,22 +329,16 @@ static struct agp_bridge_driver efficeon_driver = {
        .free_gatt_table        = efficeon_free_gatt_table,
        .insert_memory          = efficeon_insert_memory,
        .remove_memory          = efficeon_remove_memory,
-       .cant_use_aperture      = 0,    // 1 might be faster?
+       .cant_use_aperture      = false,        // true might be faster?
 
        // Generic
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
-
-static int agp_efficeon_resume(struct pci_dev *pdev)
-{
-       printk(KERN_DEBUG PFX "agp_efficeon_resume()\n");
-       return efficeon_configure();
-}
-
 static int __devinit agp_efficeon_probe(struct pci_dev *pdev,
                                     const struct pci_device_id *ent)
 {
@@ -381,6 +376,7 @@ static int __devinit agp_efficeon_probe(struct pci_dev *pdev,
        if (!r->start && r->end) {
                if (pci_assign_resource(pdev, 0)) {
                        printk(KERN_ERR PFX "could not assign resource 0\n");
+                       agp_put_bridge(bridge);
                        return -ENODEV;
                }
        }
@@ -392,6 +388,7 @@ static int __devinit agp_efficeon_probe(struct pci_dev *pdev,
        */
        if (pci_enable_device(pdev)) {
                printk(KERN_ERR PFX "Unable to Enable PCI device\n");
+               agp_put_bridge(bridge);
                return -ENODEV;
        }
 
@@ -414,11 +411,18 @@ static void __devexit agp_efficeon_remove(struct pci_dev *pdev)
        agp_put_bridge(bridge);
 }
 
+#ifdef CONFIG_PM
 static int agp_efficeon_suspend(struct pci_dev *dev, pm_message_t state)
 {
        return 0;
 }
 
+static int agp_efficeon_resume(struct pci_dev *pdev)
+{
+       printk(KERN_DEBUG PFX "agp_efficeon_resume()\n");
+       return efficeon_configure();
+}
+#endif
 
 static struct pci_device_id agp_efficeon_pci_table[] = {
        {
@@ -439,8 +443,10 @@ static struct pci_driver agp_efficeon_pci_driver = {
        .id_table       = agp_efficeon_pci_table,
        .probe          = agp_efficeon_probe,
        .remove         = agp_efficeon_remove,
+#ifdef CONFIG_PM
        .suspend        = agp_efficeon_suspend,
        .resume         = agp_efficeon_resume,
+#endif
 };
 
 static int __init agp_efficeon_init(void)