From: "Arend van Spriel" <arend@broadcom.com>
To: "Larry Finger" <Larry.Finger@lwfinger.net>
Cc: "Brett Rudley" <brudley@broadcom.com>,
"Henry Ptasinski" <henryp@broadcom.com>,
"Roland Vossen" <rvossen@broadcom.com>,
"Franky (Zhenhui) Lin" <frankyl@broadcom.com>,
"Kan Yan" <kanyan@broadcom.com>,
wireless <linux-wireless@vger.kernel.org>
Subject: Re: Strange code in routine wlc_phy_radio_init_2057()
Date: Wed, 14 Dec 2011 21:07:23 +0100 [thread overview]
Message-ID: <4EE901FB.8040303@broadcom.com> (raw)
In-Reply-To: <4EDD7026.9000308@lwfinger.net>
On 12/06/2011 02:30 AM, Larry Finger wrote:
> In looking at the support code for Type 2057 radios in brcmsmac, I noticed the
> following routine:
>
> static void wlc_phy_radio_init_2057(struct brcms_phy *pi)
> {
> struct radio_20xx_regs *regs_2057_ptr = NULL;
>
> if (NREV_IS(pi->pubpi.phy_rev, 7)) {
> regs_2057_ptr = regs_2057_rev4;
> } else if (NREV_IS(pi->pubpi.phy_rev, 8)
> || NREV_IS(pi->pubpi.phy_rev, 9)) {
> switch (pi->pubpi.radiorev) {
> case 5:
> if (pi->pubpi.radiover == 0x0)
> regs_2057_ptr = regs_2057_rev5;
> else if (pi->pubpi.radiover == 0x1)
> regs_2057_ptr = regs_2057_rev5v1;
> else
> break;
> case 7:
> regs_2057_ptr = regs_2057_rev7;
> break;
> case 8:
> regs_2057_ptr = regs_2057_rev8;
> break;
> default:
> break;
> }
> }
> wlc_phy_init_radio_regs_allbands(pi, regs_2057_ptr);
> }
>
> I do not think that the code for phy revisions 8 or 9, and radio revision 5 is
> correct. When the radio version is 0, or 1, the case statement will fall through
> to the radio revision 7 case, thereby negating the logic that sets regs_2057_ptr
> for case 5.
You are right.
>
> I think the following patch will fix it:
>
> Index: wireless-testing-new/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c
> ===================================================================
> --- wireless-testing-new.orig/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c
> +++ wireless-testing-new/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c
> @@ -19996,8 +19996,8 @@ static void wlc_phy_radio_init_2057(stru
> regs_2057_ptr = regs_2057_rev5;
> else if (pi->pubpi.radiover == 0x1)
> regs_2057_ptr = regs_2057_rev5v1;
> - else
> - break;
> +
> + break;
>
> case 7:
>
>
> Larry
>
It is an improvement for sure, but it needs to be slightly different. I
will create a patch for this. Thanks for pointing us at this.
Gr. AvS
prev parent reply other threads:[~2011-12-14 20:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-06 1:30 Strange code in routine wlc_phy_radio_init_2057() Larry Finger
2011-12-14 20:07 ` Arend van Spriel [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=4EE901FB.8040303@broadcom.com \
--to=arend@broadcom.com \
--cc=Larry.Finger@lwfinger.net \
--cc=brudley@broadcom.com \
--cc=frankyl@broadcom.com \
--cc=henryp@broadcom.com \
--cc=kanyan@broadcom.com \
--cc=linux-wireless@vger.kernel.org \
--cc=rvossen@broadcom.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).