Pull acpi_device_handle_cleanup into release branch
[pandora-kernel.git] / drivers / video / console / sticore.c
index a7bcd17..88e7038 100644 (file)
@@ -13,7 +13,6 @@
  * 
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 
 #define STI_DRIVERVERSION "Version 0.9a"
 
-struct sti_struct *default_sti;
+struct sti_struct *default_sti __read_mostly;
 
-static int num_sti_roms;                         /* # of STI ROMS found */
-static struct sti_struct *sti_roms[MAX_STI_ROMS]; /* ptr to each sti_struct */
+/* number of STI ROMS found and their ptrs to each struct */
+static int num_sti_roms __read_mostly;
+static struct sti_struct *sti_roms[MAX_STI_ROMS] __read_mostly;
 
 
 /* The colour indices used by STI are
@@ -266,7 +266,7 @@ sti_rom_copy(unsigned long base, unsigned long count, void *dest)
 
 
 
-static char default_sti_path[21];
+static char default_sti_path[21] __read_mostly;
 
 #ifndef MODULE
 static int __init sti_setup(char *str)
@@ -274,7 +274,7 @@ static int __init sti_setup(char *str)
        if (str)
                strlcpy (default_sti_path, str, sizeof (default_sti_path));
        
-       return 0;
+       return 1;
 }
 
 /*     Assuming the machine has multiple STI consoles (=graphic cards) which
@@ -320,7 +320,7 @@ static int __init sti_font_setup(char *str)
                i++;
        }
 
-       return 0;
+       return 1;
 }
 
 /*     The optional linux kernel parameter "sti_font" defines which font
@@ -372,7 +372,7 @@ sti_dump_globcfg(struct sti_glob_cfg *glob_cfg, unsigned int sti_mem_request)
                glob_cfg->save_addr));
 
        /* dump extended cfg */ 
-       cfg = PTR_STI(glob_cfg->ext_ptr);
+       cfg = PTR_STI((unsigned long)glob_cfg->ext_ptr);
        DPRINTK(( KERN_INFO
                "monitor %d\n"
                "in friendly mode: %d\n"
@@ -414,10 +414,10 @@ sti_init_glob_cfg(struct sti_struct *sti,
        if (!sti->sti_mem_request)
                sti->sti_mem_request = 256; /* STI default */
 
-       glob_cfg = kmalloc(sizeof(*sti->glob_cfg), GFP_KERNEL);
-       glob_cfg_ext = kmalloc(sizeof(*glob_cfg_ext), GFP_KERNEL);
-       save_addr = kmalloc(save_addr_size, GFP_KERNEL);
-       sti_mem_addr = kmalloc(sti->sti_mem_request, GFP_KERNEL);
+       glob_cfg = kzalloc(sizeof(*sti->glob_cfg), GFP_KERNEL);
+       glob_cfg_ext = kzalloc(sizeof(*glob_cfg_ext), GFP_KERNEL);
+       save_addr = kzalloc(save_addr_size, GFP_KERNEL);
+       sti_mem_addr = kzalloc(sti->sti_mem_request, GFP_KERNEL);
 
        if (!(glob_cfg && glob_cfg_ext && save_addr && sti_mem_addr)) {
                kfree(glob_cfg);
@@ -427,11 +427,6 @@ sti_init_glob_cfg(struct sti_struct *sti,
                return -ENOMEM;
        }
 
-       memset(glob_cfg, 0, sizeof(*glob_cfg));
-       memset(glob_cfg_ext, 0, sizeof(*glob_cfg_ext));
-       memset(save_addr, 0, save_addr_size);
-       memset(sti_mem_addr, 0, sti->sti_mem_request);
-
        glob_cfg->ext_ptr = STI_PTR(glob_cfg_ext);
        glob_cfg->save_addr = STI_PTR(save_addr);
        for (i=0; i<8; i++) {
@@ -457,25 +452,11 @@ sti_init_glob_cfg(struct sti_struct *sti,
                sti->regions_phys[i] =
                        REGION_OFFSET_TO_PHYS(sti->regions[i], newhpa);
                
-               /* remap virtually */
-               /* FIXME: add BTLB support if btlb==1 */
                len = sti->regions[i].region_desc.length * 4096;
-
-/* XXX: Enabling IOREMAP debugging causes a crash, so we must be passing
- * a virtual address to something expecting a physical address that doesn't
- * go through a readX macro */
-#if 0
-               if (len)
-                  glob_cfg->region_ptrs[i] = (unsigned long) (
-                       sti->regions[i].region_desc.cache ?
-                       ioremap(sti->regions_phys[i], len) :
-                       ioremap_nocache(sti->regions_phys[i], len) );
-#else
                if (len)
                        glob_cfg->region_ptrs[i] = sti->regions_phys[i];
-#endif
                
-               DPRINTK(("region #%d: phys %08lx, virt %08x, len=%lukB, "
+               DPRINTK(("region #%d: phys %08lx, region_ptr %08x, len=%lukB, "
                         "btlb=%d, sysonly=%d, cache=%d, last=%d\n",
                        i, sti->regions_phys[i], glob_cfg->region_ptrs[i],
                        len/1024,
@@ -502,9 +483,9 @@ sti_init_glob_cfg(struct sti_struct *sti,
 
 #ifdef CONFIG_FB
 struct sti_cooked_font * __init
-sti_select_fbfont( struct sti_cooked_rom *cooked_rom, char *fbfont_name )
+sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name)
 {
-       struct font_desc *fbfont;
+       const struct font_desc *fbfont;
        unsigned int size, bpc;
        void *dest;
        struct sti_rom_font *nf;
@@ -525,10 +506,9 @@ sti_select_fbfont( struct sti_cooked_rom *cooked_rom, char *fbfont_name )
        size = bpc * 256;
        size += sizeof(struct sti_rom_font);
 
-       nf = kmalloc(size, GFP_KERNEL);
+       nf = kzalloc(size, GFP_KERNEL);
        if (!nf)
                return NULL;
-       memset(nf, 0, size);
 
        nf->first_char = 0;
        nf->last_char = 255;
@@ -544,7 +524,7 @@ sti_select_fbfont( struct sti_cooked_rom *cooked_rom, char *fbfont_name )
        dest += sizeof(struct sti_rom_font);
        memcpy(dest, fbfont->data, bpc*256);
 
-       cooked_font = kmalloc(sizeof(*cooked_font), GFP_KERNEL);
+       cooked_font = kzalloc(sizeof(*cooked_font), GFP_KERNEL);
        if (!cooked_font) {
                kfree(nf);
                return NULL;
@@ -559,7 +539,7 @@ sti_select_fbfont( struct sti_cooked_rom *cooked_rom, char *fbfont_name )
 }
 #else
 struct sti_cooked_font * __init
-sti_select_fbfont(struct sti_cooked_rom *cooked_rom, char *fbfont_name)
+sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name)
 {
        return NULL;
 }
@@ -617,7 +597,7 @@ sti_cook_fonts(struct sti_cooked_rom *cooked_rom,
        struct sti_rom_font *raw_font, *font_start;
        struct sti_cooked_font *cooked_font;
        
-       cooked_font = kmalloc(sizeof(*cooked_font), GFP_KERNEL);
+       cooked_font = kzalloc(sizeof(*cooked_font), GFP_KERNEL);
        if (!cooked_font)
                return 0;
 
@@ -631,7 +611,7 @@ sti_cook_fonts(struct sti_cooked_rom *cooked_rom,
        while (raw_font->next_font) {
                raw_font = ((void *)font_start) + (raw_font->next_font);
 
-               cooked_font->next_font = kmalloc(sizeof(*cooked_font), GFP_KERNEL);
+               cooked_font->next_font = kzalloc(sizeof(*cooked_font), GFP_KERNEL);
                if (!cooked_font->next_font)
                        return 1;
 
@@ -668,10 +648,9 @@ sti_bmode_font_raw(struct sti_cooked_font *f)
        unsigned char *n, *p, *q;
        int size = f->raw->bytes_per_char*256+sizeof(struct sti_rom_font);
        
-       n = kmalloc (4*size, GFP_KERNEL);
+       n = kzalloc (4*size, GFP_KERNEL);
        if (!n)
                return NULL;
-       memset (n, 0, 4*size);
        p = n + 3;
        q = (unsigned char *)f->raw;
        while (size--) {
@@ -816,13 +795,12 @@ sti_try_rom_generic(unsigned long address, unsigned long hpa, struct pci_dev *pd
                return NULL;
        }
        
-       sti = kmalloc(sizeof(*sti), GFP_KERNEL);
+       sti = kzalloc(sizeof(*sti), GFP_KERNEL);
        if (!sti) {
                printk(KERN_ERR "Not enough memory !\n");
                return NULL;
        }
 
-       memset(sti, 0, sizeof(*sti));
        spin_lock_init(&sti->lock);
 
 test_rom:
@@ -1035,7 +1013,7 @@ static struct parisc_driver pa_sti_driver = {
  * sti_init_roms() - detects all STI ROMs and stores them in sti_roms[]
  */
 
-static int sticore_initialized;
+static int sticore_initialized __read_mostly;
 
 static void __init sti_init_roms(void)
 {