aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorHelge Deller <deller@parisc-linux.org>2006-01-17 14:40:40 -0500
committerKyle McMartin <kyle@duet.int.mcmartin.ca>2006-01-22 20:26:31 -0500
commitcb6fc18e9ca615f03d18e60c49855b434ca2e51e (patch)
treec35af13054f8eeb7a24c928edf55fdc69c912562 /drivers/video
parenta1c744439591b1d4350f0926615d501e7cfbb708 (diff)
[PARISC] Use kzalloc and other janitor-style cleanups
Helge, o Convert a bunch of kmalloc/memset uses to kzalloc. o pci.c: Add some __read_mostly annotations. o pci.c: Move constant pci_post_reset_delay to asm/pci.h o grfioctl.h: Add A4450A to comment of CRT_ID_VISUALIZE_EG. o Add some consts to perf.c/perf_images.h Matthew, o sticore.c: Add some consts to suppress compile warnings. Signed-off-by: Helge Deller <deller@parisc-linux.org> Signed-off-by: Matthew Wilcox <willy@parisc-linux.org> Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/console/sticore.c45
1 files changed, 19 insertions, 26 deletions
diff --git a/drivers/video/console/sticore.c b/drivers/video/console/sticore.c
index a7bcd17112c0..0339f5640a78 100644
--- a/drivers/video/console/sticore.c
+++ b/drivers/video/console/sticore.c
@@ -30,10 +30,11 @@
30 30
31#define STI_DRIVERVERSION "Version 0.9a" 31#define STI_DRIVERVERSION "Version 0.9a"
32 32
33struct sti_struct *default_sti; 33struct sti_struct *default_sti __read_mostly;
34 34
35static int num_sti_roms; /* # of STI ROMS found */ 35/* number of STI ROMS found and their ptrs to each struct */
36static struct sti_struct *sti_roms[MAX_STI_ROMS]; /* ptr to each sti_struct */ 36static int num_sti_roms __read_mostly;
37static struct sti_struct *sti_roms[MAX_STI_ROMS] __read_mostly;
37 38
38 39
39/* The colour indices used by STI are 40/* The colour indices used by STI are
@@ -266,7 +267,7 @@ sti_rom_copy(unsigned long base, unsigned long count, void *dest)
266 267
267 268
268 269
269static char default_sti_path[21]; 270static char default_sti_path[21] __read_mostly;
270 271
271#ifndef MODULE 272#ifndef MODULE
272static int __init sti_setup(char *str) 273static int __init sti_setup(char *str)
@@ -414,10 +415,10 @@ sti_init_glob_cfg(struct sti_struct *sti,
414 if (!sti->sti_mem_request) 415 if (!sti->sti_mem_request)
415 sti->sti_mem_request = 256; /* STI default */ 416 sti->sti_mem_request = 256; /* STI default */
416 417
417 glob_cfg = kmalloc(sizeof(*sti->glob_cfg), GFP_KERNEL); 418 glob_cfg = kzalloc(sizeof(*sti->glob_cfg), GFP_KERNEL);
418 glob_cfg_ext = kmalloc(sizeof(*glob_cfg_ext), GFP_KERNEL); 419 glob_cfg_ext = kzalloc(sizeof(*glob_cfg_ext), GFP_KERNEL);
419 save_addr = kmalloc(save_addr_size, GFP_KERNEL); 420 save_addr = kzalloc(save_addr_size, GFP_KERNEL);
420 sti_mem_addr = kmalloc(sti->sti_mem_request, GFP_KERNEL); 421 sti_mem_addr = kzalloc(sti->sti_mem_request, GFP_KERNEL);
421 422
422 if (!(glob_cfg && glob_cfg_ext && save_addr && sti_mem_addr)) { 423 if (!(glob_cfg && glob_cfg_ext && save_addr && sti_mem_addr)) {
423 kfree(glob_cfg); 424 kfree(glob_cfg);
@@ -427,11 +428,6 @@ sti_init_glob_cfg(struct sti_struct *sti,
427 return -ENOMEM; 428 return -ENOMEM;
428 } 429 }
429 430
430 memset(glob_cfg, 0, sizeof(*glob_cfg));
431 memset(glob_cfg_ext, 0, sizeof(*glob_cfg_ext));
432 memset(save_addr, 0, save_addr_size);
433 memset(sti_mem_addr, 0, sti->sti_mem_request);
434
435 glob_cfg->ext_ptr = STI_PTR(glob_cfg_ext); 431 glob_cfg->ext_ptr = STI_PTR(glob_cfg_ext);
436 glob_cfg->save_addr = STI_PTR(save_addr); 432 glob_cfg->save_addr = STI_PTR(save_addr);
437 for (i=0; i<8; i++) { 433 for (i=0; i<8; i++) {
@@ -502,9 +498,9 @@ sti_init_glob_cfg(struct sti_struct *sti,
502 498
503#ifdef CONFIG_FB 499#ifdef CONFIG_FB
504struct sti_cooked_font * __init 500struct sti_cooked_font * __init
505sti_select_fbfont( struct sti_cooked_rom *cooked_rom, char *fbfont_name ) 501sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name)
506{ 502{
507 struct font_desc *fbfont; 503 const struct font_desc *fbfont;
508 unsigned int size, bpc; 504 unsigned int size, bpc;
509 void *dest; 505 void *dest;
510 struct sti_rom_font *nf; 506 struct sti_rom_font *nf;
@@ -525,10 +521,9 @@ sti_select_fbfont( struct sti_cooked_rom *cooked_rom, char *fbfont_name )
525 size = bpc * 256; 521 size = bpc * 256;
526 size += sizeof(struct sti_rom_font); 522 size += sizeof(struct sti_rom_font);
527 523
528 nf = kmalloc(size, GFP_KERNEL); 524 nf = kzalloc(size, GFP_KERNEL);
529 if (!nf) 525 if (!nf)
530 return NULL; 526 return NULL;
531 memset(nf, 0, size);
532 527
533 nf->first_char = 0; 528 nf->first_char = 0;
534 nf->last_char = 255; 529 nf->last_char = 255;
@@ -544,7 +539,7 @@ sti_select_fbfont( struct sti_cooked_rom *cooked_rom, char *fbfont_name )
544 dest += sizeof(struct sti_rom_font); 539 dest += sizeof(struct sti_rom_font);
545 memcpy(dest, fbfont->data, bpc*256); 540 memcpy(dest, fbfont->data, bpc*256);
546 541
547 cooked_font = kmalloc(sizeof(*cooked_font), GFP_KERNEL); 542 cooked_font = kzalloc(sizeof(*cooked_font), GFP_KERNEL);
548 if (!cooked_font) { 543 if (!cooked_font) {
549 kfree(nf); 544 kfree(nf);
550 return NULL; 545 return NULL;
@@ -559,7 +554,7 @@ sti_select_fbfont( struct sti_cooked_rom *cooked_rom, char *fbfont_name )
559} 554}
560#else 555#else
561struct sti_cooked_font * __init 556struct sti_cooked_font * __init
562sti_select_fbfont(struct sti_cooked_rom *cooked_rom, char *fbfont_name) 557sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name)
563{ 558{
564 return NULL; 559 return NULL;
565} 560}
@@ -617,7 +612,7 @@ sti_cook_fonts(struct sti_cooked_rom *cooked_rom,
617 struct sti_rom_font *raw_font, *font_start; 612 struct sti_rom_font *raw_font, *font_start;
618 struct sti_cooked_font *cooked_font; 613 struct sti_cooked_font *cooked_font;
619 614
620 cooked_font = kmalloc(sizeof(*cooked_font), GFP_KERNEL); 615 cooked_font = kzalloc(sizeof(*cooked_font), GFP_KERNEL);
621 if (!cooked_font) 616 if (!cooked_font)
622 return 0; 617 return 0;
623 618
@@ -631,7 +626,7 @@ sti_cook_fonts(struct sti_cooked_rom *cooked_rom,
631 while (raw_font->next_font) { 626 while (raw_font->next_font) {
632 raw_font = ((void *)font_start) + (raw_font->next_font); 627 raw_font = ((void *)font_start) + (raw_font->next_font);
633 628
634 cooked_font->next_font = kmalloc(sizeof(*cooked_font), GFP_KERNEL); 629 cooked_font->next_font = kzalloc(sizeof(*cooked_font), GFP_KERNEL);
635 if (!cooked_font->next_font) 630 if (!cooked_font->next_font)
636 return 1; 631 return 1;
637 632
@@ -668,10 +663,9 @@ sti_bmode_font_raw(struct sti_cooked_font *f)
668 unsigned char *n, *p, *q; 663 unsigned char *n, *p, *q;
669 int size = f->raw->bytes_per_char*256+sizeof(struct sti_rom_font); 664 int size = f->raw->bytes_per_char*256+sizeof(struct sti_rom_font);
670 665
671 n = kmalloc (4*size, GFP_KERNEL); 666 n = kzalloc (4*size, GFP_KERNEL);
672 if (!n) 667 if (!n)
673 return NULL; 668 return NULL;
674 memset (n, 0, 4*size);
675 p = n + 3; 669 p = n + 3;
676 q = (unsigned char *)f->raw; 670 q = (unsigned char *)f->raw;
677 while (size--) { 671 while (size--) {
@@ -816,13 +810,12 @@ sti_try_rom_generic(unsigned long address, unsigned long hpa, struct pci_dev *pd
816 return NULL; 810 return NULL;
817 } 811 }
818 812
819 sti = kmalloc(sizeof(*sti), GFP_KERNEL); 813 sti = kzalloc(sizeof(*sti), GFP_KERNEL);
820 if (!sti) { 814 if (!sti) {
821 printk(KERN_ERR "Not enough memory !\n"); 815 printk(KERN_ERR "Not enough memory !\n");
822 return NULL; 816 return NULL;
823 } 817 }
824 818
825 memset(sti, 0, sizeof(*sti));
826 spin_lock_init(&sti->lock); 819 spin_lock_init(&sti->lock);
827 820
828test_rom: 821test_rom:
@@ -1035,7 +1028,7 @@ static struct parisc_driver pa_sti_driver = {
1035 * sti_init_roms() - detects all STI ROMs and stores them in sti_roms[] 1028 * sti_init_roms() - detects all STI ROMs and stores them in sti_roms[]
1036 */ 1029 */
1037 1030
1038static int sticore_initialized; 1031static int sticore_initialized __read_mostly;
1039 1032
1040static void __init sti_init_roms(void) 1033static void __init sti_init_roms(void)
1041{ 1034{