Hi, this patch do some fixes about ida_proc_get_info(). - Removes unused local variables - Eliminates possible null pointers - Rewrite spin locks order - Define unused CPQ_PROC_PRINT_QUEUES Signed-off-by: Laura Garcia Liebana <[email protected]> diff -Nru a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c --- a/drivers/block/cpqarray.c 2006-06-13 01:03:02.000000000 +0200 +++ b/drivers/block/cpqarray.c 2006-06-13 01:01:29.000000000 +0200 @@ -227,11 +227,11 @@ /* * Report information about this controller. */ -static int ida_proc_get_info(char *buffer, char **start, off_t offset, int length, int *e of, void *data) +static int ida_proc_get_info(char *buffer, char **start, off_t offset, + int length, int *eof, void *data) { - off_t pos = 0; off_t len = 0; - int size, i, ctlr; + int i, ctlr; ctlr_info_t *h = (ctlr_info_t*)data; drv_info_t *drv; #ifdef CPQ_PROC_PRINT_QUEUES @@ -240,7 +240,7 @@ #endif ctlr = h->ctlr; - size = sprintf(buffer, "%s: Compaq %s Controller\n" + len += sprintf(buffer, "%s: Compaq %s Controller\n" " Board ID: 0x%08lx\n" " Firmware Revision: %c%c%c%c\n" " Controller Sig: 0x%08lx\n" @@ -260,47 +260,43 @@ h->log_drives, h->phys_drives, h->Qdepth, h->maxQsinceinit); - pos += size; len += size; - - size = sprintf(buffer+len, "Logical Drive Info:\n"); - pos += size; len += size; + len += sprintf(buffer+len, "Logical Drive Info:\n"); for(i=0; i<h->log_drives; i++) { drv = &h->drv[i]; - size = sprintf(buffer+len, "ida/c%dd%d: blksz=%d nr_blks=%d\n", + len += sprintf(buffer+len, "ida/c%dd%d: blksz=%d nr_blks=%d\n", ctlr, i, drv->blk_size, drv->nr_blks); - pos += size; len += size; } #ifdef CPQ_PROC_PRINT_QUEUES - spin_lock_irqsave(IDA_LOCK(h->ctlr), flags); - size = sprintf(buffer+len, "\nCurrent Queues:\n"); - pos += size; len += size; + len += sprintf(buffer+len, "\nCurrent Queues:\n"); + spin_lock_irqsave(IDA_LOCK(ctlr), flags); c = h->reqQ; - size = sprintf(buffer+len, "reqQ = %p", c); pos += size; len += size; - if (c) c=c->next; - while(c && c != h->reqQ) { - size = sprintf(buffer+len, "->%p", c); - pos += size; len += size; + if (c) { + len += sprintf(buffer+len, "reqQ = %p", c); c=c->next; + while(c && c != h->reqQ) { + len += sprintf(buffer+len, "->%p", c); + c=c->next; + } } c = h->cmpQ; - size = sprintf(buffer+len, "\ncmpQ = %p", c); pos += size; len += size; - if (c) c=c->next; - while(c && c != h->cmpQ) { - size = sprintf(buffer+len, "->%p", c); - pos += size; len += size; + if (c) { + len += sprintf(buffer+len, "\ncmpQ = %p", c); c=c->next; + while(c && c != h->cmpQ) { + len += sprintf(buffer+len, "->%p", c); + c=c->next; + } } - size = sprintf(buffer+len, "\n"); pos += size; len += size; - spin_unlock_irqrestore(IDA_LOCK(h->ctlr), flags); + spin_unlock_irqrestore(IDA_LOCK(ctlr), flags); + len += sprintf(buffer+len, "\n"); #endif - size = sprintf(buffer+len, "nr_allocs = %d\nnr_frees = %d\n", + len += sprintf(buffer+len, "nr_allocs = %d\nnr_frees = %d\n", h->nr_allocs, h->nr_frees); - pos += size; len += size; *eof = 1; *start = buffer+offset; diff -Nru a/drivers/block/Kconfig b/drivers/block/Kconfig --- a/drivers/block/Kconfig 2006-06-13 01:04:44.000000000 +0200 +++ b/drivers/block/Kconfig 2006-06-13 01:01:29.000000000 +0200 @@ -154,6 +154,13 @@ supported by this driver, and for further information on the use of this driver. +config CPQ_PROC_PRINT_QUEUES + bool "Print Smart Array Queues information" + depends on BLK_CPQ_DA + help + This option prints some extra information about Smart Array Queues + under proc filesystem. + config BLK_CPQ_CISS_DA tristate "Compaq Smart Array 5xxx support" depends on PCI
Attachment:
cpqarray-ida_proc_get_info.patch
Description: Binary data
- Prev by Date: Re: [discuss] x86_64: x86-64 mailing lists / posting patchkits / x86-64 releases
- Next by Date: Re: [PATCH 04/21] swap_prefetch: Convert nr_mapped to ZVC
- Previous by thread: [BUG] safe_smp_process_id() uses apicid which exceeds NR_CPUs in array
- Next by thread: [RFC/PATCH 2/2] update sunrpc to use in-kernel sockets API
- Index(es):