aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOndrej Zary <linux@rainbow-software.org>2015-02-06 17:11:32 -0500
committerJames Bottomley <JBottomley@Odin.com>2015-04-09 21:07:13 -0400
commitf8846be334443b432f5daf22099e9f4bdd02ba9f (patch)
treeb89cbde3200902bf1b69fe16c71b2aa54ceffbc9
parent2093bfa1364472759d4711d034c634594d35188a (diff)
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>
-rw-r--r--drivers/scsi/aha1542.c33
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:
191/* Only used at boot time, so we do not need to worry about latency as much 191/* Only used at boot time, so we do not need to worry about latency as much
192 here */ 192 here */
193 193
194static int aha1542_in(unsigned int base, u8 *cmdp, int len) 194static int aha1542_in(unsigned int base, u8 *cmdp, int len, int timeout)
195{ 195{
196 unsigned long flags; 196 unsigned long flags;
197 197
198 spin_lock_irqsave(&aha1542_lock, flags); 198 spin_lock_irqsave(&aha1542_lock, flags);
199 while (len--) { 199 while (len--) {
200 if (!wait_mask(STATUS(base), DF, DF, 0, 0)) 200 if (!wait_mask(STATUS(base), DF, DF, 0, timeout))
201 goto fail;
202 *cmdp++ = inb(DATA(base));
203 }
204 spin_unlock_irqrestore(&aha1542_lock, flags);
205 return 0;
206fail:
207 spin_unlock_irqrestore(&aha1542_lock, flags);
208 printk(KERN_ERR "aha1542_in failed(%d): ", len + 1);
209 return 1;
210}
211
212/* Similar to aha1542_in, except that we wait a very short period of time.
213 We use this if we know the board is alive and awake, but we are not sure
214 if the board will respond to the command we are about to send or not */
215static int aha1542_in1(unsigned int base, u8 *cmdp, int len)
216{
217 unsigned long flags;
218
219 spin_lock_irqsave(&aha1542_lock, flags);
220 while (len--) {
221 if (!wait_mask(STATUS(base), DF, DF, 0, 100))
222 goto fail; 201 goto fail;
223 *cmdp++ = inb(DATA(base)); 202 *cmdp++ = inb(DATA(base));
224 } 203 }
@@ -226,6 +205,8 @@ static int aha1542_in1(unsigned int base, u8 *cmdp, int len)
226 return 0; 205 return 0;
227fail: 206fail:
228 spin_unlock_irqrestore(&aha1542_lock, flags); 207 spin_unlock_irqrestore(&aha1542_lock, flags);
208 if (timeout == 0)
209 printk(KERN_ERR "aha1542_in failed(%d): ", len + 1);
229 return 1; 210 return 1;
230} 211}
231 212
@@ -730,7 +711,7 @@ static int aha1542_getconfig(int base_io, unsigned char *irq_level, unsigned cha
730 i = inb(DATA(base_io)); 711 i = inb(DATA(base_io));
731 }; 712 };
732 aha1542_out(base_io, inquiry_cmd, 1); 713 aha1542_out(base_io, inquiry_cmd, 1);
733 aha1542_in(base_io, inquiry_result, 3); 714 aha1542_in(base_io, inquiry_result, 3, 0);
734 if (!wait_mask(INTRFLAGS(base_io), INTRMASK, HACC, 0, 0)) 715 if (!wait_mask(INTRFLAGS(base_io), INTRMASK, HACC, 0, 0))
735 goto fail; 716 goto fail;
736 while (0) { 717 while (0) {
@@ -800,7 +781,7 @@ static int aha1542_mbenable(int base)
800 781
801 mbenable_cmd[0] = CMD_EXTBIOS; 782 mbenable_cmd[0] = CMD_EXTBIOS;
802 aha1542_out(base, mbenable_cmd, 1); 783 aha1542_out(base, mbenable_cmd, 1);
803 if (aha1542_in1(base, mbenable_result, 2)) 784 if (aha1542_in(base, mbenable_result, 2, 100))
804 return retval; 785 return retval;
805 if (!wait_mask(INTRFLAGS(base), INTRMASK, HACC, 0, 100)) 786 if (!wait_mask(INTRFLAGS(base), INTRMASK, HACC, 0, 100))
806 goto fail; 787 goto fail;
@@ -837,7 +818,7 @@ static int aha1542_query(int base_io, int *transl)
837 i = inb(DATA(base_io)); 818 i = inb(DATA(base_io));
838 }; 819 };
839 aha1542_out(base_io, inquiry_cmd, 1); 820 aha1542_out(base_io, inquiry_cmd, 1);
840 aha1542_in(base_io, inquiry_result, 4); 821 aha1542_in(base_io, inquiry_result, 4, 0);
841 if (!wait_mask(INTRFLAGS(base_io), INTRMASK, HACC, 0, 0)) 822 if (!wait_mask(INTRFLAGS(base_io), INTRMASK, HACC, 0, 0))
842 goto fail; 823 goto fail;
843 while (0) { 824 while (0) {