[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>
This commit is contained in:
committed by
James Bottomley
parent
9dc399de08
commit
6391a11375
@@ -65,7 +65,7 @@ get_sas_##title##_names(u32 table_key, char *buf) \
|
||||
ssize_t len = 0; \
|
||||
int i; \
|
||||
\
|
||||
for (i = 0; i < sizeof(table)/sizeof(table[0]); i++) { \
|
||||
for (i = 0; i < ARRAY_SIZE(table); i++) { \
|
||||
if (table[i].value & table_key) { \
|
||||
len += sprintf(buf + len, "%s%s", \
|
||||
prefix, table[i].name); \
|
||||
@@ -83,7 +83,7 @@ get_sas_##title##_names(u32 table_key, char *buf) \
|
||||
ssize_t len = 0; \
|
||||
int i; \
|
||||
\
|
||||
for (i = 0; i < sizeof(table)/sizeof(table[0]); i++) { \
|
||||
for (i = 0; i < ARRAY_SIZE(table); i++) { \
|
||||
if (table[i].value == table_key) { \
|
||||
len += sprintf(buf + len, "%s", \
|
||||
table[i].name); \
|
||||
|
Reference in New Issue
Block a user