linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] leds: rt8515: add V4L2_FLASH_LED_CLASS dependency
@ 2021-02-04 15:39 Arnd Bergmann
  2021-02-04 16:12 ` Pavel Machek
  2021-02-05  9:16 ` Linus Walleij
  0 siblings, 2 replies; 4+ messages in thread
From: Arnd Bergmann @ 2021-02-04 15:39 UTC (permalink / raw)
  To: Pavel Machek, Sakari Ailus, Linus Walleij
  Cc: Arnd Bergmann, Dan Murphy, linux-leds, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

The leds-rt8515 driver can optionall use the v4l2 flash led class,
but it causes a link error when that class is in a loadable module
and the rt8515 driver itself is built-in:

ld.lld: error: undefined symbol: v4l2_flash_init
>>> referenced by leds-rt8515.c
>>>               leds/flash/leds-rt8515.o:(rt8515_probe) in archive
drivers/built-in.a

Adding 'depends on V4L2_FLASH_LED_CLASS' in Kconfig would avoid that,
but it would make it impossible to use the driver without the
v4l2 support.

Add the same dependency that the other users of this class have
instead, which just prevents the broken configuration.

Fixes: e1c6edcbea13 ("leds: rt8515: Add Richtek RT8515 LED driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/leds/flash/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/leds/flash/Kconfig b/drivers/leds/flash/Kconfig
index d21d273ef3da..b580b416b9a4 100644
--- a/drivers/leds/flash/Kconfig
+++ b/drivers/leds/flash/Kconfig
@@ -5,6 +5,7 @@ if LEDS_CLASS_FLASH
 config LEDS_RT8515
 	tristate "LED support for Richtek RT8515 flash/torch LED"
 	depends on GPIOLIB
+	depends on V4L2_FLASH_LED_CLASS || !V4L2_FLASH_LED_CLASS
 	help
 	  This option enables support for the Richtek RT8515 flash
 	  and torch LEDs found on some mobile phones.
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] leds: rt8515: add V4L2_FLASH_LED_CLASS dependency
  2021-02-04 15:39 [PATCH] leds: rt8515: add V4L2_FLASH_LED_CLASS dependency Arnd Bergmann
@ 2021-02-04 16:12 ` Pavel Machek
  2021-02-05  9:16 ` Linus Walleij
  1 sibling, 0 replies; 4+ messages in thread
From: Pavel Machek @ 2021-02-04 16:12 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Sakari Ailus, Linus Walleij, Arnd Bergmann, Dan Murphy,
	linux-leds, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 695 bytes --]

On Thu 2021-02-04 16:39:44, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The leds-rt8515 driver can optionall use the v4l2 flash led class,

Optionally.

> Add the same dependency that the other users of this class have
> instead, which just prevents the broken configuration.
> 
> Fixes: e1c6edcbea13 ("leds: rt8515: Add Richtek RT8515 LED driver")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Thanks for the fix. If you plan to send a pull request to linus before
5.11, feel free to add it.

Acked-by: Pavel Machek <pavel@ucw.cz>

Otherwise I'll queue it for -rc1, I guess.

Best regards,
								Pavel
-- 
http://www.livejournal.com/~pavelmachek

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] leds: rt8515: add V4L2_FLASH_LED_CLASS dependency
  2021-02-04 15:39 [PATCH] leds: rt8515: add V4L2_FLASH_LED_CLASS dependency Arnd Bergmann
  2021-02-04 16:12 ` Pavel Machek
@ 2021-02-05  9:16 ` Linus Walleij
  2021-02-15  9:49   ` Pavel Machek
  1 sibling, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2021-02-05  9:16 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Pavel Machek, Sakari Ailus, Arnd Bergmann, Dan Murphy,
	Linux LED Subsystem, linux-kernel

On Thu, Feb 4, 2021 at 4:39 PM Arnd Bergmann <arnd@kernel.org> wrote:

> From: Arnd Bergmann <arnd@arndb.de>
>
> The leds-rt8515 driver can optionall use the v4l2 flash led class,
> but it causes a link error when that class is in a loadable module
> and the rt8515 driver itself is built-in:
>
> ld.lld: error: undefined symbol: v4l2_flash_init
> >>> referenced by leds-rt8515.c
> >>>               leds/flash/leds-rt8515.o:(rt8515_probe) in archive
> drivers/built-in.a
>
> Adding 'depends on V4L2_FLASH_LED_CLASS' in Kconfig would avoid that,
> but it would make it impossible to use the driver without the
> v4l2 support.
>
> Add the same dependency that the other users of this class have
> instead, which just prevents the broken configuration.
>
> Fixes: e1c6edcbea13 ("leds: rt8515: Add Richtek RT8515 LED driver")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

> +       depends on V4L2_FLASH_LED_CLASS || !V4L2_FLASH_LED_CLASS

This kind of thing that looks like a truism but isn't is one of the
most unintuitive
things about KConfig :/ no idea what to do about it though.

I remember making a program for the C64 in early 1990ies with joke input
such as y/n/m (yes/no/maybe), sadly in Kconfig this is no joke.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] leds: rt8515: add V4L2_FLASH_LED_CLASS dependency
  2021-02-05  9:16 ` Linus Walleij
@ 2021-02-15  9:49   ` Pavel Machek
  0 siblings, 0 replies; 4+ messages in thread
From: Pavel Machek @ 2021-02-15  9:49 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Arnd Bergmann, Sakari Ailus, Arnd Bergmann, Dan Murphy,
	Linux LED Subsystem, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1498 bytes --]

Hi!

> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > The leds-rt8515 driver can optionall use the v4l2 flash led class,
> > but it causes a link error when that class is in a loadable module
> > and the rt8515 driver itself is built-in:
> >
> > ld.lld: error: undefined symbol: v4l2_flash_init
> > >>> referenced by leds-rt8515.c
> > >>>               leds/flash/leds-rt8515.o:(rt8515_probe) in archive
> > drivers/built-in.a
> >
> > Adding 'depends on V4L2_FLASH_LED_CLASS' in Kconfig would avoid that,
> > but it would make it impossible to use the driver without the
> > v4l2 support.
> >
> > Add the same dependency that the other users of this class have
> > instead, which just prevents the broken configuration.
> >
> > Fixes: e1c6edcbea13 ("leds: rt8515: Add Richtek RT8515 LED driver")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> 
> > +       depends on V4L2_FLASH_LED_CLASS || !V4L2_FLASH_LED_CLASS
> 
> This kind of thing that looks like a truism but isn't is one of the
> most unintuitive
> things about KConfig :/ no idea what to do about it though.

This is the way it is usually fixed. Anyway, I applied it and pushed
it to Linus and it is now merged.

> I remember making a program for the C64 in early 1990ies with joke input
> such as y/n/m (yes/no/maybe), sadly in Kconfig this is no joke.

:-).

Best regards,
									Pavel
-- 
http://www.livejournal.com/~pavelmachek

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-15  9:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-04 15:39 [PATCH] leds: rt8515: add V4L2_FLASH_LED_CLASS dependency Arnd Bergmann
2021-02-04 16:12 ` Pavel Machek
2021-02-05  9:16 ` Linus Walleij
2021-02-15  9:49   ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).