From: Pavel Roskin <proski@gnu.org>
To: Julia Lawall <julia@diku.dk>
Cc: "Luis R. Rodriguez" <lrodriguez@atheros.com>,
Jouni Malinen <jmalinen@atheros.com>,
Sujith Manoharan <Sujith.Manoharan@atheros.com>,
Vasanthakumar Thiagarajan <vasanth@atheros.com>,
Senthil Balasubramanian <senthilkumar@atheros.com>,
ath9k-devel@lists.ath9k.org, linux-wireless@vger.kernel.org
Subject: Re: question about ath9k/hw.c,mac.c
Date: Thu, 11 Mar 2010 02:16:32 -0500 [thread overview]
Message-ID: <1268291792.6951.34.camel@mj> (raw)
In-Reply-To: <Pine.LNX.4.64.1003101325500.24684@ask.diku.dk>
On Wed, 2010-03-10 at 13:36 +0100, Julia Lawall wrote:
> mac.c contains the following code:
>
> omask = ath9k_hw_set_interrupts(ah, ah->mask_reg & ~ATH9K_INT_GLOBAL);
...
> Is it correct that the call to ath9k_hw_set_interrupts is masking out what
> appears to be the flag AR_IMR_RXINTM?
Thank you for asking this question!
I checked the code, and I see several cases when
ath9k_hw_set_interrupts() is called with constants beginning with
"ATH9K_INT_" in the second argument.
On the other hand, the use of ah->mask_reg appears to be inconsistent
across the code. Sometimes it's used with "ATH9K_INT_", sometimes with
"AR_IMR_".
While at that, using enum ath9k_int appears to be a bad idea, especially
for storing values that don't fit int, such as ATH9K_INT_GLOBAL. If the
goal is to use sparse to check for errors, I would use bitwise types
like gfp_t. Perhaps sparse could be patched to allow mutually
incompatible bitwise types.
My guess is that ath9k_hw_init_interrupt_masks() should be using a local
variable instead of ah->mask_reg:
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 1fb14ed..97cc35f 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1134,23 +1134,23 @@ static void ath9k_hw_init_chain_masks(struct ath_hw *ah)
static void ath9k_hw_init_interrupt_masks(struct ath_hw *ah,
enum nl80211_iftype opmode)
{
- ah->mask_reg = AR_IMR_TXERR |
+ u32 imr_mask = AR_IMR_TXERR |
AR_IMR_TXURN |
AR_IMR_RXERR |
AR_IMR_RXORN |
AR_IMR_BCNMISC;
if (ah->config.rx_intr_mitigation)
- ah->mask_reg |= AR_IMR_RXINTM | AR_IMR_RXMINTR;
+ imr_mask |= AR_IMR_RXINTM | AR_IMR_RXMINTR;
else
- ah->mask_reg |= AR_IMR_RXOK;
+ imr_mask |= AR_IMR_RXOK;
- ah->mask_reg |= AR_IMR_TXOK;
+ imr_mask |= AR_IMR_TXOK;
if (opmode == NL80211_IFTYPE_AP)
- ah->mask_reg |= AR_IMR_MIB;
+ imr_mask |= AR_IMR_MIB;
- REG_WRITE(ah, AR_IMR, ah->mask_reg);
+ REG_WRITE(ah, AR_IMR, imr_mask);
ah->imrs2_reg |= AR_IMR_S2_GTT;
REG_WRITE(ah, AR_IMR_S2, ah->imrs2_reg);
--
Regards,
Pavel Roskin
prev parent reply other threads:[~2010-03-11 7:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-10 12:36 question about ath9k/hw.c,mac.c Julia Lawall
2010-03-11 7:16 ` Pavel Roskin [this message]
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=1268291792.6951.34.camel@mj \
--to=proski@gnu.org \
--cc=Sujith.Manoharan@atheros.com \
--cc=ath9k-devel@lists.ath9k.org \
--cc=jmalinen@atheros.com \
--cc=julia@diku.dk \
--cc=linux-wireless@vger.kernel.org \
--cc=lrodriguez@atheros.com \
--cc=senthilkumar@atheros.com \
--cc=vasanth@atheros.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