]> git.karo-electronics.de Git - karo-tx-linux.git/commit
powerpc/mpc512x: silence build warning upon disabled DIU
authorGerhard Sittig <gsi@denx.de>
Fri, 27 Sep 2013 15:28:38 +0000 (17:28 +0200)
committerAnatolij Gustschin <agust@denx.de>
Tue, 8 Oct 2013 21:27:58 +0000 (23:27 +0200)
commitf61c178b0ca7aa834c782ff691ca99c26ec82c97
treeb24ec049fae35488300e33c2cccaa39a4d026b1c
parent0e7a3ed04f0cd4311096d691888f88569310ee6c
powerpc/mpc512x: silence build warning upon disabled DIU

a disabled Kconfig option results in a reference to a not implemented
routine when the IS_ENABLED() macro is used for both conditional
implementation of the routine as well as a C language source code test
at the call site -- the "if (0) func();" construct only gets eliminated
later by the optimizer, while the compiler already has emitted its
warning about "func()" being undeclared

provide an empty implementation for the mpc512x_setup_diu() and
mpc512x_init_diu() routines in case of the disabled option, to avoid the
compiler warning which is considered fatal and breaks compilation

the bug appeared with commit 2abbbb63c90ab55ca3f054772c2e5ba7df810c48
"powerpc/mpc512x: move common code to shared.c file", how to reproduce:

  make mpc512x_defconfig
  echo CONFIG_FB_FSL_DIU=n >> .config && make olddefconfig
  make

    CC      arch/powerpc/platforms/512x/mpc512x_shared.o
  .../arch/powerpc/platforms/512x/mpc512x_shared.c: In function 'mpc512x_init_early':
  .../arch/powerpc/platforms/512x/mpc512x_shared.c:456:3: error: implicit declaration of function 'mpc512x_init_diu' [-Werror=implicit-function-declaration]
  .../arch/powerpc/platforms/512x/mpc512x_shared.c: In function 'mpc512x_setup_arch':
  .../arch/powerpc/platforms/512x/mpc512x_shared.c:469:3: error: implicit declaration of function 'mpc512x_setup_diu' [-Werror=implicit-function-declaration]
  cc1: all warnings being treated as errors
  make[4]: *** [arch/powerpc/platforms/512x/mpc512x_shared.o] Error 1

Signed-off-by: Gerhard Sittig <gsi@denx.de>
CC: <stable@vger.kernel.org> # v3.11
Signed-off-by: Anatolij Gustschin <agust@denx.de>
arch/powerpc/platforms/512x/mpc512x_shared.c