[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:
Tobias Klauser
2006-06-08 22:23:48 -07:00
committed by James Bottomley
parent 9dc399de08
commit 6391a11375
47 changed files with 167 additions and 200 deletions

View File

@@ -146,7 +146,7 @@ static inline const char *spi_signal_to_string(enum spi_signal_type type)
{
int i;
for (i = 0; i < sizeof(signal_types)/sizeof(signal_types[0]); i++) {
for (i = 0; i < ARRAY_SIZE(signal_types); i++) {
if (type == signal_types[i].value)
return signal_types[i].name;
}
@@ -156,7 +156,7 @@ static inline enum spi_signal_type spi_signal_to_value(const char *name)
{
int i, len;
for (i = 0; i < sizeof(signal_types)/sizeof(signal_types[0]); i++) {
for (i = 0; i < ARRAY_SIZE(signal_types); i++) {
len = strlen(signal_types[i].name);
if (strncmp(name, signal_types[i].name, len) == 0 &&
(name[len] == '\n' || name[len] == '\0'))