From: Bob Copeland <me@bobcopeland.com>
To: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: linville@tuxdriver.com, linux-wireless@vger.kernel.org,
mickflemm@gmail.com, Bruno Randolf <br1@einfach.org>,
jirislaby@gmail.com, lrodriguez@atheros.com
Subject: Re: [PATCH 1/2] ath5k: fix error handling in ath5k_hw_dma_stop
Date: Tue, 25 Jan 2011 20:50:34 -0500 [thread overview]
Message-ID: <20110126015034.GA8600@hash.localnet> (raw)
In-Reply-To: <20110125135249.GA2610@redhat.com>
From: Bob Copeland <me@bobcopeland.com>
Date: Mon, 24 Jan 2011 09:25:11 -0500
Subject: [PATCH] ath5k: fix error handling in ath5k_hw_dma_stop
Review spotted a problem with the error handling in ath5k_hw_dma_stop:
a successful return from ath5k_hw_stop_tx_dma will be treated as
an error, so we always bail out of the loop after processing a single
active queue. As a result, we may not actually stop some queues during
reset.
Signed-off-by: Bob Copeland <me@bobcopeland.com>
---
> Patch is good, but does not make code fully correct. When last queue
> is inactive, we return -EINVAL from ath5_hw_dma_stop(). So we need
> also:
>
> if (err && err != -EINVAL)
> return err;
> + err = 0;
> }
> But perhaps, would be better just return 0 from
> ath5k_hw_stop_tx_dma() when queue is inactive.
How about this version instead? Although returning 0 in the inactive
queue case would be ok, I'd like to keep the diff small since this
seems to fix some reset problems people are now seeing in Linus's tree
and if so I'd like to get it in 2.6.38.
> I think that could fix "ath5k phy0: can't reset hardware (-5)"
> bugs reported in a few places, so patch should go to stable
> as well.
I thought this was older code but it actually landed after 2.6.37
so no need for stable CC.
As a side note, we still quit when the first error is encountered.
Maybe we should try stopping all of the queues anyway if one fails?
On the other hand we could spend a lot of time polling the registers
if the card is truly hosed, so I think this is best for now.
drivers/net/wireless/ath/ath5k/dma.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/ath5k/dma.c b/drivers/net/wireless/ath/ath5k/dma.c
index 0064be7..21091c2 100644
--- a/drivers/net/wireless/ath/ath5k/dma.c
+++ b/drivers/net/wireless/ath/ath5k/dma.c
@@ -838,9 +838,9 @@ int ath5k_hw_dma_stop(struct ath5k_hw *ah)
for (i = 0; i < qmax; i++) {
err = ath5k_hw_stop_tx_dma(ah, i);
/* -EINVAL -> queue inactive */
- if (err != -EINVAL)
+ if (err && err != -EINVAL)
return err;
}
- return err;
+ return 0;
}
--
1.7.1.1
--
Bob Copeland %% www.bobcopeland.com
next prev parent reply other threads:[~2011-01-26 1:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-25 4:31 [PATCH 1/2] ath5k: fix error handling in ath5k_hw_dma_stop Bob Copeland
2011-01-25 4:31 ` [PATCH 2/2] ath5k: correct endianness of frame duration Bob Copeland
2011-01-25 5:23 ` Bruno Randolf
2011-01-25 10:38 ` Bob Copeland
2011-01-25 10:47 ` Bruno Randolf
2011-01-26 16:17 ` Bob Copeland
2011-01-25 12:26 ` Nick Kossifidis
2011-01-25 5:12 ` [PATCH 1/2] ath5k: fix error handling in ath5k_hw_dma_stop Bruno Randolf
2011-01-25 12:24 ` Nick Kossifidis
2011-01-25 13:52 ` Stanislaw Gruszka
2011-01-26 1:50 ` Bob Copeland [this message]
2011-01-26 7:05 ` Stanislaw Gruszka
2011-01-26 17:06 ` Nick Kossifidis
2011-01-26 19:28 ` Bob Copeland
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=20110126015034.GA8600@hash.localnet \
--to=me@bobcopeland.com \
--cc=br1@einfach.org \
--cc=jirislaby@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=lrodriguez@atheros.com \
--cc=mickflemm@gmail.com \
--cc=sgruszka@redhat.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;
as well as URLs for NNTP newsgroup(s).