Skip to content

log2: make is_power_of_2() more generic

Jani Nikula dri-devel intel-gfx lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 8 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4log2: add helper __IS_POWER_OF_2()include/linux/log2.h+3 -10 replies
2/4log2: have is_power_of_2() support bigger types than unsigned longinclude/linux/log2.h+16 -50 replies
3/4log2: allow use of is_power_of_2() in constant expressionsinclude/linux/log2.h+5 -30 replies
4/4drm/i915/reg: use is_power_of_2() from log2.hdrivers/gpu/drm/i915/i915_reg_defs.h+1 -60 replies

Reviews trailers per patch

None of the 4 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchChristian König
SeriesA-b
1/4
2/4
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/4] log2: make is_power_of_2() more generic

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(-)
Signature · 1 line
2.39.2