diff options
author | Tobias Klauser <tklauser@nuerscht.ch> | 2006-06-09 01:23:48 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-06-10 11:45:30 -0400 |
commit | 6391a11375de5e2bb1eb8481e54619761dc65d9f (patch) | |
tree | 956aae1d278a3f731b2e6148ff40a69aa7957ea8 /drivers/scsi/scsi_transport_fc.c | |
parent | 9dc399de0840a478adb71278becf598d3ab3aacc (diff) |
[SCSI] drivers/scsi: Use ARRAY_SIZE macro
Use ARRAY_SIZE macro instead of sizeof(x)/sizeof(x[0]) and remove
duplicates of the macro.
Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/scsi_transport_fc.c')
-rw-r--r-- | drivers/scsi/scsi_transport_fc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 95c5478dcdfd..f2db7a41cf1d 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c | |||
@@ -50,7 +50,7 @@ static const char *get_fc_##title##_name(enum table_type table_key) \ | |||
50 | int i; \ | 50 | int i; \ |
51 | char *name = NULL; \ | 51 | char *name = NULL; \ |
52 | \ | 52 | \ |
53 | for (i = 0; i < sizeof(table)/sizeof(table[0]); i++) { \ | 53 | for (i = 0; i < ARRAY_SIZE(table); i++) { \ |
54 | if (table[i].value == table_key) { \ | 54 | if (table[i].value == table_key) { \ |
55 | name = table[i].name; \ | 55 | name = table[i].name; \ |
56 | break; \ | 56 | break; \ |
@@ -65,7 +65,7 @@ static int get_fc_##title##_match(const char *table_key, \ | |||
65 | { \ | 65 | { \ |
66 | int i; \ | 66 | int i; \ |
67 | \ | 67 | \ |
68 | for (i = 0; i < sizeof(table)/sizeof(table[0]); i++) { \ | 68 | for (i = 0; i < ARRAY_SIZE(table); i++) { \ |
69 | if (strncmp(table_key, table[i].name, \ | 69 | if (strncmp(table_key, table[i].name, \ |
70 | table[i].matchlen) == 0) { \ | 70 | table[i].matchlen) == 0) { \ |
71 | *value = table[i].value; \ | 71 | *value = table[i].value; \ |
@@ -140,7 +140,7 @@ get_fc_##title##_names(u32 table_key, char *buf) \ | |||
140 | ssize_t len = 0; \ | 140 | ssize_t len = 0; \ |
141 | int i; \ | 141 | int i; \ |
142 | \ | 142 | \ |
143 | for (i = 0; i < sizeof(table)/sizeof(table[0]); i++) { \ | 143 | for (i = 0; i < ARRAY_SIZE(table); i++) { \ |
144 | if (table[i].value & table_key) { \ | 144 | if (table[i].value & table_key) { \ |
145 | len += sprintf(buf + len, "%s%s", \ | 145 | len += sprintf(buf + len, "%s%s", \ |
146 | prefix, table[i].name); \ | 146 | prefix, table[i].name); \ |