The existing function only works with ulong which is not enough on 32-bit x86 machines which need to set up MTRRs up to 4GB.
There doesn't seem to be a 64-bit version in Linux, so add one here. Signed-off-by: Simon Glass <[email protected]> --- Changes in v2: - Add new patch with a 64-bit version of is_power_of_2() include/linux/log2.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/log2.h b/include/linux/log2.h index d4e32ecfc64..89097cdc694 100644 --- a/include/linux/log2.h +++ b/include/linux/log2.h @@ -52,6 +52,12 @@ bool is_power_of_2(unsigned long n) return (n != 0 && ((n & (n - 1)) == 0)); } +static inline __attribute__((const)) +bool is_power_of_2_u64(u64 n) +{ + return (n != 0 && ((n & (n - 1)) == 0)); +} + /** * __roundup_pow_of_two() - round up to nearest power of two * @n: value to round up -- 2.43.0

