esp: use tty_port
[safe/jmp/linux-2.6] / drivers / char / agp / hp-agp.c
index 8c4c6ef..80d7317 100644 (file)
 #include <linux/pci.h>
 #include <linux/init.h>
 #include <linux/agp_backend.h>
+#include <linux/log2.h>
 
 #include <asm/acpi-ext.h>
 
 #include "agp.h"
 
-#ifndef log2
-#define log2(x)                ffz(~(x))
-#endif
-
 #define HP_ZX1_IOC_OFFSET      0x1000  /* ACPI reports SBA, we want IOC */
 
 /* HP ZX1 IOC registers */
@@ -221,6 +218,7 @@ hp_zx1_lba_init (u64 hpa)
        if (cap != PCI_CAP_ID_AGP) {
                printk(KERN_ERR PFX "Invalid capability ID 0x%02x at 0x%x\n",
                       cap, hp->lba_cap_offset);
+               iounmap(hp->lba_regs);
                return -ENODEV;
        }
 
@@ -256,7 +254,7 @@ hp_zx1_configure (void)
                readl(hp->ioc_regs+HP_ZX1_IMASK);
                writel(hp->iova_base|1, hp->ioc_regs+HP_ZX1_IBASE);
                readl(hp->ioc_regs+HP_ZX1_IBASE);
-               writel(hp->iova_base|log2(HP_ZX1_IOVA_SIZE), hp->ioc_regs+HP_ZX1_PCOM);
+               writel(hp->iova_base|ilog2(HP_ZX1_IOVA_SIZE), hp->ioc_regs+HP_ZX1_PCOM);
                readl(hp->ioc_regs+HP_ZX1_PCOM);
        }
 
@@ -284,7 +282,7 @@ hp_zx1_tlbflush (struct agp_memory *mem)
 {
        struct _hp_private *hp = &hp_private;
 
-       writeq(hp->gart_base | log2(hp->gart_size), hp->ioc_regs+HP_ZX1_PCOM);
+       writeq(hp->gart_base | ilog2(hp->gart_size), hp->ioc_regs+HP_ZX1_PCOM);
        readq(hp->ioc_regs+HP_ZX1_PCOM);
 }
 
@@ -355,9 +353,9 @@ hp_zx1_insert_memory (struct agp_memory *mem, off_t pg_start, int type)
                j++;
        }
 
-       if (mem->is_flushed == FALSE) {
+       if (!mem->is_flushed) {
                global_cache_flush();
-               mem->is_flushed = TRUE;
+               mem->is_flushed = true;
        }
 
        for (i = 0, j = io_pg_start; i < mem->page_count; i++) {
@@ -419,7 +417,7 @@ hp_zx1_enable (struct agp_bridge_data *bridge, u32 mode)
        agp_device_command(command, (mode & AGP8X_MODE) != 0);
 }
 
-struct agp_bridge_driver hp_zx1_driver = {
+const struct agp_bridge_driver hp_zx1_driver = {
        .owner                  = THIS_MODULE,
        .size_type              = FIXED_APER_SIZE,
        .configure              = hp_zx1_configure,
@@ -438,7 +436,8 @@ struct agp_bridge_driver hp_zx1_driver = {
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
        .agp_destroy_page       = agp_generic_destroy_page,
-       .cant_use_aperture      = 1,
+       .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
+       .cant_use_aperture      = true,
 };
 
 static int __init
@@ -497,7 +496,7 @@ zx1_gart_probe (acpi_handle obj, u32 depth, void *context, void **ret)
                        info = buffer.pointer;
                        info->hardware_id.value[sizeof(info->hardware_id)-1] = '\0';
                        match = (strcmp(info->hardware_id.value, "HWP0001") == 0);
-                       ACPI_MEM_FREE(info);
+                       kfree(info);
                        if (match) {
                                status = hp_acpi_csr_space(handle, &sba_hpa, &length);
                                if (ACPI_SUCCESS(status))