Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1291512 > unrolled thread
| Started by | Florian Fainelli <f.fainelli@gmail.com> |
|---|---|
| First post | 2015-12-14 21:00 +0100 |
| Last post | 2015-12-14 21:00 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH 02/10] brcmstb_gisb: Replace "hweight_long(mask) != 1" with "!is_power_of_2(mask)" Florian Fainelli <f.fainelli@gmail.com> - 2015-12-14 21:00 +0100
| From | Florian Fainelli <f.fainelli@gmail.com> |
|---|---|
| Date | 2015-12-14 21:00 +0100 |
| Subject | Re: [PATCH 02/10] brcmstb_gisb: Replace "hweight_long(mask) != 1" with "!is_power_of_2(mask)" |
| Message-ID | <qFHrQ-2a3-1@gated-at.bofh.it> |
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top | Article view | linux.kernel
csiph-web