Search Linux Wireless

Re: [PATCH 1/2] b43: make finding the most significant bit common function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday 14 January 2010 13:21:27 Rafał Miłecki wrote:
> 
> Signed-off-by: Rafał Miłecki <zajec5@xxxxxxxxx>
> ---
>   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.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux