Re: drivers/leds/flash/leds-rt8515.c:216: undefined reference to `v4l2_flash_release'

From: Linus Walleij
Date: Fri Feb 12 2021 - 07:56:50 EST


I need Arnds help with this...

On Fri, Feb 12, 2021 at 12:05 AM kernel test robot <lkp@xxxxxxxxx> wrote:

> ld: drivers/leds/flash/leds-rt8515.o: in function `rt8515_v4l2_flash_release':
> >> drivers/leds/flash/leds-rt8515.c:216: undefined reference to `v4l2_flash_release'
> ld: drivers/leds/flash/leds-rt8515.o: in function `rt8515_probe':
> drivers/leds/flash/leds-rt8515.c:354: undefined reference to `v4l2_flash_init'

So the problem is that this is compiled in, so CONFIG_LEDS_RT8515=y
(it is tristate so can also be a module)
but it depends on symbols from a module:
CONFIG_V4L2_FLASH_LED_CLASS=m.

In the code I try to only support the V4L2 interface when using V4L2:
#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
(... V4L2 code...)

Is there a way to define in Kconfig that if and only if you enable
this other module it has to follow the y or m that we use for this
driver?

Or do I simply have to bite the bullet, make it bool and
depend on CONFIG_V4L2_FLASH_LED_CLASS || !CONFIG_V4L2_FLASH_LED_CLASS
?

Yours,
Linus Walleij