From: "Henry Ptasinski" <henryp@broadcom.com>
To: "Julian Calaby" <julian.calaby@gmail.com>
Cc: "Greg Dietsche" <gregory.dietsche@cuw.edu>,
"gregkh@suse.de" <gregkh@suse.de>,
"Brett Rudley" <brudley@broadcom.com>,
"Dowan Kim" <dowan@broadcom.com>,
"Roland Vossen" <rvossen@broadcom.com>,
"Arend Van Spriel" <arend@broadcom.com>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Henry Ptasinski" <henryp@broadcom.com>
Subject: Re: [PATCH] staging: brcm80211: return false if not a broadcom board
Date: Fri, 17 Jun 2011 15:01:08 -0700 [thread overview]
Message-ID: <20110617220108.GH3801@broadcom.com> (raw)
In-Reply-To: <BANLkTi=tLWXn7mMf-6pf-3gM6x8zX=WNtw@mail.gmail.com>
On Thu, Jun 16, 2011 at 04:45:21PM -0700, Julian Calaby wrote:
> Henry,
>
> On Fri, Jun 17, 2011 at 09:37, Henry Ptasinski <henryp@broadcom.com> wrote:
> > How's this for a somewhat clearer implementation:
> >
> > static bool brcms_c_validboardtype(struct brcms_c_hw_info *wlc_hw)
> > {
> > bool goodboard = true;
> > uint boardrev = wlc_hw->boardrev;
> >
> > if (wlc_hw->sih->boardvendor == PCI_VENDOR_ID_BROADCOM) {
>
> You could reduce indentation by having this be:
>
> if (wlc_hw->sih->boardvendor != PCI_VENDOR_ID_BROADCOM)
> return true;
>
> > /* validate boardrev */
> > if (boardrev == 0)
> > goodboard = false;
>
> and remove the goodboard variable by having this return false immediately.
>
> > else if (boardrev > 0xff) {
>
> You could also drop the else and have this as
>
> if (boardrev <= 0xff)
> return true;
>
> > /* 4 bits each for board type, major, minor, and tiny
> > version numbers */
> > uint brt = (boardrev & 0xf000) >> 12;
> > uint b0 = (boardrev & 0xf00) >> 8;
> > uint b1 = (boardrev & 0xf0) >> 4;
> > uint b2 = boardrev & 0xf;
> >
> > if ((brt > 2) || (brt == 0) || (b0 > 9) || (b0 == 0)
> > || (b1 > 9) || (b2 > 9))
> > goodboard = false;
>
> and return false here too.
>
> > }
> > }
> >
> > return goodboard;
>
> then just return true here.
>
> > }
>
> Thanks,
>
> --
> Julian Calaby
Yea, it's a lot flatter with those changes. Look for it in a patch set
relatively soon ...
- Henry
next prev parent reply other threads:[~2011-06-17 22:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-15 22:25 [PATCH] staging: brcm80211: return false if not a broadcom board Greg Dietsche
2011-06-16 1:36 ` Henry Ptasinski
2011-06-16 2:49 ` Greg Dietsche
2011-06-16 23:37 ` Henry Ptasinski
2011-06-16 23:45 ` Julian Calaby
2011-06-17 22:01 ` Henry Ptasinski [this message]
2011-06-18 15:52 ` Greg Dietsche
2011-06-16 5:14 ` Dan Carpenter
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=20110617220108.GH3801@broadcom.com \
--to=henryp@broadcom.com \
--cc=arend@broadcom.com \
--cc=brudley@broadcom.com \
--cc=devel@driverdev.osuosl.org \
--cc=dowan@broadcom.com \
--cc=gregkh@suse.de \
--cc=gregory.dietsche@cuw.edu \
--cc=julian.calaby@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--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 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.