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/53c7xx.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/53c7xx.c')
-rw-r--r-- | drivers/scsi/53c7xx.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/scsi/53c7xx.c b/drivers/scsi/53c7xx.c index cfc991271cc8..765769a629e4 100644 --- a/drivers/scsi/53c7xx.c +++ b/drivers/scsi/53c7xx.c | |||
@@ -361,7 +361,7 @@ int CmdPageStart = (0 - Ent_dsa_zero - sizeof(struct NCR53c7x0_cmd)) & 0xff; | |||
361 | static char *setup_strings[] = | 361 | static char *setup_strings[] = |
362 | {"","","","","","","",""}; | 362 | {"","","","","","","",""}; |
363 | 363 | ||
364 | #define MAX_SETUP_STRINGS (sizeof(setup_strings) / sizeof(char *)) | 364 | #define MAX_SETUP_STRINGS ARRAY_SIZE(setup_strings) |
365 | #define SETUP_BUFFER_SIZE 200 | 365 | #define SETUP_BUFFER_SIZE 200 |
366 | static char setup_buffer[SETUP_BUFFER_SIZE]; | 366 | static char setup_buffer[SETUP_BUFFER_SIZE]; |
367 | static char setup_used[MAX_SETUP_STRINGS]; | 367 | static char setup_used[MAX_SETUP_STRINGS]; |
@@ -2190,15 +2190,15 @@ static const struct { | |||
2190 | */ | 2190 | */ |
2191 | 2191 | ||
2192 | 2192 | ||
2193 | static void | 2193 | static void |
2194 | synchronous (struct Scsi_Host *host, int target, char *msg) { | 2194 | synchronous (struct Scsi_Host *host, int target, char *msg) { |
2195 | struct NCR53c7x0_hostdata *hostdata = (struct NCR53c7x0_hostdata *) | 2195 | struct NCR53c7x0_hostdata *hostdata = (struct NCR53c7x0_hostdata *) |
2196 | host->hostdata[0]; | 2196 | host->hostdata[0]; |
2197 | int desire, divisor, i, limit; | 2197 | int desire, divisor, i, limit; |
2198 | unsigned char scntl3, sxfer; | 2198 | unsigned char scntl3, sxfer; |
2199 | /* The diagnostic message fits on one line, even with max. width integers */ | 2199 | /* The diagnostic message fits on one line, even with max. width integers */ |
2200 | char buf[80]; | 2200 | char buf[80]; |
2201 | 2201 | ||
2202 | /* Desired transfer clock in Hz */ | 2202 | /* Desired transfer clock in Hz */ |
2203 | desire = 1000000000L / (msg[3] * 4); | 2203 | desire = 1000000000L / (msg[3] * 4); |
2204 | /* Scale the available SCSI clock by 10 so we get tenths */ | 2204 | /* Scale the available SCSI clock by 10 so we get tenths */ |
@@ -2209,14 +2209,14 @@ synchronous (struct Scsi_Host *host, int target, char *msg) { | |||
2209 | msg[4] = 8; | 2209 | msg[4] = 8; |
2210 | 2210 | ||
2211 | if (hostdata->options & OPTION_DEBUG_SDTR) | 2211 | if (hostdata->options & OPTION_DEBUG_SDTR) |
2212 | printk("scsi%d : optimal synchronous divisor of %d.%01d\n", | 2212 | printk("scsi%d : optimal synchronous divisor of %d.%01d\n", |
2213 | host->host_no, divisor / 10, divisor % 10); | 2213 | host->host_no, divisor / 10, divisor % 10); |
2214 | 2214 | ||
2215 | limit = (sizeof(syncs) / sizeof(syncs[0]) -1); | 2215 | limit = ARRAY_SIZE(syncs) - 1; |
2216 | for (i = 0; (i < limit) && (divisor > syncs[i].div); ++i); | 2216 | for (i = 0; (i < limit) && (divisor > syncs[i].div); ++i); |
2217 | 2217 | ||
2218 | if (hostdata->options & OPTION_DEBUG_SDTR) | 2218 | if (hostdata->options & OPTION_DEBUG_SDTR) |
2219 | printk("scsi%d : selected synchronous divisor of %d.%01d\n", | 2219 | printk("scsi%d : selected synchronous divisor of %d.%01d\n", |
2220 | host->host_no, syncs[i].div / 10, syncs[i].div % 10); | 2220 | host->host_no, syncs[i].div / 10, syncs[i].div % 10); |
2221 | 2221 | ||
2222 | msg[3] = ((1000000000L / hostdata->scsi_clock) * syncs[i].div / 10 / 4); | 2222 | msg[3] = ((1000000000L / hostdata->scsi_clock) * syncs[i].div / 10 / 4); |