diff mbox series

Input: applespi - Fix build error

Message ID 20190729031455.59400-1-yuehaibing@huawei.com (mailing list archive)
State Superseded
Headers show
Series Input: applespi - Fix build error | expand

Commit Message

Yue Haibing July 29, 2019, 3:14 a.m. UTC
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 <hulkci@huawei.com>
Fixes: 038b1a05eae6 ("Input: add Apple SPI keyboard and trackpad driver")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/input/keyboard/applespi.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Dmitry Torokhov July 29, 2019, 2:04 p.m. UTC | #1
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.
Life is hard, and then you die July 30, 2019, 7:01 a.m. UTC | #2
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
Yue Haibing July 30, 2019, 7:22 a.m. UTC | #3
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
> 
> 
> .
>
diff mbox series

Patch

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);