linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Buesch <mb@bu3sch.de>
To: bcm43xx-dev@lists.berlios.de
Cc: "Rafał Miłecki" <zajec5@gmail.com>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"John W. Linville" <linville@tuxdriver.com>
Subject: Re: [PATCH 1/2] b43: make finding the most significant bit common function
Date: Fri, 15 Jan 2010 00:06:07 +0100	[thread overview]
Message-ID: <201001150006.08621.mb@bu3sch.de> (raw)
In-Reply-To: <op.u6iu91z39lhzdc@linux-g0th.site>

On Thursday 14 January 2010 13:21:27 Rafał Miłecki wrote:
> 
> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
> ---
>   drivers/net/wireless/b43/phy_common.c |   14 ++++++++++++++
>   drivers/net/wireless/b43/phy_common.h |    1 +
>   drivers/net/wireless/b43/phy_lp.c     |   17 ++---------------
>   3 files changed, 17 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c
> index 75b26e1..1389ab2 100644
> --- a/drivers/net/wireless/b43/phy_common.c
> +++ b/drivers/net/wireless/b43/phy_common.c
> @@ -421,3 +421,17 @@ void b43_phyop_switch_analog_generic(struct b43_wldev *dev, bool on)
>   {
>   	b43_write16(dev, B43_MMIO_PHY0, on ? 0 : 0xF4);
>   }
> +
> +/* Find the position of the most significant bit */
> +u8 phy_nbits(s32 val)
> +{
> +	u32 tmp = abs(val);
> +	u8 nbits = 0;
> +
> +	while (tmp != 0) {
> +		nbits++;
> +		tmp >>= 1;
> +	}
> +
> +	return nbits;
> +}

We already have fls() in bitops.h
I think the following call would be equivalent:

x = fls(abs(val));

So we don't need our own implementation in phy_common.c.
Just use the standard funcs.

-- 
Greetings, Michael.

      reply	other threads:[~2010-01-14 23:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-14 12:21 [PATCH 1/2] b43: make finding the most significant bit common function Rafał Miłecki
2010-01-14 23:06 ` Michael Buesch [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=201001150006.08621.mb@bu3sch.de \
    --to=mb@bu3sch.de \
    --cc=bcm43xx-dev@lists.berlios.de \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=zajec5@gmail.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).