From: Ondrej Zary <linux@rainbow-software.org>
To: linux-scsi@vger.kernel.org
Subject: [PATCH 11/13] aha1542: Unify aha1542_in and aha1542_in1
Date: Mon, 19 Jan 2015 23:37:55 +0100 [thread overview]
Message-ID: <1421707077-25291-12-git-send-email-linux@rainbow-software.org> (raw)
In-Reply-To: <1421707077-25291-1-git-send-email-linux@rainbow-software.org>
Unify aha1542_in and aha1542_in1 functions, they differ only in timeout
and printk.
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
---
drivers/scsi/aha1542.c | 33 +++++++--------------------------
1 file changed, 7 insertions(+), 26 deletions(-)
diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c
index 0e58cef..b4ada24 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) {
--
Ondrej Zary
next prev parent reply other threads:[~2015-01-19 22:43 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-19 22:37 [RFC PATCH 0/13] aha1542: Various improvements Ondrej Zary
2015-01-19 22:37 ` [PATCH 01/13] aha1542: Stop using scsi_module.c Ondrej Zary
2015-01-19 22:37 ` [PATCH 02/13] aha1542: remove dead code Ondrej Zary
2015-01-19 22:37 ` [PATCH 03/13] aha1542: Remove SCSI_BUF_PA, SCSI_SG_PA, AHA1542_SCATTER and AHA1542_CMDLUN Ondrej Zary
2015-01-19 22:37 ` [PATCH 04/13] aha1542: Remove HOSTDATA macro Ondrej Zary
2015-01-19 22:37 ` [PATCH 05/13] aha1542: Convert aha1542_intr_reset to function Ondrej Zary
2015-01-19 22:37 ` [PATCH 06/13] aha1542: Use u8 instead of unchar Ondrej Zary
2015-01-19 22:37 ` [PATCH 07/13] aha1542: Reorder functions to remove forward declarations Ondrej Zary
2015-01-19 22:37 ` [PATCH 08/13] aha1542: remove empty aha1542_stat Ondrej Zary
2015-01-19 22:37 ` [PATCH 09/13] aha1542: Use BIT() macro Ondrej Zary
2015-01-19 22:37 ` [PATCH 10/13] aha1542: Remove WAIT and WAITd macros Ondrej Zary
2015-01-19 22:37 ` Ondrej Zary [this message]
2015-01-19 22:37 ` [PATCH 12/13] aha1542: Split aha1542_out Ondrej Zary
2015-01-19 22:37 ` [PATCH 13/13] aha1542: Remove unneeded gotos Ondrej Zary
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1421707077-25291-12-git-send-email-linux@rainbow-software.org \
--to=linux@rainbow-software.org \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.