diff options
author | Ondrej Zary <linux@rainbow-software.org> | 2015-02-06 17:11:43 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Odin.com> | 2015-04-09 21:08:16 -0400 |
commit | cad2fc72cfc092ed3448a0235f59fe003f4f85c3 (patch) | |
tree | 6f750c16cc6de01e36ee631d611678ad4c1c48e2 | |
parent | 17787a09fdfcb07ccc361758737af0dfa1ea4214 (diff) |
aha1542: clean up cmd variables
Make sure that there's no variable named cmd
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
-rw-r--r-- | drivers/scsi/aha1542.c | 53 |
1 files changed, 24 insertions, 29 deletions
diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c index 161586545804..dbe46591a5e2 100644 --- a/drivers/scsi/aha1542.c +++ b/drivers/scsi/aha1542.c | |||
@@ -124,7 +124,7 @@ static inline bool wait_mask(u16 port, u8 mask, u8 allof, u8 noneof, int timeout | |||
124 | routine does not send something out while we are in the middle of this. | 124 | routine does not send something out while we are in the middle of this. |
125 | Fortunately, it is only at boot time that multi-byte messages | 125 | Fortunately, it is only at boot time that multi-byte messages |
126 | are ever sent. */ | 126 | are ever sent. */ |
127 | static int aha1542_outb(unsigned int base, u8 cmd) | 127 | static int aha1542_outb(unsigned int base, u8 val) |
128 | { | 128 | { |
129 | unsigned long flags; | 129 | unsigned long flags; |
130 | 130 | ||
@@ -138,13 +138,13 @@ static int aha1542_outb(unsigned int base, u8 cmd) | |||
138 | spin_unlock_irqrestore(&aha1542_lock, flags); | 138 | spin_unlock_irqrestore(&aha1542_lock, flags); |
139 | continue; | 139 | continue; |
140 | } | 140 | } |
141 | outb(cmd, DATA(base)); | 141 | outb(val, DATA(base)); |
142 | spin_unlock_irqrestore(&aha1542_lock, flags); | 142 | spin_unlock_irqrestore(&aha1542_lock, flags); |
143 | return 0; | 143 | return 0; |
144 | } | 144 | } |
145 | } | 145 | } |
146 | 146 | ||
147 | static int aha1542_out(unsigned int base, u8 *cmdp, int len) | 147 | static int aha1542_out(unsigned int base, u8 *buf, int len) |
148 | { | 148 | { |
149 | unsigned long flags; | 149 | unsigned long flags; |
150 | 150 | ||
@@ -155,7 +155,7 @@ static int aha1542_out(unsigned int base, u8 *cmdp, int len) | |||
155 | printk(KERN_ERR "aha1542_out failed(%d): ", len + 1); | 155 | printk(KERN_ERR "aha1542_out failed(%d): ", len + 1); |
156 | return 1; | 156 | return 1; |
157 | } | 157 | } |
158 | outb(*cmdp++, DATA(base)); | 158 | outb(*buf++, DATA(base)); |
159 | } | 159 | } |
160 | spin_unlock_irqrestore(&aha1542_lock, flags); | 160 | spin_unlock_irqrestore(&aha1542_lock, flags); |
161 | if (!wait_mask(INTRFLAGS(base), INTRMASK, HACC, 0, 0)) | 161 | if (!wait_mask(INTRFLAGS(base), INTRMASK, HACC, 0, 0)) |
@@ -167,7 +167,7 @@ static int aha1542_out(unsigned int base, u8 *cmdp, int len) | |||
167 | /* Only used at boot time, so we do not need to worry about latency as much | 167 | /* Only used at boot time, so we do not need to worry about latency as much |
168 | here */ | 168 | here */ |
169 | 169 | ||
170 | static int aha1542_in(unsigned int base, u8 *cmdp, int len, int timeout) | 170 | static int aha1542_in(unsigned int base, u8 *buf, int len, int timeout) |
171 | { | 171 | { |
172 | unsigned long flags; | 172 | unsigned long flags; |
173 | 173 | ||
@@ -179,7 +179,7 @@ static int aha1542_in(unsigned int base, u8 *cmdp, int len, int timeout) | |||
179 | printk(KERN_ERR "aha1542_in failed(%d): ", len + 1); | 179 | printk(KERN_ERR "aha1542_in failed(%d): ", len + 1); |
180 | return 1; | 180 | return 1; |
181 | } | 181 | } |
182 | *cmdp++ = inb(DATA(base)); | 182 | *buf++ = inb(DATA(base)); |
183 | } | 183 | } |
184 | spin_unlock_irqrestore(&aha1542_lock, flags); | 184 | spin_unlock_irqrestore(&aha1542_lock, flags); |
185 | return 0; | 185 | return 0; |
@@ -244,8 +244,7 @@ static int makecode(unsigned hosterr, unsigned scsierr) | |||
244 | static int aha1542_test_port(int bse, struct Scsi_Host *shpnt) | 244 | static int aha1542_test_port(int bse, struct Scsi_Host *shpnt) |
245 | { | 245 | { |
246 | u8 inquiry_result[4]; | 246 | u8 inquiry_result[4]; |
247 | u8 *cmdp; | 247 | int i; |
248 | int len; | ||
249 | 248 | ||
250 | /* Quick and dirty test for presence of the card. */ | 249 | /* Quick and dirty test for presence of the card. */ |
251 | if (inb(STATUS(bse)) == 0xff) | 250 | if (inb(STATUS(bse)) == 0xff) |
@@ -273,13 +272,10 @@ static int aha1542_test_port(int bse, struct Scsi_Host *shpnt) | |||
273 | 272 | ||
274 | aha1542_outb(bse, CMD_INQUIRY); | 273 | aha1542_outb(bse, CMD_INQUIRY); |
275 | 274 | ||
276 | len = 4; | 275 | for (i = 0; i < 4; i++) { |
277 | cmdp = &inquiry_result[0]; | ||
278 | |||
279 | while (len--) { | ||
280 | if (!wait_mask(STATUS(bse), DF, DF, 0, 0)) | 276 | if (!wait_mask(STATUS(bse), DF, DF, 0, 0)) |
281 | return 0; | 277 | return 0; |
282 | *cmdp++ = inb(DATA(bse)); | 278 | inquiry_result[i] = inb(DATA(bse)); |
283 | } | 279 | } |
284 | 280 | ||
285 | /* Reading port should reset DF */ | 281 | /* Reading port should reset DF */ |
@@ -463,7 +459,6 @@ static int aha1542_queuecommand_lck(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd * | |||
463 | { | 459 | { |
464 | struct aha1542_hostdata *aha1542 = shost_priv(SCpnt->device->host); | 460 | struct aha1542_hostdata *aha1542 = shost_priv(SCpnt->device->host); |
465 | u8 direction; | 461 | u8 direction; |
466 | u8 *cmd = (u8 *) SCpnt->cmnd; | ||
467 | u8 target = SCpnt->device->id; | 462 | u8 target = SCpnt->device->id; |
468 | u8 lun = SCpnt->device->lun; | 463 | u8 lun = SCpnt->device->lun; |
469 | unsigned long flags; | 464 | unsigned long flags; |
@@ -480,28 +475,28 @@ static int aha1542_queuecommand_lck(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd * | |||
480 | } | 475 | } |
481 | ); | 476 | ); |
482 | 477 | ||
483 | if (*cmd == REQUEST_SENSE) { | 478 | if (*SCpnt->cmnd == REQUEST_SENSE) { |
484 | /* Don't do the command - we have the sense data already */ | 479 | /* Don't do the command - we have the sense data already */ |
485 | SCpnt->result = 0; | 480 | SCpnt->result = 0; |
486 | done(SCpnt); | 481 | done(SCpnt); |
487 | return 0; | 482 | return 0; |
488 | } | 483 | } |
489 | #ifdef DEBUG | 484 | #ifdef DEBUG |
490 | if (*cmd == READ_10 || *cmd == WRITE_10) | 485 | if (*SCpnt->cmnd == READ_10 || *SCpnt->cmnd == WRITE_10) |
491 | i = xscsi2int(cmd + 2); | 486 | i = xscsi2int(SCpnt->cmnd + 2); |
492 | else if (*cmd == READ_6 || *cmd == WRITE_6) | 487 | else if (*SCpnt->cmnd == READ_6 || *SCpnt->cmnd == WRITE_6) |
493 | i = scsi2int(cmd + 2); | 488 | i = scsi2int(SCpnt->cmnd + 2); |
494 | else | 489 | else |
495 | i = -1; | 490 | i = -1; |
496 | if (done) | 491 | if (done) |
497 | printk(KERN_DEBUG "aha1542_queuecommand: dev %d cmd %02x pos %d len %d ", target, *cmd, i, bufflen); | 492 | printk(KERN_DEBUG "aha1542_queuecommand: dev %d cmd %02x pos %d len %d ", target, *SCpnt->cmnd, i, bufflen); |
498 | else | 493 | else |
499 | printk(KERN_DEBUG "aha1542_command: dev %d cmd %02x pos %d len %d ", target, *cmd, i, bufflen); | 494 | printk(KERN_DEBUG "aha1542_command: dev %d cmd %02x pos %d len %d ", target, *SCpnt->cmnd, i, bufflen); |
500 | printk(KERN_DEBUG "aha1542_queuecommand: dumping scsi cmd:"); | 495 | printk(KERN_DEBUG "aha1542_queuecommand: dumping scsi cmd:"); |
501 | for (i = 0; i < SCpnt->cmd_len; i++) | 496 | for (i = 0; i < SCpnt->cmd_len; i++) |
502 | printk("%02x ", cmd[i]); | 497 | printk("%02x ", SCpnt->cmnd[i]); |
503 | printk("\n"); | 498 | printk("\n"); |
504 | if (*cmd == WRITE_10 || *cmd == WRITE_6) | 499 | if (*SCpnt->cmnd == WRITE_10 || *SCpnt->cmnd == WRITE_6) |
505 | return 0; /* we are still testing, so *don't* write */ | 500 | return 0; /* we are still testing, so *don't* write */ |
506 | #endif | 501 | #endif |
507 | /* Use the outgoing mailboxes in a round-robin fashion, because this | 502 | /* Use the outgoing mailboxes in a round-robin fashion, because this |
@@ -540,12 +535,12 @@ static int aha1542_queuecommand_lck(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd * | |||
540 | ccb[mbo].cdblen = SCpnt->cmd_len; | 535 | ccb[mbo].cdblen = SCpnt->cmd_len; |
541 | 536 | ||
542 | direction = 0; | 537 | direction = 0; |
543 | if (*cmd == READ_10 || *cmd == READ_6) | 538 | if (*SCpnt->cmnd == READ_10 || *SCpnt->cmnd == READ_6) |
544 | direction = 8; | 539 | direction = 8; |
545 | else if (*cmd == WRITE_10 || *cmd == WRITE_6) | 540 | else if (*SCpnt->cmnd == WRITE_10 || *SCpnt->cmnd == WRITE_6) |
546 | direction = 16; | 541 | direction = 16; |
547 | 542 | ||
548 | memcpy(ccb[mbo].cdb, cmd, ccb[mbo].cdblen); | 543 | memcpy(ccb[mbo].cdb, SCpnt->cmnd, ccb[mbo].cdblen); |
549 | 544 | ||
550 | if (bufflen) { | 545 | if (bufflen) { |
551 | struct scatterlist *sg; | 546 | struct scatterlist *sg; |
@@ -617,15 +612,15 @@ static void setup_mailboxes(int bse, struct Scsi_Host *shpnt) | |||
617 | struct mailbox *mb = aha1542->mb; | 612 | struct mailbox *mb = aha1542->mb; |
618 | struct ccb *ccb = aha1542->ccb; | 613 | struct ccb *ccb = aha1542->ccb; |
619 | 614 | ||
620 | u8 cmd[5] = { CMD_MBINIT, AHA1542_MAILBOXES, 0, 0, 0}; | 615 | u8 mb_cmd[5] = { CMD_MBINIT, AHA1542_MAILBOXES, 0, 0, 0}; |
621 | 616 | ||
622 | for (i = 0; i < AHA1542_MAILBOXES; i++) { | 617 | for (i = 0; i < AHA1542_MAILBOXES; i++) { |
623 | mb[i].status = mb[AHA1542_MAILBOXES + i].status = 0; | 618 | mb[i].status = mb[AHA1542_MAILBOXES + i].status = 0; |
624 | any2scsi(mb[i].ccbptr, isa_virt_to_bus(&ccb[i])); | 619 | any2scsi(mb[i].ccbptr, isa_virt_to_bus(&ccb[i])); |
625 | }; | 620 | }; |
626 | aha1542_intr_reset(bse); /* reset interrupts, so they don't block */ | 621 | aha1542_intr_reset(bse); /* reset interrupts, so they don't block */ |
627 | any2scsi((cmd + 2), isa_virt_to_bus(mb)); | 622 | any2scsi((mb_cmd + 2), isa_virt_to_bus(mb)); |
628 | if (aha1542_out(bse, cmd, 5)) | 623 | if (aha1542_out(bse, mb_cmd, 5)) |
629 | printk(KERN_ERR "aha1542_detect: failed setting up mailboxes\n"); | 624 | printk(KERN_ERR "aha1542_detect: failed setting up mailboxes\n"); |
630 | aha1542_intr_reset(bse); | 625 | aha1542_intr_reset(bse); |
631 | } | 626 | } |