lkml.org 
[lkml]   [2023]   [Mar]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subject[PATCH 0/4] log2: make is_power_of_2() more generic
Date
is_power_of_2() only works for types <= sizeof(unsigned long) and it's
also not a constant expression. There are a number of places in kernel
where is_power_of_2() is called on u64, which fails on 32-bit
builds. Try to remedy that. While at it, make it a constant expression
when possible.

I admit I've only lightly tested this, and I haven't tried it with
allmodconfig.


Jani Nikula (4):
log2: add helper __IS_POWER_OF_2()
log2: have is_power_of_2() support bigger types than unsigned long
log2: allow use of is_power_of_2() in constant expressions
drm/i915/reg: use is_power_of_2() from log2.h

drivers/gpu/drm/i915/i915_reg_defs.h | 7 +------
include/linux/log2.h | 25 ++++++++++++++++++++-----
2 files changed, 21 insertions(+), 11 deletions(-)

--
2.39.2

\
 
 \ /
  Last update: 2023-03-30 12:43    [W:1.765 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site