aboutsummaryrefslogtreecommitdiffstats
path: root/arch/parisc/kernel/pci-dma.c
diff options
context:
space:
mode:
authorGrant Grundler <grundler@parisc-linux.org>2005-10-21 22:50:48 -0400
committerKyle McMartin <kyle@parisc-linux.org>2005-10-21 22:50:48 -0400
commitb8db800295fd31f8beb39fd1de63660aa7aef47b (patch)
tree0c1a00f6dcc0c8950ceffce45323b606a70db471 /arch/parisc/kernel/pci-dma.c
parent8054f03f6330f20e9d47e2f6c7b1d01ddf5adeef (diff)
[PARISC] Cleanup whitespace and handle proc_mkdir() failures in pci-dma.c
1) cleanup whitespace and handle proc_mkdir() failures. From: Christophe Lucas <clucas@rotomalug.org> 2) rename "dino" entry to "pcxl_dma"...also seems like it's in the wrong location. 3) don't dump resource bitmap in /proc/pcxl_dma output 4) fixup compiler warning Signed-off-by: Grant Grundler <grundler@parisc-linux.org> Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
Diffstat (limited to 'arch/parisc/kernel/pci-dma.c')
-rw-r--r--arch/parisc/kernel/pci-dma.c48
1 files changed, 30 insertions, 18 deletions
diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
index 368cc095c99f..d9b447cb1a0d 100644
--- a/arch/parisc/kernel/pci-dma.c
+++ b/arch/parisc/kernel/pci-dma.c
@@ -31,7 +31,7 @@
31#include <asm/page.h> /* get_order */ 31#include <asm/page.h> /* get_order */
32#include <asm/pgalloc.h> 32#include <asm/pgalloc.h>
33#include <asm/uaccess.h> 33#include <asm/uaccess.h>
34 34#include <asm/tlbflush.h> /* for purge_tlb_*() macros */
35 35
36static struct proc_dir_entry * proc_gsc_root = NULL; 36static struct proc_dir_entry * proc_gsc_root = NULL;
37static int pcxl_proc_info(char *buffer, char **start, off_t offset, int length); 37static int pcxl_proc_info(char *buffer, char **start, off_t offset, int length);
@@ -333,18 +333,28 @@ pcxl_free_range(unsigned long vaddr, size_t size)
333static int __init 333static int __init
334pcxl_dma_init(void) 334pcxl_dma_init(void)
335{ 335{
336 if (pcxl_dma_start == 0) 336 if (pcxl_dma_start == 0)
337 return 0; 337 return 0;
338 338
339 spin_lock_init(&pcxl_res_lock); 339 spin_lock_init(&pcxl_res_lock);
340 pcxl_res_size = PCXL_DMA_MAP_SIZE >> (PAGE_SHIFT + 3); 340 pcxl_res_size = PCXL_DMA_MAP_SIZE >> (PAGE_SHIFT + 3);
341 pcxl_res_hint = 0; 341 pcxl_res_hint = 0;
342 pcxl_res_map = (char *)__get_free_pages(GFP_KERNEL, 342 pcxl_res_map = (char *)__get_free_pages(GFP_KERNEL,
343 get_order(pcxl_res_size)); 343 get_order(pcxl_res_size));
344 memset(pcxl_res_map, 0, pcxl_res_size); 344 memset(pcxl_res_map, 0, pcxl_res_size);
345 proc_gsc_root = proc_mkdir("gsc", 0); 345 proc_gsc_root = proc_mkdir("gsc", 0);
346 create_proc_info_entry("dino", 0, proc_gsc_root, pcxl_proc_info); 346 if (!proc_gsc_root)
347 return 0; 347 printk(KERN_WARNING
348 "pcxl_dma_init: Unable to create gsc /proc dir entry\n");
349 else {
350 struct proc_dir_entry* ent;
351 ent = create_proc_info_entry("pcxl_dma", 0,
352 proc_gsc_root, pcxl_proc_info);
353 if (!ent)
354 printk(KERN_WARNING
355 "pci-dma.c: Unable to create pcxl_dma /proc entry.\n");
356 }
357 return 0;
348} 358}
349 359
350__initcall(pcxl_dma_init); 360__initcall(pcxl_dma_init);
@@ -545,16 +555,16 @@ struct hppa_dma_ops pcx_dma_ops = {
545 555
546static int pcxl_proc_info(char *buf, char **start, off_t offset, int len) 556static int pcxl_proc_info(char *buf, char **start, off_t offset, int len)
547{ 557{
558#if 0
548 u_long i = 0; 559 u_long i = 0;
549 unsigned long *res_ptr = (u_long *)pcxl_res_map; 560 unsigned long *res_ptr = (u_long *)pcxl_res_map;
550 unsigned long total_pages = pcxl_res_size << 3; /* 8 bits per byte */ 561#endif
562 unsigned long total_pages = pcxl_res_size << 3; /* 8 bits per byte */
551 563
552 sprintf(buf, "\nDMA Mapping Area size : %d bytes (%d pages)\n", 564 sprintf(buf, "\nDMA Mapping Area size : %d bytes (%ld pages)\n",
553 PCXL_DMA_MAP_SIZE, 565 PCXL_DMA_MAP_SIZE, total_pages);
554 (pcxl_res_size << 3) ); /* 1 bit per page */
555 566
556 sprintf(buf, "%sResource bitmap : %d bytes (%d pages)\n", 567 sprintf(buf, "%sResource bitmap : %d bytes\n", buf, pcxl_res_size);
557 buf, pcxl_res_size, pcxl_res_size << 3); /* 8 bits per byte */
558 568
559 strcat(buf, " total: free: used: % used:\n"); 569 strcat(buf, " total: free: used: % used:\n");
560 sprintf(buf, "%sblocks %8d %8ld %8ld %8ld%%\n", buf, pcxl_res_size, 570 sprintf(buf, "%sblocks %8d %8ld %8ld %8ld%%\n", buf, pcxl_res_size,
@@ -564,7 +574,8 @@ static int pcxl_proc_info(char *buf, char **start, off_t offset, int len)
564 sprintf(buf, "%spages %8ld %8ld %8ld %8ld%%\n", buf, total_pages, 574 sprintf(buf, "%spages %8ld %8ld %8ld %8ld%%\n", buf, total_pages,
565 total_pages - pcxl_used_pages, pcxl_used_pages, 575 total_pages - pcxl_used_pages, pcxl_used_pages,
566 (pcxl_used_pages * 100 / total_pages)); 576 (pcxl_used_pages * 100 / total_pages));
567 577
578#if 0
568 strcat(buf, "\nResource bitmap:"); 579 strcat(buf, "\nResource bitmap:");
569 580
570 for(; i < (pcxl_res_size / sizeof(u_long)); ++i, ++res_ptr) { 581 for(; i < (pcxl_res_size / sizeof(u_long)); ++i, ++res_ptr) {
@@ -572,6 +583,7 @@ static int pcxl_proc_info(char *buf, char **start, off_t offset, int len)
572 strcat(buf,"\n "); 583 strcat(buf,"\n ");
573 sprintf(buf, "%s %08lx", buf, *res_ptr); 584 sprintf(buf, "%s %08lx", buf, *res_ptr);
574 } 585 }
586#endif
575 strcat(buf, "\n"); 587 strcat(buf, "\n");
576 return strlen(buf); 588 return strlen(buf);
577} 589}