Re: [PATCH 04/10] omap_hwspinlock: Replace "hweight_long(i & 0xf) != 1" with "!is_power_of_2(i & 0xf)"

2015-12-07 Thread Ohad Ben-Cohen
On Mon, Dec 7, 2015 at 5:03 PM, zhaoxiu.zeng wrote: > is_power_of_2 is simple, and faster than "hweightN(x) == 1" on most > architectures. Thanks. I'm not sure that speed is a major concern here, since this code executes only once during the lifetime of the driver. Readability is probably more i

Re: [PATCH 04/10] omap_hwspinlock: Replace "hweight_long(i & 0xf) != 1" with "!is_power_of_2(i & 0xf)"

2015-12-07 Thread zhaoxiu.zeng
在 2015/12/7 19:08, Ohad Ben-Cohen 写道: > Hi, > > On Sun, Dec 6, 2015 at 12:33 PM, Zhaoxiu Zeng wrote: >> >> From: Zeng Zhaoxiu >> >> Signed-off-by: Zeng Zhaoxiu > > Please explain why do you think we should make this change. is_power_of_2 is simple, and faster than "hweightN(x) == 1" on most

Re: [PATCH 04/10] omap_hwspinlock: Replace "hweight_long(i & 0xf) != 1" with "!is_power_of_2(i & 0xf)"

2015-12-07 Thread Ohad Ben-Cohen
Hi, On Sun, Dec 6, 2015 at 12:33 PM, Zhaoxiu Zeng wrote: > > From: Zeng Zhaoxiu > > Signed-off-by: Zeng Zhaoxiu Please explain why do you think we should make this change. Btw, the original code used is_power_of_2, but we thought hweight is more explicit so it was adopted. Thanks, Ohad. -- T

[PATCH 04/10] omap_hwspinlock: Replace "hweight_long(i & 0xf) != 1" with "!is_power_of_2(i & 0xf)"

2015-12-06 Thread Zhaoxiu Zeng
From: Zeng Zhaoxiu Signed-off-by: Zeng Zhaoxiu --- drivers/hwspinlock/omap_hwspinlock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/hwspinlock/omap_hwspinlock.c b/drivers/hwspinlock/omap_hwspinlock.c index ad2f8ca..1848a4c 100644 --- a/drivers/hwspinlock/omap_