Skip to content

Commit

Permalink
mt76: fix LED link time failure
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  • Loading branch information
arndb authored and nbd168 committed Feb 14, 2020
1 parent c75cf51 commit cc56c40
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mac80211.c
Expand Up @@ -471,7 +471,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);
}
Expand Down

0 comments on commit cc56c40

Please sign in to comment.