Commit 5e8621e8 authored by Bjorn Helgaas's avatar Bjorn Helgaas Committed by Linus Torvalds

[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: default avatarBjorn Helgaas <bjorn.helgaas@hp.com>
Acked-by: default avatarJeff Garzik <jeff@garzik.org>
Acked-by: default avatarMike Miller <mike.miller@hp.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 40aabb58
...@@ -104,8 +104,6 @@ static const struct pci_device_id cciss_pci_device_id[] = { ...@@ -104,8 +104,6 @@ static const struct pci_device_id cciss_pci_device_id[] = {
}; };
MODULE_DEVICE_TABLE(pci, cciss_pci_device_id); MODULE_DEVICE_TABLE(pci, cciss_pci_device_id);
#define NR_PRODUCTS ARRAY_SIZE(products)
/* board_id = Subsystem Device ID & Vendor ID /* board_id = Subsystem Device ID & Vendor ID
* product = Marketing Name for the board * product = Marketing Name for the board
* access = Address of the struct of function pointers * 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,14 +2829,14 @@ static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev)
print_cfg_table(c->cfgtable); print_cfg_table(c->cfgtable);
#endif /* CCISS_DEBUG */ #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) { if (board_id == products[i].board_id) {
c->product_name = products[i].product_name; c->product_name = products[i].product_name;
c->access = *(products[i].access); c->access = *(products[i].access);
break; break;
} }
} }
if (i == NR_PRODUCTS) { if (i == ARRAY_SIZE(products)) {
printk(KERN_WARNING "cciss: Sorry, I don't know how" printk(KERN_WARNING "cciss: Sorry, I don't know how"
" to access the Smart Array controller %08lx\n", " to access the Smart Array controller %08lx\n",
(unsigned long)board_id); (unsigned long)board_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment