From: Doug Maxey <dwm@enoyolf.org>
To: Mike Christie <michaelc@cs.wisc.edu>
Cc: Ravi Anand <ravi.anand@qlogic.com>,
David Somayajulu <david.somayajulu@qlogic.com>,
open-iscsi@googlegroups.com, linux-scsi@vger.kernel.org
Subject: [PATCH ver3 2/4] qla4xxx: Add a timeout period and return status from ql4xxx_lock_drvr_wait()
Date: Sat, 05 Aug 2006 17:52:17 -0500 [thread overview]
Message-ID: <20060805225217.9557.29076.stgit@bebe.enoyolf.org> (raw)
In-Reply-To: <20060805225156.9557.99072.stgit@bebe.enoyolf.org>
From: Doug Maxey <dwm@enoyolf.org>
Change the func to only wait for QL4_LOCK_DRVR_WAIT ms.
Fix callers to use the return status.
Signed-off-by: Doug Maxey <dwm@enoyolf.org>
---
drivers/scsi/qla4xxx/ql4_init.c | 26 ++++++++++++++++----------
1 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c
index 8608106..8fb39b5 100644
--- a/drivers/scsi/qla4xxx/ql4_init.c
+++ b/drivers/scsi/qla4xxx/ql4_init.c
@@ -988,25 +988,29 @@ static int qla4xxx_start_firmware_from_f
return status;
}
-static void ql4xxx_lock_drvr_wait(struct scsi_qla_host *a)
+static int ql4xxx_lock_drvr_wait(struct scsi_qla_host *a)
{
- int i = 0;
- while (1) {
+#define QL4_LOCK_DRVR_WAIT (20000)
+#define QL4_LOCK_DRVR_SLEEP (10)
+ int i = QL4_LOCK_DRVR_WAIT;
+
+ while (i > 0) {
if (ql4xxx_lock_drvr(a) == 0) {
- msleep(10);
- if (!i) {
+ msleep(QL4_LOCK_DRVR_SLEEP);
+ if (i == QL4_LOCK_DRVR_WAIT) {
DEBUG2(printk("scsi%ld: %s: Waiting for "
"Global Init Semaphore...n",
a->host_no,
__func__));
- i++;
}
+ i -= QL4_LOCK_DRVR_SLEEP;
} else {
DEBUG2(printk("scsi%ld: %s: Global Init Semaphore "
- "acquired.n", a->host_no, __func__));
- break;
+ "acquired\n", a->host_no, __func__));
+ return QLA_SUCCESS;
}
}
+ return QLA_ERROR;
}
/**
@@ -1030,7 +1034,8 @@ static int qla4xxx_start_firmware(struct
if (is_qla4022(ha))
ql4xxx_set_mac_number(ha);
- ql4xxx_lock_drvr_wait(ha);
+ if (ql4xxx_lock_drvr_wait(ha))
+ return QLA_ERROR;
spin_lock_irqsave(&ha->hardware_lock, flags);
@@ -1107,7 +1112,8 @@ static int qla4xxx_start_firmware(struct
config_chip = 1;
/* Reset clears the semaphore, so aquire again */
- ql4xxx_lock_drvr_wait(ha);
+ if (ql4xxx_lock_drvr_wait(ha))
+ return QLA_ERROR;
}
if (config_chip) {
next prev parent reply other threads:[~2006-08-05 22:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20060805225156.9557.99072.stgit@bebe.enoyolf.org>
2006-08-05 22:52 ` [PATCH ver3 1/4] qla4xxx: Remove funcs with no callers in ql4_init.c Doug Maxey
2006-08-05 22:52 ` Doug Maxey [this message]
2006-08-05 22:52 ` [PATCH ver3 3/4] qla4xxx: use dev_xxx on some pci/dma resource alloc warning and error printks Doug Maxey
2006-08-09 17:52 ` Mike Christie
2006-08-09 19:03 ` Doug Maxey
2006-08-09 23:05 ` Doug Maxey
2006-08-09 23:36 ` Ravi Anand
2006-08-10 9:52 ` Mike Christie
2006-08-10 10:18 ` Mike Christie
2006-08-10 13:59 ` James Bottomley
2006-08-05 22:52 ` [PATCH ver3 4/4] qla4xxx: improve symmetry in buffer codepaths Doug Maxey
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=20060805225217.9557.29076.stgit@bebe.enoyolf.org \
--to=dwm@enoyolf.org \
--cc=david.somayajulu@qlogic.com \
--cc=linux-scsi@vger.kernel.org \
--cc=michaelc@cs.wisc.edu \
--cc=open-iscsi@googlegroups.com \
--cc=ravi.anand@qlogic.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox