diff options
author | Ondrej Zary <linux@rainbow-software.org> | 2015-02-06 23:11:32 +0100 |
---|---|---|
committer | James Bottomley <JBottomley@Odin.com> | 2015-04-09 18:07:13 -0700 |
commit | f8846be334443b432f5daf22099e9f4bdd02ba9f (patch) | |
tree | b89cbde3200902bf1b69fe16c71b2aa54ceffbc9 /drivers/scsi/aha1542.c | |
parent | 2093bfa1364472759d4711d034c634594d35188a (diff) | |
download | blackbird-obmc-linux-f8846be334443b432f5daf22099e9f4bdd02ba9f.tar.gz blackbird-obmc-linux-f8846be334443b432f5daf22099e9f4bdd02ba9f.zip |
aha1542: Unify aha1542_in and aha1542_in1
Unify aha1542_in and aha1542_in1 functions, they differ only in timeout
and printk.
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
Diffstat (limited to 'drivers/scsi/aha1542.c')
-rw-r--r-- | drivers/scsi/aha1542.c | 33 |
1 files changed, 7 insertions, 26 deletions
diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c index 0e58cef3e8e0..b4ada244bcb2 100644 --- a/drivers/scsi/aha1542.c +++ b/drivers/scsi/aha1542.c @@ -191,34 +191,13 @@ fail: /* Only used at boot time, so we do not need to worry about latency as much here */ -static int aha1542_in(unsigned int base, u8 *cmdp, int len) +static int aha1542_in(unsigned int base, u8 *cmdp, int len, int timeout) { unsigned long flags; spin_lock_irqsave(&aha1542_lock, flags); while (len--) { - if (!wait_mask(STATUS(base), DF, DF, 0, 0)) - goto fail; - *cmdp++ = inb(DATA(base)); - } - spin_unlock_irqrestore(&aha1542_lock, flags); - return 0; -fail: - spin_unlock_irqrestore(&aha1542_lock, flags); - printk(KERN_ERR "aha1542_in failed(%d): ", len + 1); - return 1; -} - -/* Similar to aha1542_in, except that we wait a very short period of time. - We use this if we know the board is alive and awake, but we are not sure - if the board will respond to the command we are about to send or not */ -static int aha1542_in1(unsigned int base, u8 *cmdp, int len) -{ - unsigned long flags; - - spin_lock_irqsave(&aha1542_lock, flags); - while (len--) { - if (!wait_mask(STATUS(base), DF, DF, 0, 100)) + if (!wait_mask(STATUS(base), DF, DF, 0, timeout)) goto fail; *cmdp++ = inb(DATA(base)); } @@ -226,6 +205,8 @@ static int aha1542_in1(unsigned int base, u8 *cmdp, int len) return 0; fail: spin_unlock_irqrestore(&aha1542_lock, flags); + if (timeout == 0) + printk(KERN_ERR "aha1542_in failed(%d): ", len + 1); return 1; } @@ -730,7 +711,7 @@ static int aha1542_getconfig(int base_io, unsigned char *irq_level, unsigned cha i = inb(DATA(base_io)); }; aha1542_out(base_io, inquiry_cmd, 1); - aha1542_in(base_io, inquiry_result, 3); + aha1542_in(base_io, inquiry_result, 3, 0); if (!wait_mask(INTRFLAGS(base_io), INTRMASK, HACC, 0, 0)) goto fail; while (0) { @@ -800,7 +781,7 @@ static int aha1542_mbenable(int base) mbenable_cmd[0] = CMD_EXTBIOS; aha1542_out(base, mbenable_cmd, 1); - if (aha1542_in1(base, mbenable_result, 2)) + if (aha1542_in(base, mbenable_result, 2, 100)) return retval; if (!wait_mask(INTRFLAGS(base), INTRMASK, HACC, 0, 100)) goto fail; @@ -837,7 +818,7 @@ static int aha1542_query(int base_io, int *transl) i = inb(DATA(base_io)); }; aha1542_out(base_io, inquiry_cmd, 1); - aha1542_in(base_io, inquiry_result, 4); + aha1542_in(base_io, inquiry_result, 4, 0); if (!wait_mask(INTRFLAGS(base_io), INTRMASK, HACC, 0, 0)) goto fail; while (0) { |