aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/53c7xx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/53c7xx.c')
-rw-r--r--drivers/scsi/53c7xx.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/scsi/53c7xx.c b/drivers/scsi/53c7xx.c
index 7894b8ea84bd..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;
361static char *setup_strings[] = 361static 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
366static char setup_buffer[SETUP_BUFFER_SIZE]; 366static char setup_buffer[SETUP_BUFFER_SIZE];
367static char setup_used[MAX_SETUP_STRINGS]; 367static char setup_used[MAX_SETUP_STRINGS];
@@ -709,7 +709,7 @@ request_synchronous (int host, int target) {
709 printk (KERN_ALERT "target %d is host ID\n", target); 709 printk (KERN_ALERT "target %d is host ID\n", target);
710 return -1; 710 return -1;
711 } 711 }
712 else if (target > h->max_id) { 712 else if (target >= h->max_id) {
713 printk (KERN_ALERT "target %d exceeds maximum of %d\n", target, 713 printk (KERN_ALERT "target %d exceeds maximum of %d\n", target,
714 h->max_id); 714 h->max_id);
715 return -1; 715 return -1;
@@ -2190,15 +2190,15 @@ static const struct {
2190 */ 2190 */
2191 2191
2192 2192
2193static void 2193static void
2194synchronous (struct Scsi_Host *host, int target, char *msg) { 2194synchronous (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);
@@ -3622,7 +3622,7 @@ NCR53c7xx_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *)) {
3622#ifdef LINUX_1_2 3622#ifdef LINUX_1_2
3623 || cmd->device->id > 7 3623 || cmd->device->id > 7
3624#else 3624#else
3625 || cmd->device->id > host->max_id 3625 || cmd->device->id >= host->max_id
3626#endif 3626#endif
3627 || cmd->device->id == host->this_id 3627 || cmd->device->id == host->this_id
3628 || hostdata->state == STATE_DISABLED) { 3628 || hostdata->state == STATE_DISABLED) {