Re: via-pmu-event.c:undefined reference to `input_event'

From: Finn Thain
Date: Fri Mar 18 2022 - 21:16:43 EST


On Sat, 19 Mar 2022, kernel test robot wrote:

> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 551acdc3c3d2b6bc97f11e31dcf960bc36343bfc
> commit: ebd722275f9cfc6752e29d2412fa3816ca05764b macintosh/via-pmu: Replace via-pmu68k driver with via-pmu driver
> date: 3 years, 8 months ago
> config: m68k-randconfig-r021-20220317 (https://download.01.org/0day-ci/archive/20220319/202203190015.8LPNVVK5-lkp@xxxxxxxxx/config)
> compiler: m68k-linux-gcc (GCC) 11.2.0
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ebd722275f9cfc6752e29d2412fa3816ca05764b
> git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> git fetch --no-tags linus master
> git checkout ebd722275f9cfc6752e29d2412fa3816ca05764b
> # save the config file to linux build tree
> mkdir build_dir
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=m68k SHELL=/bin/bash
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
>
> All errors (new ones prefixed by >>):
>
> m68k-linux-ld: drivers/macintosh/via-pmu-event.o: in function `via_pmu_event':
> >> via-pmu-event.c:(.text+0x32): undefined reference to `input_event'
> >> m68k-linux-ld: via-pmu-event.c:(.text+0x54): undefined reference to `input_event'
> m68k-linux-ld: drivers/macintosh/via-pmu-event.o: in function `via_pmu_event_init':
> >> via-pmu-event.c:(.init.text+0xe): undefined reference to `input_allocate_device'
> >> m68k-linux-ld: via-pmu-event.c:(.init.text+0x56): undefined reference to `input_register_device'
> >> m68k-linux-ld: via-pmu-event.c:(.init.text+0x68): undefined reference to `input_free_device'

That config file has CONFIG_INPUT=n which is unusual. The problem affects
m68k builds since I enabled the driver 3 years ago but powerpc builds have
always been affected by this.

via_pmu_event() does nothing unless the hardware happens to be a
particular powerpc PMU models but that logic is questionable (see comment
in via-pmu-event.c). So I think the best solution is to make the
via_pmu_event() code conditional on CONFIG_INPUT.

I'll send a patch to that effect.