Commit cad2fc72 authored by Ondrej Zary's avatar Ondrej Zary Committed by James Bottomley

aha1542: clean up cmd variables

Make sure that there's no variable named cmd
Signed-off-by: default avatarOndrej Zary <linux@rainbow-software.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJames Bottomley <JBottomley@Odin.com>
parent 17787a09
...@@ -124,7 +124,7 @@ static inline bool wait_mask(u16 port, u8 mask, u8 allof, u8 noneof, int timeout ...@@ -124,7 +124,7 @@ static inline bool wait_mask(u16 port, u8 mask, u8 allof, u8 noneof, int timeout
routine does not send something out while we are in the middle of this. routine does not send something out while we are in the middle of this.
Fortunately, it is only at boot time that multi-byte messages Fortunately, it is only at boot time that multi-byte messages
are ever sent. */ are ever sent. */
static int aha1542_outb(unsigned int base, u8 cmd) static int aha1542_outb(unsigned int base, u8 val)
{ {
unsigned long flags; unsigned long flags;
...@@ -138,13 +138,13 @@ static int aha1542_outb(unsigned int base, u8 cmd) ...@@ -138,13 +138,13 @@ static int aha1542_outb(unsigned int base, u8 cmd)
spin_unlock_irqrestore(&aha1542_lock, flags); spin_unlock_irqrestore(&aha1542_lock, flags);
continue; continue;
} }
outb(cmd, DATA(base)); outb(val, DATA(base));
spin_unlock_irqrestore(&aha1542_lock, flags); spin_unlock_irqrestore(&aha1542_lock, flags);
return 0; return 0;
} }
} }
static int aha1542_out(unsigned int base, u8 *cmdp, int len) static int aha1542_out(unsigned int base, u8 *buf, int len)
{ {
unsigned long flags; unsigned long flags;
...@@ -155,7 +155,7 @@ static int aha1542_out(unsigned int base, u8 *cmdp, int len) ...@@ -155,7 +155,7 @@ static int aha1542_out(unsigned int base, u8 *cmdp, int len)
printk(KERN_ERR "aha1542_out failed(%d): ", len + 1); printk(KERN_ERR "aha1542_out failed(%d): ", len + 1);
return 1; return 1;
} }
outb(*cmdp++, DATA(base)); outb(*buf++, DATA(base));
} }
spin_unlock_irqrestore(&aha1542_lock, flags); spin_unlock_irqrestore(&aha1542_lock, flags);
if (!wait_mask(INTRFLAGS(base), INTRMASK, HACC, 0, 0)) 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,7 +167,7 @@ static int aha1542_out(unsigned int base, u8 *cmdp, int len)
/* Only used at boot time, so we do not need to worry about latency as much /* Only used at boot time, so we do not need to worry about latency as much
here */ here */
static int aha1542_in(unsigned int base, u8 *cmdp, int len, int timeout) static int aha1542_in(unsigned int base, u8 *buf, int len, int timeout)
{ {
unsigned long flags; unsigned long flags;
...@@ -179,7 +179,7 @@ static int aha1542_in(unsigned int base, u8 *cmdp, int len, int timeout) ...@@ -179,7 +179,7 @@ static int aha1542_in(unsigned int base, u8 *cmdp, int len, int timeout)
printk(KERN_ERR "aha1542_in failed(%d): ", len + 1); printk(KERN_ERR "aha1542_in failed(%d): ", len + 1);
return 1; return 1;
} }
*cmdp++ = inb(DATA(base)); *buf++ = inb(DATA(base));
} }
spin_unlock_irqrestore(&aha1542_lock, flags); spin_unlock_irqrestore(&aha1542_lock, flags);
return 0; return 0;
...@@ -244,8 +244,7 @@ static int makecode(unsigned hosterr, unsigned scsierr) ...@@ -244,8 +244,7 @@ static int makecode(unsigned hosterr, unsigned scsierr)
static int aha1542_test_port(int bse, struct Scsi_Host *shpnt) static int aha1542_test_port(int bse, struct Scsi_Host *shpnt)
{ {
u8 inquiry_result[4]; u8 inquiry_result[4];
u8 *cmdp; int i;
int len;
/* Quick and dirty test for presence of the card. */ /* Quick and dirty test for presence of the card. */
if (inb(STATUS(bse)) == 0xff) if (inb(STATUS(bse)) == 0xff)
...@@ -273,13 +272,10 @@ static int aha1542_test_port(int bse, struct Scsi_Host *shpnt) ...@@ -273,13 +272,10 @@ static int aha1542_test_port(int bse, struct Scsi_Host *shpnt)
aha1542_outb(bse, CMD_INQUIRY); aha1542_outb(bse, CMD_INQUIRY);
len = 4; for (i = 0; i < 4; i++) {
cmdp = &inquiry_result[0];
while (len--) {
if (!wait_mask(STATUS(bse), DF, DF, 0, 0)) if (!wait_mask(STATUS(bse), DF, DF, 0, 0))
return 0; return 0;
*cmdp++ = inb(DATA(bse)); inquiry_result[i] = inb(DATA(bse));
} }
/* Reading port should reset DF */ /* Reading port should reset DF */
...@@ -463,7 +459,6 @@ static int aha1542_queuecommand_lck(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd * ...@@ -463,7 +459,6 @@ static int aha1542_queuecommand_lck(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *
{ {
struct aha1542_hostdata *aha1542 = shost_priv(SCpnt->device->host); struct aha1542_hostdata *aha1542 = shost_priv(SCpnt->device->host);
u8 direction; u8 direction;
u8 *cmd = (u8 *) SCpnt->cmnd;
u8 target = SCpnt->device->id; u8 target = SCpnt->device->id;
u8 lun = SCpnt->device->lun; u8 lun = SCpnt->device->lun;
unsigned long flags; unsigned long flags;
...@@ -480,28 +475,28 @@ static int aha1542_queuecommand_lck(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd * ...@@ -480,28 +475,28 @@ static int aha1542_queuecommand_lck(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *
} }
); );
if (*cmd == REQUEST_SENSE) { if (*SCpnt->cmnd == REQUEST_SENSE) {
/* Don't do the command - we have the sense data already */ /* Don't do the command - we have the sense data already */
SCpnt->result = 0; SCpnt->result = 0;
done(SCpnt); done(SCpnt);
return 0; return 0;
} }
#ifdef DEBUG #ifdef DEBUG
if (*cmd == READ_10 || *cmd == WRITE_10) if (*SCpnt->cmnd == READ_10 || *SCpnt->cmnd == WRITE_10)
i = xscsi2int(cmd + 2); i = xscsi2int(SCpnt->cmnd + 2);
else if (*cmd == READ_6 || *cmd == WRITE_6) else if (*SCpnt->cmnd == READ_6 || *SCpnt->cmnd == WRITE_6)
i = scsi2int(cmd + 2); i = scsi2int(SCpnt->cmnd + 2);
else else
i = -1; i = -1;
if (done) if (done)
printk(KERN_DEBUG "aha1542_queuecommand: dev %d cmd %02x pos %d len %d ", target, *cmd, i, bufflen); printk(KERN_DEBUG "aha1542_queuecommand: dev %d cmd %02x pos %d len %d ", target, *SCpnt->cmnd, i, bufflen);
else else
printk(KERN_DEBUG "aha1542_command: dev %d cmd %02x pos %d len %d ", target, *cmd, i, bufflen); printk(KERN_DEBUG "aha1542_command: dev %d cmd %02x pos %d len %d ", target, *SCpnt->cmnd, i, bufflen);
printk(KERN_DEBUG "aha1542_queuecommand: dumping scsi cmd:"); printk(KERN_DEBUG "aha1542_queuecommand: dumping scsi cmd:");
for (i = 0; i < SCpnt->cmd_len; i++) for (i = 0; i < SCpnt->cmd_len; i++)
printk("%02x ", cmd[i]); printk("%02x ", SCpnt->cmnd[i]);
printk("\n"); printk("\n");
if (*cmd == WRITE_10 || *cmd == WRITE_6) if (*SCpnt->cmnd == WRITE_10 || *SCpnt->cmnd == WRITE_6)
return 0; /* we are still testing, so *don't* write */ return 0; /* we are still testing, so *don't* write */
#endif #endif
/* Use the outgoing mailboxes in a round-robin fashion, because this /* 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,12 +535,12 @@ static int aha1542_queuecommand_lck(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *
ccb[mbo].cdblen = SCpnt->cmd_len; ccb[mbo].cdblen = SCpnt->cmd_len;
direction = 0; direction = 0;
if (*cmd == READ_10 || *cmd == READ_6) if (*SCpnt->cmnd == READ_10 || *SCpnt->cmnd == READ_6)
direction = 8; direction = 8;
else if (*cmd == WRITE_10 || *cmd == WRITE_6) else if (*SCpnt->cmnd == WRITE_10 || *SCpnt->cmnd == WRITE_6)
direction = 16; direction = 16;
memcpy(ccb[mbo].cdb, cmd, ccb[mbo].cdblen); memcpy(ccb[mbo].cdb, SCpnt->cmnd, ccb[mbo].cdblen);
if (bufflen) { if (bufflen) {
struct scatterlist *sg; struct scatterlist *sg;
...@@ -617,15 +612,15 @@ static void setup_mailboxes(int bse, struct Scsi_Host *shpnt) ...@@ -617,15 +612,15 @@ static void setup_mailboxes(int bse, struct Scsi_Host *shpnt)
struct mailbox *mb = aha1542->mb; struct mailbox *mb = aha1542->mb;
struct ccb *ccb = aha1542->ccb; struct ccb *ccb = aha1542->ccb;
u8 cmd[5] = { CMD_MBINIT, AHA1542_MAILBOXES, 0, 0, 0}; u8 mb_cmd[5] = { CMD_MBINIT, AHA1542_MAILBOXES, 0, 0, 0};
for (i = 0; i < AHA1542_MAILBOXES; i++) { for (i = 0; i < AHA1542_MAILBOXES; i++) {
mb[i].status = mb[AHA1542_MAILBOXES + i].status = 0; mb[i].status = mb[AHA1542_MAILBOXES + i].status = 0;
any2scsi(mb[i].ccbptr, isa_virt_to_bus(&ccb[i])); any2scsi(mb[i].ccbptr, isa_virt_to_bus(&ccb[i]));
}; };
aha1542_intr_reset(bse); /* reset interrupts, so they don't block */ aha1542_intr_reset(bse); /* reset interrupts, so they don't block */
any2scsi((cmd + 2), isa_virt_to_bus(mb)); any2scsi((mb_cmd + 2), isa_virt_to_bus(mb));
if (aha1542_out(bse, cmd, 5)) if (aha1542_out(bse, mb_cmd, 5))
printk(KERN_ERR "aha1542_detect: failed setting up mailboxes\n"); printk(KERN_ERR "aha1542_detect: failed setting up mailboxes\n");
aha1542_intr_reset(bse); aha1542_intr_reset(bse);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment