linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 02/10] brcmstb_gisb: Replace "hweight_long(mask) != 1" with "!is_power_of_2(mask)"
@ 2015-12-06 10:11 Zhaoxiu Zeng
  2015-12-14 19:55 ` Florian Fainelli
  0 siblings, 1 reply; 2+ messages in thread
From: Zhaoxiu Zeng @ 2015-12-06 10:11 UTC (permalink / raw)
  To: linux-arm-kernel

From: Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com>

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];
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 02/10] brcmstb_gisb: Replace "hweight_long(mask) != 1" with "!is_power_of_2(mask)"
  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-14 19:55 ` Florian Fainelli
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Fainelli @ 2015-12-14 19:55 UTC (permalink / raw)
  To: linux-arm-kernel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-14 19:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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-14 19:55 ` Florian Fainelli

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).