Skip to content

Commit

Permalink
IB/core: Use ARRAY_SIZE macro for mandatory_table
Browse files Browse the repository at this point in the history
Use ARRAY_SIZE() macro already defined in kernel.h instead of open
coding equivalent code.

Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
  • Loading branch information
a-darwish authored and Roland Dreier committed Feb 10, 2007
1 parent 99d4f22 commit 9a6b090
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/infiniband/core/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <linux/module.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/mutex.h>
Expand Down Expand Up @@ -93,7 +94,7 @@ static int ib_device_check_mandatory(struct ib_device *device)
};
int i;

for (i = 0; i < sizeof mandatory_table / sizeof mandatory_table[0]; ++i) {
for (i = 0; i < ARRAY_SIZE(mandatory_table); ++i) {
if (!*(void **) ((void *) device + mandatory_table[i].offset)) {
printk(KERN_WARNING "Device %s is missing mandatory function %s\n",
device->name, mandatory_table[i].name);
Expand Down

0 comments on commit 9a6b090

Please sign in to comment.