From: Xavi Drudis Ferran <xdrudis@tinet.cat>
To: ath9k-devel@lists.ath9k.org
Subject: [ath9k-devel] Might the the macVersion be wrongly assigned sometimes ?
Date: Sat, 19 Nov 2016 18:32:30 -0000 [thread overview]
Message-ID: <20161116152502.GA2097@begut> (raw)
Thank you for ath9k. Sorry if this is silly, but I had some problems
with 9271 and looked at the code, but then I saw a suspicious line. I
don't really understand the code or whether this is a big problem or
just dead code or maybe it is ok after all, just thought I'd better
tell in case someone here thinks it needs correction. I haven't found
(yet) the register docs that may tell which bits are the mac version.
I doubt it's important, because it seems it's been like this since
2009, so it may just be me not understanding, but anyway:
drivers/net/wireless/ath/ath9k/hw.c:289
ah->hw_version.macVersion =
(val & AR_SREV_VERSION2) >> AR_SREV_TYPE2_S;
shouldn't it be
ah->hw_version.macVersion =
(val & AR_SREV_VERSION2) >> AR_SREV_VERSION2_S;
or
ah->hw_version.macVersion = MS(val, AR_SREV_VERSION2);
?
It seems it uses the mask for the version but the shift for the type ?
That should give the macVersion a value 16 times its correct value when
REG_READ(ah, AR_SREV) & AR_SREV_ID == 0xFF (I don't know when that is).
The context is
static void ath9k_hw_read_revisions(struct ath_hw *ah)
{
[...]
val = REG_READ(ah, AR_SREV) & AR_SREV_ID;
if (val == 0xFF) {
val = REG_READ(ah, AR_SREV);
ah->hw_version.macVersion =
(val & AR_SREV_VERSION2) >> AR_SREV_TYPE2_S;
ah->hw_version.macRev = MS(val, AR_SREV_REVISION2);
if (AR_SREV_9462(ah) || AR_SREV_9565(ah))
ah->is_pciexpress = true;
else
ah->is_pciexpress = (val &
AR_SREV_TYPE2_HOST_MODE) ? 0 : 1;
}
[...]
I can see this macVersion is used later so I guess if it needs to be
changed it might change some behaviour but I still don't understand
for which models and what should be tested exactly. It might break
something, but it still looks like a typo, doesn't it ? At least it's
confusing.
Thank you for reading.
--
Xavi Drudis Ferran
reply other threads:[~2016-11-19 18:32 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=20161116152502.GA2097@begut \
--to=xdrudis@tinet.cat \
--cc=ath9k-devel@lists.ath9k.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 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).