diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2006-06-25 08:49:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-25 13:01:21 -0400 |
commit | 5e8621e8bdc2460da516d5f1a5c71d3467ded5d2 (patch) | |
tree | 90557f32a4df3364cb6ff189f8e75c7d4338fc47 /drivers/block | |
parent | 40aabb5815723551e7c92dd08ed3ea82ec000ccd (diff) |
[PATCH] CCISS: use ARRAY_SIZE without intermediates
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>
Acked-by: Jeff Garzik <jeff@garzik.org>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/cciss.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index f7c3c53bd0cd..94e82a229d9f 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -104,8 +104,6 @@ static const struct pci_device_id cciss_pci_device_id[] = { | |||
104 | }; | 104 | }; |
105 | MODULE_DEVICE_TABLE(pci, cciss_pci_device_id); | 105 | MODULE_DEVICE_TABLE(pci, cciss_pci_device_id); |
106 | 106 | ||
107 | #define NR_PRODUCTS ARRAY_SIZE(products) | ||
108 | |||
109 | /* board_id = Subsystem Device ID & Vendor ID | 107 | /* board_id = Subsystem Device ID & Vendor ID |
110 | * product = Marketing Name for the board | 108 | * product = Marketing Name for the board |
111 | * access = Address of the struct of function pointers | 109 | * access = Address of the struct of function pointers |
@@ -2831,14 +2829,14 @@ static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev) | |||
2831 | print_cfg_table(c->cfgtable); | 2829 | print_cfg_table(c->cfgtable); |
2832 | #endif /* CCISS_DEBUG */ | 2830 | #endif /* CCISS_DEBUG */ |
2833 | 2831 | ||
2834 | for(i=0; i<NR_PRODUCTS; i++) { | 2832 | for(i=0; i<ARRAY_SIZE(products); i++) { |
2835 | if (board_id == products[i].board_id) { | 2833 | if (board_id == products[i].board_id) { |
2836 | c->product_name = products[i].product_name; | 2834 | c->product_name = products[i].product_name; |
2837 | c->access = *(products[i].access); | 2835 | c->access = *(products[i].access); |
2838 | break; | 2836 | break; |
2839 | } | 2837 | } |
2840 | } | 2838 | } |
2841 | if (i == NR_PRODUCTS) { | 2839 | if (i == ARRAY_SIZE(products)) { |
2842 | printk(KERN_WARNING "cciss: Sorry, I don't know how" | 2840 | printk(KERN_WARNING "cciss: Sorry, I don't know how" |
2843 | " to access the Smart Array controller %08lx\n", | 2841 | " to access the Smart Array controller %08lx\n", |
2844 | (unsigned long)board_id); | 2842 | (unsigned long)board_id); |