2019-07-29 03:46:17

by Yue Haibing

[permalink] [raw]
Subject: [PATCH] Input: applespi - Fix build error

If CONFIG_KEYBOARD_APPLESPI=y but CONFIG_LEDS_CLASS=m
building fails:

drivers/input/keyboard/applespi.o: In function `applespi_probe':
applespi.c:(.text+0x1fcd): undefined reference to `devm_led_classdev_register_ext'

Wrap it in LEDS_CLASS macro to fix this.

Reported-by: Hulk Robot <[email protected]>
Fixes: 038b1a05eae6 ("Input: add Apple SPI keyboard and trackpad driver")
Signed-off-by: YueHaibing <[email protected]>
---
drivers/input/keyboard/applespi.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/input/keyboard/applespi.c b/drivers/input/keyboard/applespi.c
index acf34a5..9c50b09 100644
--- a/drivers/input/keyboard/applespi.c
+++ b/drivers/input/keyboard/applespi.c
@@ -1790,11 +1790,13 @@ static int applespi_probe(struct spi_device *spi)
applespi->backlight_info.default_trigger = "kbd-backlight";
applespi->backlight_info.brightness_set = applespi_set_bl_level;

+#ifdef CONFIG_LEDS_CLASS
sts = devm_led_classdev_register(&spi->dev, &applespi->backlight_info);
if (sts)
dev_warn(&applespi->spi->dev,
"Unable to register keyboard backlight class dev (%d)\n",
sts);
+#endif

/* set up debugfs entries for touchpad dimensions logging */
applespi->debugfs_root = debugfs_create_dir("applespi", NULL);
--
2.7.4



2019-07-29 16:12:58

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH] Input: applespi - Fix build error

On Mon, Jul 29, 2019 at 11:14:55AM +0800, YueHaibing wrote:
> If CONFIG_KEYBOARD_APPLESPI=y but CONFIG_LEDS_CLASS=m
> building fails:
>
> drivers/input/keyboard/applespi.o: In function `applespi_probe':
> applespi.c:(.text+0x1fcd): undefined reference to `devm_led_classdev_register_ext'
>
> Wrap it in LEDS_CLASS macro to fix this.

No, we should add "depends on LEDS_CLASS" to the Konfig instead.

Thanks.

--
Dmitry

Subject: Re: [PATCH] Input: applespi - Fix build error


On Mon, Jul 29, 2019 at 04:04:38PM +0200, Dmitry Torokhov wrote:
> On Mon, Jul 29, 2019 at 11:14:55AM +0800, YueHaibing wrote:
> > If CONFIG_KEYBOARD_APPLESPI=y but CONFIG_LEDS_CLASS=m
> > building fails:
> >
> > drivers/input/keyboard/applespi.o: In function `applespi_probe':
> > applespi.c:(.text+0x1fcd): undefined reference to `devm_led_classdev_register_ext'
> >
> > Wrap it in LEDS_CLASS macro to fix this.
>
> No, we should add "depends on LEDS_CLASS" to the Konfig instead.

While the loss of keyboard-backlight functionality is certainly not
critical, in practice when building a kernel for desktops/laptops
(i.e. where this module would be used) I see no real reason why you'd
not have/want LEDS_CLASS enabled. So I'd agree with Dmitry that a
Kconfig depends-on is probably the preferred approach.


Cheers,

Ronald

2019-07-30 10:43:09

by Yue Haibing

[permalink] [raw]
Subject: Re: [PATCH] Input: applespi - Fix build error

On 2019/7/30 15:01, Life is hard, and then you die wrote:
>
> On Mon, Jul 29, 2019 at 04:04:38PM +0200, Dmitry Torokhov wrote:
>> On Mon, Jul 29, 2019 at 11:14:55AM +0800, YueHaibing wrote:
>>> If CONFIG_KEYBOARD_APPLESPI=y but CONFIG_LEDS_CLASS=m
>>> building fails:
>>>
>>> drivers/input/keyboard/applespi.o: In function `applespi_probe':
>>> applespi.c:(.text+0x1fcd): undefined reference to `devm_led_classdev_register_ext'
>>>
>>> Wrap it in LEDS_CLASS macro to fix this.
>>
>> No, we should add "depends on LEDS_CLASS" to the Konfig instead.
>
> While the loss of keyboard-backlight functionality is certainly not
> critical, in practice when building a kernel for desktops/laptops
> (i.e. where this module would be used) I see no real reason why you'd
> not have/want LEDS_CLASS enabled. So I'd agree with Dmitry that a
> Kconfig depends-on is probably the preferred approach.

Thanks, will send v2 as suggestion.

>
>
> Cheers,
>
> Ronald
>
>
> .
>

2019-07-30 17:46:30

by Yue Haibing

[permalink] [raw]
Subject: [PATCH v2] Input: applespi - Fix build error

If CONFIG_KEYBOARD_APPLESPI=y but CONFIG_LEDS_CLASS=m
building fails:

drivers/input/keyboard/applespi.o: In function `applespi_probe':
applespi.c:(.text+0x1fcd): undefined reference to `devm_led_classdev_register_ext'

Add "depends on LEDS_CLASS" to the Konfig

Reported-by: Hulk Robot <[email protected]>
Fixes: 038b1a05eae6 ("Input: add Apple SPI keyboard and trackpad driver")
Signed-off-by: YueHaibing <[email protected]>
---
v2: use 'depends on LEDS_CLASS'
---
drivers/input/keyboard/Kconfig | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index ebb19e2..90e8a7f 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -76,6 +76,7 @@ config KEYBOARD_APPLESPI
depends on ACPI && EFI
depends on SPI
depends on X86 || COMPILE_TEST
+ depends on LEDS_CLASS
select CRC16
help
Say Y here if you are running Linux on any Apple MacBook8,1 or later,
--
2.7.4


2019-07-31 15:10:55

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH v2] Input: applespi - Fix build error

On Tue, Jul 30, 2019 at 09:34:14PM +0800, YueHaibing wrote:
> If CONFIG_KEYBOARD_APPLESPI=y but CONFIG_LEDS_CLASS=m
> building fails:
>
> drivers/input/keyboard/applespi.o: In function `applespi_probe':
> applespi.c:(.text+0x1fcd): undefined reference to `devm_led_classdev_register_ext'
>
> Add "depends on LEDS_CLASS" to the Konfig
>
> Reported-by: Hulk Robot <[email protected]>
> Fixes: 038b1a05eae6 ("Input: add Apple SPI keyboard and trackpad driver")
> Signed-off-by: YueHaibing <[email protected]>

Applied, thank you.

> ---
> v2: use 'depends on LEDS_CLASS'
> ---
> drivers/input/keyboard/Kconfig | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
> index ebb19e2..90e8a7f 100644
> --- a/drivers/input/keyboard/Kconfig
> +++ b/drivers/input/keyboard/Kconfig
> @@ -76,6 +76,7 @@ config KEYBOARD_APPLESPI
> depends on ACPI && EFI
> depends on SPI
> depends on X86 || COMPILE_TEST
> + depends on LEDS_CLASS
> select CRC16
> help
> Say Y here if you are running Linux on any Apple MacBook8,1 or later,
> --
> 2.7.4
>
>

--
Dmitry