public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] log2: make is_power_of_2() more generic
@ 2023-03-30 10:42 Jani Nikula
  2023-03-30 10:42 ` [PATCH 1/4] log2: add helper __IS_POWER_OF_2() Jani Nikula
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Jani Nikula @ 2023-03-30 10:42 UTC (permalink / raw)
  To: linux-kernel
  Cc: intel-gfx, dri-devel, jani.nikula, Andrew Morton,
	Christian König, David Gow

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


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

end of thread, other threads:[~2024-04-12 10:01 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-30 10:42 [PATCH 0/4] log2: make is_power_of_2() more generic Jani Nikula
2023-03-30 10:42 ` [PATCH 1/4] log2: add helper __IS_POWER_OF_2() Jani Nikula
2023-03-30 10:42 ` [PATCH 2/4] log2: have is_power_of_2() support bigger types than unsigned long Jani Nikula
2023-03-30 10:42 ` [PATCH 3/4] log2: allow use of is_power_of_2() in constant expressions Jani Nikula
2023-03-30 10:42 ` [PATCH 4/4] drm/i915/reg: use is_power_of_2() from log2.h Jani Nikula
2023-03-30 10:59 ` [PATCH 0/4] log2: make is_power_of_2() more generic Christian König
2023-03-30 19:50 ` Andrew Morton
2023-03-30 21:53   ` David Laight
2023-03-30 22:18     ` Andrew Morton
2023-03-31  7:33       ` David Laight
2023-03-31  8:31       ` Jani Nikula
2023-04-05 15:27         ` Steven Price
2024-04-12 10:01           ` Jani Nikula

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox