提交 b8db8002 编写于 作者: G Grant Grundler 提交者: Kyle McMartin

[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: NGrant Grundler <grundler@parisc-linux.org>
Signed-off-by: NKyle McMartin <kyle@parisc-linux.org>
上级 8054f03f
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include <asm/page.h> /* get_order */ #include <asm/page.h> /* get_order */
#include <asm/pgalloc.h> #include <asm/pgalloc.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/tlbflush.h> /* for purge_tlb_*() macros */
static struct proc_dir_entry * proc_gsc_root = NULL; static struct proc_dir_entry * proc_gsc_root = NULL;
static int pcxl_proc_info(char *buffer, char **start, off_t offset, int length); static 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) ...@@ -333,18 +333,28 @@ pcxl_free_range(unsigned long vaddr, size_t size)
static int __init static int __init
pcxl_dma_init(void) pcxl_dma_init(void)
{ {
if (pcxl_dma_start == 0) if (pcxl_dma_start == 0)
return 0; return 0;
spin_lock_init(&pcxl_res_lock); spin_lock_init(&pcxl_res_lock);
pcxl_res_size = PCXL_DMA_MAP_SIZE >> (PAGE_SHIFT + 3); pcxl_res_size = PCXL_DMA_MAP_SIZE >> (PAGE_SHIFT + 3);
pcxl_res_hint = 0; pcxl_res_hint = 0;
pcxl_res_map = (char *)__get_free_pages(GFP_KERNEL, pcxl_res_map = (char *)__get_free_pages(GFP_KERNEL,
get_order(pcxl_res_size)); get_order(pcxl_res_size));
memset(pcxl_res_map, 0, pcxl_res_size); memset(pcxl_res_map, 0, pcxl_res_size);
proc_gsc_root = proc_mkdir("gsc", 0); proc_gsc_root = proc_mkdir("gsc", 0);
create_proc_info_entry("dino", 0, proc_gsc_root, pcxl_proc_info); if (!proc_gsc_root)
return 0; printk(KERN_WARNING
"pcxl_dma_init: Unable to create gsc /proc dir entry\n");
else {
struct proc_dir_entry* ent;
ent = create_proc_info_entry("pcxl_dma", 0,
proc_gsc_root, pcxl_proc_info);
if (!ent)
printk(KERN_WARNING
"pci-dma.c: Unable to create pcxl_dma /proc entry.\n");
}
return 0;
} }
__initcall(pcxl_dma_init); __initcall(pcxl_dma_init);
...@@ -545,16 +555,16 @@ struct hppa_dma_ops pcx_dma_ops = { ...@@ -545,16 +555,16 @@ struct hppa_dma_ops pcx_dma_ops = {
static int pcxl_proc_info(char *buf, char **start, off_t offset, int len) static int pcxl_proc_info(char *buf, char **start, off_t offset, int len)
{ {
#if 0
u_long i = 0; u_long i = 0;
unsigned long *res_ptr = (u_long *)pcxl_res_map; unsigned long *res_ptr = (u_long *)pcxl_res_map;
unsigned long total_pages = pcxl_res_size << 3; /* 8 bits per byte */ #endif
unsigned long total_pages = pcxl_res_size << 3; /* 8 bits per byte */
sprintf(buf, "\nDMA Mapping Area size : %d bytes (%d pages)\n", sprintf(buf, "\nDMA Mapping Area size : %d bytes (%ld pages)\n",
PCXL_DMA_MAP_SIZE, PCXL_DMA_MAP_SIZE, total_pages);
(pcxl_res_size << 3) ); /* 1 bit per page */
sprintf(buf, "%sResource bitmap : %d bytes (%d pages)\n", sprintf(buf, "%sResource bitmap : %d bytes\n", buf, pcxl_res_size);
buf, pcxl_res_size, pcxl_res_size << 3); /* 8 bits per byte */
strcat(buf, " total: free: used: % used:\n"); strcat(buf, " total: free: used: % used:\n");
sprintf(buf, "%sblocks %8d %8ld %8ld %8ld%%\n", buf, pcxl_res_size, 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,7 +574,8 @@ static int pcxl_proc_info(char *buf, char **start, off_t offset, int len)
sprintf(buf, "%spages %8ld %8ld %8ld %8ld%%\n", buf, total_pages, sprintf(buf, "%spages %8ld %8ld %8ld %8ld%%\n", buf, total_pages,
total_pages - pcxl_used_pages, pcxl_used_pages, total_pages - pcxl_used_pages, pcxl_used_pages,
(pcxl_used_pages * 100 / total_pages)); (pcxl_used_pages * 100 / total_pages));
#if 0
strcat(buf, "\nResource bitmap:"); strcat(buf, "\nResource bitmap:");
for(; i < (pcxl_res_size / sizeof(u_long)); ++i, ++res_ptr) { 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,6 +583,7 @@ static int pcxl_proc_info(char *buf, char **start, off_t offset, int len)
strcat(buf,"\n "); strcat(buf,"\n ");
sprintf(buf, "%s %08lx", buf, *res_ptr); sprintf(buf, "%s %08lx", buf, *res_ptr);
} }
#endif
strcat(buf, "\n"); strcat(buf, "\n");
return strlen(buf); return strlen(buf);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册