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/aic7xxx/aic79xx_osm.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/aic7xxx/aic79xx_osm.c')
-rw-r--r-- | drivers/scsi/aic7xxx/aic79xx_osm.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c index 66e4a47bb9ee..e0ccdf362200 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm.c | |||
@@ -916,7 +916,7 @@ ahd_linux_setup_iocell_info(u_long index, int instance, int targ, int32_t value) | |||
916 | { | 916 | { |
917 | 917 | ||
918 | if ((instance >= 0) | 918 | if ((instance >= 0) |
919 | && (instance < NUM_ELEMENTS(aic79xx_iocell_info))) { | 919 | && (instance < ARRAY_SIZE(aic79xx_iocell_info))) { |
920 | uint8_t *iocell_info; | 920 | uint8_t *iocell_info; |
921 | 921 | ||
922 | iocell_info = (uint8_t*)&aic79xx_iocell_info[instance]; | 922 | iocell_info = (uint8_t*)&aic79xx_iocell_info[instance]; |
@@ -934,7 +934,7 @@ ahd_linux_setup_tag_info_global(char *p) | |||
934 | tags = simple_strtoul(p + 1, NULL, 0) & 0xff; | 934 | tags = simple_strtoul(p + 1, NULL, 0) & 0xff; |
935 | printf("Setting Global Tags= %d\n", tags); | 935 | printf("Setting Global Tags= %d\n", tags); |
936 | 936 | ||
937 | for (i = 0; i < NUM_ELEMENTS(aic79xx_tag_info); i++) { | 937 | for (i = 0; i < ARRAY_SIZE(aic79xx_tag_info); i++) { |
938 | for (j = 0; j < AHD_NUM_TARGETS; j++) { | 938 | for (j = 0; j < AHD_NUM_TARGETS; j++) { |
939 | aic79xx_tag_info[i].tag_commands[j] = tags; | 939 | aic79xx_tag_info[i].tag_commands[j] = tags; |
940 | } | 940 | } |
@@ -946,7 +946,7 @@ ahd_linux_setup_tag_info(u_long arg, int instance, int targ, int32_t value) | |||
946 | { | 946 | { |
947 | 947 | ||
948 | if ((instance >= 0) && (targ >= 0) | 948 | if ((instance >= 0) && (targ >= 0) |
949 | && (instance < NUM_ELEMENTS(aic79xx_tag_info)) | 949 | && (instance < ARRAY_SIZE(aic79xx_tag_info)) |
950 | && (targ < AHD_NUM_TARGETS)) { | 950 | && (targ < AHD_NUM_TARGETS)) { |
951 | aic79xx_tag_info[instance].tag_commands[targ] = value & 0x1FF; | 951 | aic79xx_tag_info[instance].tag_commands[targ] = value & 0x1FF; |
952 | if (bootverbose) | 952 | if (bootverbose) |
@@ -1072,21 +1072,21 @@ aic79xx_setup(char *s) | |||
1072 | end = strchr(s, '\0'); | 1072 | end = strchr(s, '\0'); |
1073 | 1073 | ||
1074 | /* | 1074 | /* |
1075 | * XXX ia64 gcc isn't smart enough to know that NUM_ELEMENTS | 1075 | * XXX ia64 gcc isn't smart enough to know that ARRAY_SIZE |
1076 | * will never be 0 in this case. | 1076 | * will never be 0 in this case. |
1077 | */ | 1077 | */ |
1078 | n = 0; | 1078 | n = 0; |
1079 | 1079 | ||
1080 | while ((p = strsep(&s, ",.")) != NULL) { | 1080 | while ((p = strsep(&s, ",.")) != NULL) { |
1081 | if (*p == '\0') | 1081 | if (*p == '\0') |
1082 | continue; | 1082 | continue; |
1083 | for (i = 0; i < NUM_ELEMENTS(options); i++) { | 1083 | for (i = 0; i < ARRAY_SIZE(options); i++) { |
1084 | 1084 | ||
1085 | n = strlen(options[i].name); | 1085 | n = strlen(options[i].name); |
1086 | if (strncmp(options[i].name, p, n) == 0) | 1086 | if (strncmp(options[i].name, p, n) == 0) |
1087 | break; | 1087 | break; |
1088 | } | 1088 | } |
1089 | if (i == NUM_ELEMENTS(options)) | 1089 | if (i == ARRAY_SIZE(options)) |
1090 | continue; | 1090 | continue; |
1091 | 1091 | ||
1092 | if (strncmp(p, "global_tag_depth", n) == 0) { | 1092 | if (strncmp(p, "global_tag_depth", n) == 0) { |
@@ -1294,7 +1294,7 @@ ahd_platform_init(struct ahd_softc *ahd) | |||
1294 | /* | 1294 | /* |
1295 | * Lookup and commit any modified IO Cell options. | 1295 | * Lookup and commit any modified IO Cell options. |
1296 | */ | 1296 | */ |
1297 | if (ahd->unit < NUM_ELEMENTS(aic79xx_iocell_info)) { | 1297 | if (ahd->unit < ARRAY_SIZE(aic79xx_iocell_info)) { |
1298 | struct ahd_linux_iocell_opts *iocell_opts; | 1298 | struct ahd_linux_iocell_opts *iocell_opts; |
1299 | 1299 | ||
1300 | iocell_opts = &aic79xx_iocell_info[ahd->unit]; | 1300 | iocell_opts = &aic79xx_iocell_info[ahd->unit]; |
@@ -1426,7 +1426,7 @@ ahd_linux_user_tagdepth(struct ahd_softc *ahd, struct ahd_devinfo *devinfo) | |||
1426 | 1426 | ||
1427 | tags = 0; | 1427 | tags = 0; |
1428 | if ((ahd->user_discenable & devinfo->target_mask) != 0) { | 1428 | if ((ahd->user_discenable & devinfo->target_mask) != 0) { |
1429 | if (ahd->unit >= NUM_ELEMENTS(aic79xx_tag_info)) { | 1429 | if (ahd->unit >= ARRAY_SIZE(aic79xx_tag_info)) { |
1430 | 1430 | ||
1431 | if (warned_user == 0) { | 1431 | if (warned_user == 0) { |
1432 | printf(KERN_WARNING | 1432 | printf(KERN_WARNING |