Re: [PATCH] log2: make is_power_of_2() integer constant expression when possible

From: Jani Nikula
Date: Mon Mar 04 2019 - 06:45:24 EST


On Mon, 04 Mar 2019, kbuild test robot <lkp@xxxxxxxxx> wrote:
> Hi Jani,
>
> I love your patch! Perhaps something to improve:
>
> [auto build test WARNING on linus/master]
> [also build test WARNING on v5.0 next-20190301]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url: https://github.com/0day-ci/linux/commits/Jani-Nikula/log2-make-is_power_of_2-integer-constant-expression-when-possible/20190304-153529
> config: microblaze-mmu_defconfig (attached as .config)
> compiler: microblaze-linux-gcc (GCC) 8.2.0
> reproduce:
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # save the attached .config to linux build tree
> GCC_VERSION=8.2.0 make.cross ARCH=microblaze
>
> All warnings (new ones prefixed by >>):
>
>>> arch/microblaze/mm/pgtable.c:185: warning: "is_power_of_2" redefined
> #define is_power_of_2(x) ((x) != 0 && (((x) & ((x) - 1)) == 0))

Oh wow, a copy of is_power_of_2() introduced 10 years ago, apparently
unused since its introduction.


BR,
Jani.


>
> In file included from include/linux/kernel.h:12,
> from arch/microblaze/mm/pgtable.c:30:
> include/linux/log2.h:56: note: this is the location of the previous definition
> #define is_power_of_2(n) \
>
>
> vim +/is_power_of_2 +185 arch/microblaze/mm/pgtable.c
>
> 15902bf6 Michal Simek 2009-05-26 183
> 15902bf6 Michal Simek 2009-05-26 184 /* is x a power of 2? */
> 15902bf6 Michal Simek 2009-05-26 @185 #define is_power_of_2(x) ((x) != 0 && (((x) & ((x) - 1)) == 0))
> 15902bf6 Michal Simek 2009-05-26 186
>
> :::::: The code at line 185 was first introduced by commit
> :::::: 15902bf63c8332946e5a1f48a72e3ae22874b11b microblaze_mmu_v2: Page table - ioremap - pgtable.c/h, section update
>
> :::::: TO: Michal Simek <monstr@xxxxxxxxx>
> :::::: CC: Michal Simek <monstr@xxxxxxxxx>
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation

--
Jani Nikula, Intel Open Source Graphics Center