diff mbox series

mt76: fix LED link time failure

Message ID 20191216131902.3251040-1-arnd@arndb.de (mailing list archive)
State New, archived
Headers show
Series mt76: fix LED link time failure | expand

Commit Message

Arnd Bergmann Dec. 16, 2019, 1:18 p.m. UTC
The mt76_led_cleanup() function is called unconditionally, which
leads to a link error when CONFIG_LEDS is a loadable module or
disabled but mt76 is built-in:

drivers/net/wireless/mediatek/mt76/mac80211.o: In function `mt76_unregister_device':
mac80211.c:(.text+0x2ac): undefined reference to `led_classdev_unregister'

Use the same trick that is guarding the registration, using an
IS_ENABLED() check for the CONFIG_MT76_LEDS symbol that indicates
whether LEDs can be used or not.

Fixes: 36f7e2b2bb1d ("mt76: do not use devm API for led classdev")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/wireless/mediatek/mt76/mac80211.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Kalle Valo Dec. 17, 2019, 2:35 p.m. UTC | #1
Arnd Bergmann <arnd@arndb.de> writes:

> The mt76_led_cleanup() function is called unconditionally, which
> leads to a link error when CONFIG_LEDS is a loadable module or
> disabled but mt76 is built-in:
>
> drivers/net/wireless/mediatek/mt76/mac80211.o: In function `mt76_unregister_device':
> mac80211.c:(.text+0x2ac): undefined reference to `led_classdev_unregister'
>
> Use the same trick that is guarding the registration, using an
> IS_ENABLED() check for the CONFIG_MT76_LEDS symbol that indicates
> whether LEDs can be used or not.
>
> Fixes: 36f7e2b2bb1d ("mt76: do not use devm API for led classdev")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Felix, as this is a regression in v5.5-rc1 can I take this directly to
wireless-drivers?
Felix Fietkau Dec. 17, 2019, 2:59 p.m. UTC | #2
On 2019-12-17 15:35, Kalle Valo wrote:
> Arnd Bergmann <arnd@arndb.de> writes:
> 
>> The mt76_led_cleanup() function is called unconditionally, which
>> leads to a link error when CONFIG_LEDS is a loadable module or
>> disabled but mt76 is built-in:
>>
>> drivers/net/wireless/mediatek/mt76/mac80211.o: In function `mt76_unregister_device':
>> mac80211.c:(.text+0x2ac): undefined reference to `led_classdev_unregister'
>>
>> Use the same trick that is guarding the registration, using an
>> IS_ENABLED() check for the CONFIG_MT76_LEDS symbol that indicates
>> whether LEDs can be used or not.
>>
>> Fixes: 36f7e2b2bb1d ("mt76: do not use devm API for led classdev")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> Felix, as this is a regression in v5.5-rc1 can I take this directly to
> wireless-drivers?
Yes. Please add:
Acked-by: Felix Fietkau <nbd@nbd.name>

- Felix
Kalle Valo Dec. 18, 2019, 6:25 p.m. UTC | #3
Arnd Bergmann <arnd@arndb.de> wrote:

> The mt76_led_cleanup() function is called unconditionally, which
> leads to a link error when CONFIG_LEDS is a loadable module or
> disabled but mt76 is built-in:
> 
> drivers/net/wireless/mediatek/mt76/mac80211.o: In function `mt76_unregister_device':
> mac80211.c:(.text+0x2ac): undefined reference to `led_classdev_unregister'
> 
> Use the same trick that is guarding the registration, using an
> IS_ENABLED() check for the CONFIG_MT76_LEDS symbol that indicates
> whether LEDs can be used or not.
> 
> Fixes: 36f7e2b2bb1d ("mt76: do not use devm API for led classdev")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Acked-by: Felix Fietkau <nbd@nbd.name>

Patch applied to wireless-drivers.git, thanks.

d68f4e43a46f mt76: fix LED link time failure
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c
index b9f2a401041a..96018fd65779 100644
--- a/drivers/net/wireless/mediatek/mt76/mac80211.c
+++ b/drivers/net/wireless/mediatek/mt76/mac80211.c
@@ -378,7 +378,8 @@  void mt76_unregister_device(struct mt76_dev *dev)
 {
 	struct ieee80211_hw *hw = dev->hw;
 
-	mt76_led_cleanup(dev);
+	if (IS_ENABLED(CONFIG_MT76_LEDS))
+		mt76_led_cleanup(dev);
 	mt76_tx_status_check(dev, NULL, true);
 	ieee80211_unregister_hw(hw);
 }