Re: pm.c:undefined reference to `i8042_command'

From: Arnd Bergmann
Date: Wed Dec 06 2023 - 01:53:39 EST


On Wed, Dec 6, 2023, at 06:24, Randy Dunlap wrote:
>> All errors (new ones prefixed by >>):
>>
>> mips64el-linux-ld: arch/mips/loongson2ef/lemote-2f/pm.o: in function `setup_wakeup_events':
>>>> pm.c:(.text+0x118): undefined reference to `i8042_command'
>>>> mips64el-linux-ld: pm.c:(.text+0x154): undefined reference to `i8042_command'
>
>
> How do we feel about this?
> I suppose that an ARCH or mach or board should know what it requires.
>
>
> ---
> arch/mips/loongson2ef/Kconfig | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff -- a/arch/mips/loongson2ef/Kconfig b/arch/mips/loongson2ef/Kconfig
> --- a/arch/mips/loongson2ef/Kconfig
> +++ b/arch/mips/loongson2ef/Kconfig
> @@ -40,6 +40,9 @@ config LEMOTE_MACH2F
> select ARCH_HAS_PHYS_TO_DMA
> select ARCH_MIGHT_HAVE_PC_PARPORT
> select ARCH_MIGHT_HAVE_PC_SERIO
> + select INPUT
> + select SERIO
> + select SERIO_I8042
> select BOARD_SCACHE
> select BOOT_ELF32

I think it's bad style to force-select an optional subsystem.
How about making the entire file optional? It seems that there
are already __weak functions in its place.

--- a/arch/mips/loongson2ef/lemote-2f/Makefile
+++ b/arch/mips/loongson2ef/lemote-2f/Makefile
@@ -8,5 +8,6 @@ obj-y += clock.o machtype.o irq.o reset.o dma.o ec_kb3310b.o
#
# Suspend Support
#
-
+ifdef CONFIG_SERIO_I8042
obj-$(CONFIG_SUSPEND) += pm.o
+endif

Arnd