All of lore.kernel.org
 help / color / mirror / Atom feed
From: f.fainelli@gmail.com (Florian Fainelli)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 02/10] brcmstb_gisb: Replace "hweight_long(mask) != 1" with "!is_power_of_2(mask)"
Date: Mon, 14 Dec 2015 11:55:55 -0800	[thread overview]
Message-ID: <566F1ECB.8080809@gmail.com> (raw)
In-Reply-To: <1449396705-14235-1-git-send-email-zhaoxiu.zeng@gmail.com>

On 06/12/15 02:11, Zhaoxiu Zeng wrote:
> From: Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com>

is_power_of_2, AFAICT does not handle the case where the mask to be
tested for is zero, which is why I went with hweight_long() in the first
place.

Without further explanation as to whether we should prefer
is_power_of_2(), NAK.

> 
> Signed-off-by: Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com>
> ---
>  drivers/bus/brcmstb_gisb.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/bus/brcmstb_gisb.c b/drivers/bus/brcmstb_gisb.c
> index f364fa4..2816a04 100644
> --- a/drivers/bus/brcmstb_gisb.c
> +++ b/drivers/bus/brcmstb_gisb.c
> @@ -24,6 +24,7 @@
>  #include <linux/of.h>
>  #include <linux/bitops.h>
>  #include <linux/pm.h>
> +#include <linux/log2.h>
>  
>  #ifdef CONFIG_ARM
>  #include <asm/bug.h>
> @@ -171,7 +172,7 @@ brcmstb_gisb_master_to_str(struct brcmstb_gisb_arb_device *gdev,
>  {
>  	u32 mask = gdev->valid_mask & masters;
>  
> -	if (hweight_long(mask) != 1)
> +	if (!is_power_of_2(mask))
>  		return NULL;
>  
>  	return gdev->master_names[ffs(mask) - 1];
> 


-- 
Florian

WARNING: multiple messages have this Message-ID (diff)
From: Florian Fainelli <f.fainelli@gmail.com>
To: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>,
	computersforpeace@gmail.com, gregory.0xf0@gmail.com,
	linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 02/10] brcmstb_gisb: Replace "hweight_long(mask) != 1" with "!is_power_of_2(mask)"
Date: Mon, 14 Dec 2015 11:55:55 -0800	[thread overview]
Message-ID: <566F1ECB.8080809@gmail.com> (raw)
In-Reply-To: <1449396705-14235-1-git-send-email-zhaoxiu.zeng@gmail.com>

On 06/12/15 02:11, Zhaoxiu Zeng wrote:
> From: Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com>

is_power_of_2, AFAICT does not handle the case where the mask to be
tested for is zero, which is why I went with hweight_long() in the first
place.

Without further explanation as to whether we should prefer
is_power_of_2(), NAK.

> 
> Signed-off-by: Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com>
> ---
>  drivers/bus/brcmstb_gisb.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/bus/brcmstb_gisb.c b/drivers/bus/brcmstb_gisb.c
> index f364fa4..2816a04 100644
> --- a/drivers/bus/brcmstb_gisb.c
> +++ b/drivers/bus/brcmstb_gisb.c
> @@ -24,6 +24,7 @@
>  #include <linux/of.h>
>  #include <linux/bitops.h>
>  #include <linux/pm.h>
> +#include <linux/log2.h>
>  
>  #ifdef CONFIG_ARM
>  #include <asm/bug.h>
> @@ -171,7 +172,7 @@ brcmstb_gisb_master_to_str(struct brcmstb_gisb_arb_device *gdev,
>  {
>  	u32 mask = gdev->valid_mask & masters;
>  
> -	if (hweight_long(mask) != 1)
> +	if (!is_power_of_2(mask))
>  		return NULL;
>  
>  	return gdev->master_names[ffs(mask) - 1];
> 


-- 
Florian

  reply	other threads:[~2015-12-14 19:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-06 10:11 [PATCH 02/10] brcmstb_gisb: Replace "hweight_long(mask) != 1" with "!is_power_of_2(mask)" Zhaoxiu Zeng
2015-12-06 10:11 ` Zhaoxiu Zeng
2015-12-14 19:55 ` Florian Fainelli [this message]
2015-12-14 19:55   ` Florian Fainelli

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=566F1ECB.8080809@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.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 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.