From: malahal@us.ibm.com
To: linux-scsi@vger.kernel.org
Subject: [PATCH] AIC94XX: nmi timeout fix
Date: Tue, 31 Oct 2006 17:07:09 -0800 [thread overview]
Message-ID: <20061101010709.GA3386@us.ibm.com> (raw)
Few of us have seen the AIC94XX driver get stuck reading the
ATOMICSTATCTL register in a loop for ever. The possible immortal loop
in asd_ddbsite_update_word() is made mortal now! Retry worked just
fine!
Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
diff -r 5f7a0e8a8265 drivers/scsi/aic94xx/aic94xx_reg.h
--- a/drivers/scsi/aic94xx/aic94xx_reg.h Wed Oct 25 13:28:35 2006 -0700
+++ b/drivers/scsi/aic94xx/aic94xx_reg.h Fri Oct 27 10:22:59 2006 -0700
@@ -226,20 +226,30 @@ static inline int asd_ddbsite_update_wor
u16 oldval, u16 newval)
{
u8 done;
+ int retries = 100;
+ int i;
+
u16 oval = asd_ddbsite_read_word(asd_ha, ddb_site_no, offs);
if (oval != oldval)
return -EAGAIN;
asd_write_reg_word(asd_ha, AOLDDATA, oldval);
asd_write_reg_word(asd_ha, ANEWDATA, newval);
- do {
+ for (i = 0; i < retries; i++) {
done = asd_read_reg_byte(asd_ha, ATOMICSTATCTL);
- } while (!(done & ATOMICDONE));
- if (done & ATOMICERR)
- return -EFAULT; /* parity error */
- else if (done & ATOMICWIN)
- return 0; /* success */
- else
- return -EAGAIN; /* oldval different than current value */
+ if (done & ATOMICDONE) {
+ if (done & ATOMICERR)
+ return -EFAULT; /* parity error */
+ else if (done & ATOMICWIN)
+ return 0; /* success */
+ else
+ /* oldval different than current value */
+ return -EAGAIN;
+ }
+ }
+
+ /* ATOMICDONE is not set after repeated retries! Broken chip? */
+ WARN_ON(1);
+ return -EAGAIN;
}
static inline int asd_ddbsite_update_byte(struct asd_ha_struct *asd_ha,
reply other threads:[~2006-11-01 1:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20061101010709.GA3386@us.ibm.com \
--to=malahal@us.ibm.com \
--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.