From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Mike Miller <mike.miller@hp.com>
Cc: iss_storagedev@hp.com, linux-kernel@vger.kernel.org,
Andrew Morton <akpm@osdl.org>
Subject: [PATCH 4/7] CCISS: use ARRAY_SIZE without intermediates
Date: Wed, 14 Jun 2006 17:10:57 -0600 [thread overview]
Message-ID: <200606141710.58041.bjorn.helgaas@hp.com> (raw)
In-Reply-To: <200606141707.27404.bjorn.helgaas@hp.com>
It's easier to verify loop bounds if the array name is mentioned
the for() statement that steps through the array.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Index: rc5-mm3/drivers/block/cciss.c
===================================================================
--- rc5-mm3.orig/drivers/block/cciss.c 2006-06-14 15:15:28.000000000 -0600
+++ rc5-mm3/drivers/block/cciss.c 2006-06-14 15:16:13.000000000 -0600
@@ -104,8 +104,6 @@
};
MODULE_DEVICE_TABLE(pci, cciss_pci_device_id);
-#define NR_PRODUCTS ARRAY_SIZE(products)
-
/* board_id = Subsystem Device ID & Vendor ID
* product = Marketing Name for the board
* access = Address of the struct of function pointers
@@ -2831,14 +2829,14 @@
print_cfg_table(c->cfgtable);
#endif /* CCISS_DEBUG */
- for(i=0; i<NR_PRODUCTS; i++) {
+ for(i=0; i<ARRAY_SIZE(products); i++) {
if (board_id == products[i].board_id) {
c->product_name = products[i].product_name;
c->access = *(products[i].access);
break;
}
}
- if (i == NR_PRODUCTS) {
+ if (i == ARRAY_SIZE(products)) {
printk(KERN_WARNING "cciss: Sorry, I don't know how"
" to access the Smart Array controller %08lx\n",
(unsigned long)board_id);
next prev parent reply other threads:[~2006-06-14 23:11 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-14 23:07 [PATCH 0/7] CCISS cleanups Bjorn Helgaas
2006-06-14 23:08 ` [PATCH 1/7] CCISS: disable device when returning failure Bjorn Helgaas
2006-06-14 23:36 ` Jeff Garzik
2006-06-15 14:32 ` Miller, Mike (OS Dev)
2006-06-14 23:09 ` [PATCH 2/7] CCISS: request all PCI resources Bjorn Helgaas
2006-06-15 14:35 ` Miller, Mike (OS Dev)
2006-06-14 23:10 ` [PATCH 3/7] CCISS: announce cciss%d devices with PCI address/IRQ/DAC info Bjorn Helgaas
2006-06-14 23:37 ` Jeff Garzik
2006-06-15 14:37 ` Miller, Mike (OS Dev)
2006-06-14 23:10 ` Bjorn Helgaas [this message]
2006-06-14 23:37 ` [PATCH 4/7] CCISS: use ARRAY_SIZE without intermediates Jeff Garzik
2006-06-15 14:38 ` Miller, Mike (OS Dev)
2006-06-14 23:11 ` [PATCH 5/7] CCISS: fix a few spelling errors Bjorn Helgaas
2006-06-15 14:40 ` Miller, Mike (OS Dev)
2006-06-14 23:12 ` [PATCH 6/7] CCISS: remove parens around return values Bjorn Helgaas
2006-06-15 14:42 ` Miller, Mike (OS Dev)
[not found] ` <200606141713.46497.bjorn.helgaas@hp.com>
2006-06-15 4:08 ` [PATCH 7/7] CCISS: run through Lindent Bjorn Helgaas
[not found] ` <c6b285c60606150114h273f5ceue19bcea43937e86c@mail.gmail.com>
2006-06-15 8:35 ` [PATCH 0/7] CCISS cleanups Laura Garcia
2006-06-15 11:50 ` Jeff Garzik
2006-06-15 16:57 ` [PATCH 8/7] CCISS: tidy up product table indentation Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200606141710.58041.bjorn.helgaas@hp.com \
--to=bjorn.helgaas@hp.com \
--cc=akpm@osdl.org \
--cc=iss_storagedev@hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mike.miller@hp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®