linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mt76: fix building without CONFIG_LEDS_CLASS
       [not found] <cover.1541150589.git.lorenzo.bianconi@redhat.com>
@ 2018-11-02  9:32 ` Lorenzo Bianconi
  2018-11-02 11:33   ` Kalle Valo
  0 siblings, 1 reply; 4+ messages in thread
From: Lorenzo Bianconi @ 2018-11-02  9:32 UTC (permalink / raw)
  To: nbd; +Cc: sgruszka, linux-wireless, arnd

From: Arnd Bergmann <arnd@arndb.de>

When CONFIG_LEDS_CLASS is disabled, or it is a loadable module while
mt76 is built-in, we run into a link error:

drivers/net/wireless/mediatek/mt76/mac80211.o: In function `mt76_register_device':
mac80211.c:(.text+0xb78): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `devm_of_led_classdev_register'

We don't really need a hard dependency here as the driver can presumably
work just fine without LEDs, so this follows the iwlwifi example and
adds a separate Kconfig option for the LED support, this will be available
whenever it will link, and otherwise the respective code gets left out from
the driver object.

Fixes: 17f1de56df05 ("mt76: add common code shared between multiple chipsets")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
 drivers/net/wireless/mediatek/mt76/Kconfig           | 6 ++++++
 drivers/net/wireless/mediatek/mt76/mac80211.c        | 8 +++++---
 drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c | 6 ++++--
 3 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/Kconfig b/drivers/net/wireless/mediatek/mt76/Kconfig
index 0ccbcd7e887d..c30d8f5bbf2a 100644
--- a/drivers/net/wireless/mediatek/mt76/Kconfig
+++ b/drivers/net/wireless/mediatek/mt76/Kconfig
@@ -1,6 +1,12 @@
 config MT76_CORE
 	tristate
 
+config MT76_LEDS
+	bool
+	depends on MT76_CORE
+	depends on LEDS_CLASS=y || MT76_CORE=LEDS_CLASS
+	default y
+
 config MT76_USB
 	tristate
 	depends on MT76_CORE
diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c
index 2a699e8b79bf..7d219ff2d480 100644
--- a/drivers/net/wireless/mediatek/mt76/mac80211.c
+++ b/drivers/net/wireless/mediatek/mt76/mac80211.c
@@ -345,9 +345,11 @@ int mt76_register_device(struct mt76_dev *dev, bool vht,
 	mt76_check_sband(dev, NL80211_BAND_2GHZ);
 	mt76_check_sband(dev, NL80211_BAND_5GHZ);
 
-	ret = mt76_led_init(dev);
-	if (ret)
-		return ret;
+	if (IS_ENABLED(CONFIG_MT76_LEDS)) {
+		ret = mt76_led_init(dev);
+		if (ret)
+			return ret;
+	}
 
 	return ieee80211_register_hw(hw);
 }
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c
index 7b53b2be28c2..b6f1efb7daa8 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c
@@ -417,8 +417,10 @@ int mt76x2_register_device(struct mt76x02_dev *dev)
 	wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_VHT_IBSS);
 
 	/* init led callbacks */
-	dev->mt76.led_cdev.brightness_set = mt76x2_led_set_brightness;
-	dev->mt76.led_cdev.blink_set = mt76x2_led_set_blink;
+	if (IS_ENABLED(CONFIG_MT76_LEDS)) {
+		dev->mt76.led_cdev.brightness_set = mt76x2_led_set_brightness;
+		dev->mt76.led_cdev.blink_set = mt76x2_led_set_blink;
+	}
 
 	ret = mt76_register_device(&dev->mt76, true, mt76x02_rates,
 				   ARRAY_SIZE(mt76x02_rates));
-- 
2.17.2


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

* Re: [PATCH] mt76: fix building without CONFIG_LEDS_CLASS
  2018-11-02  9:32 ` [PATCH] mt76: fix building without CONFIG_LEDS_CLASS Lorenzo Bianconi
@ 2018-11-02 11:33   ` Kalle Valo
  2018-11-02 13:20     ` Lorenzo Bianconi
  0 siblings, 1 reply; 4+ messages in thread
From: Kalle Valo @ 2018-11-02 11:33 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: nbd, sgruszka, linux-wireless, arnd

Lorenzo Bianconi <lorenzo.bianconi@redhat.com> writes:

> From: Arnd Bergmann <arnd@arndb.de>
>
> When CONFIG_LEDS_CLASS is disabled, or it is a loadable module while
> mt76 is built-in, we run into a link error:
>
> drivers/net/wireless/mediatek/mt76/mac80211.o: In function `mt76_register_device':
> mac80211.c:(.text+0xb78): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `devm_of_led_classdev_register'
>
> We don't really need a hard dependency here as the driver can presumably
> work just fine without LEDs, so this follows the iwlwifi example and
> adds a separate Kconfig option for the LED support, this will be available
> whenever it will link, and otherwise the respective code gets left out from
> the driver object.
>
> Fixes: 17f1de56df05 ("mt76: add common code shared between multiple chipsets")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

Should this go to 4.20? A linker error is pretty bad, even though I
think this is few months old issue already.

And are conflicts with -next version of mt76 likely?

-- 
Kalle Valo

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

* Re: [PATCH] mt76: fix building without CONFIG_LEDS_CLASS
  2018-11-02 11:33   ` Kalle Valo
@ 2018-11-02 13:20     ` Lorenzo Bianconi
  2018-11-05 14:54       ` Kalle Valo
  0 siblings, 1 reply; 4+ messages in thread
From: Lorenzo Bianconi @ 2018-11-02 13:20 UTC (permalink / raw)
  To: Kalle Valo; +Cc: nbd, sgruszka, linux-wireless, arnd

> Lorenzo Bianconi <lorenzo.bianconi@redhat.com> writes:
> 
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > When CONFIG_LEDS_CLASS is disabled, or it is a loadable module while
> > mt76 is built-in, we run into a link error:
> >
> > drivers/net/wireless/mediatek/mt76/mac80211.o: In function `mt76_register_device':
> > mac80211.c:(.text+0xb78): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `devm_of_led_classdev_register'
> >
> > We don't really need a hard dependency here as the driver can presumably
> > work just fine without LEDs, so this follows the iwlwifi example and
> > adds a separate Kconfig option for the LED support, this will be available
> > whenever it will link, and otherwise the respective code gets left out from
> > the driver object.
> >
> > Fixes: 17f1de56df05 ("mt76: add common code shared between multiple chipsets")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
> 
> Should this go to 4.20? A linker error is pretty bad, even though I
> think this is few months old issue already.

 I guess so. The patch is based on top of Felix's repository so it apply with a
 'fuzz' on net-next/wireless-drivers-next but the patch is ok. Do I need to
 resend or it is ok?

 Regards,
 Lorenzo

> 
> And are conflicts with -next version of mt76 likely?
> 
> -- 
> Kalle Valo

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

* Re: [PATCH] mt76: fix building without CONFIG_LEDS_CLASS
  2018-11-02 13:20     ` Lorenzo Bianconi
@ 2018-11-05 14:54       ` Kalle Valo
  0 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2018-11-05 14:54 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: nbd, sgruszka, linux-wireless, arnd

Lorenzo Bianconi <lorenzo.bianconi@redhat.com> writes:

>> Lorenzo Bianconi <lorenzo.bianconi@redhat.com> writes:
>> 
>> > From: Arnd Bergmann <arnd@arndb.de>
>> >
>> > When CONFIG_LEDS_CLASS is disabled, or it is a loadable module while
>> > mt76 is built-in, we run into a link error:
>> >
>> > drivers/net/wireless/mediatek/mt76/mac80211.o: In function `mt76_register_device':
>> > mac80211.c:(.text+0xb78): relocation truncated to fit:
>> > R_AARCH64_CALL26 against undefined symbol
>> > `devm_of_led_classdev_register'
>> >
>> > We don't really need a hard dependency here as the driver can presumably
>> > work just fine without LEDs, so this follows the iwlwifi example and
>> > adds a separate Kconfig option for the LED support, this will be available
>> > whenever it will link, and otherwise the respective code gets left out from
>> > the driver object.
>> >
>> > Fixes: 17f1de56df05 ("mt76: add common code shared between multiple chipsets")
>> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
>> 
>> Should this go to 4.20? A linker error is pretty bad, even though I
>> think this is few months old issue already.
>
>  I guess so. The patch is based on top of Felix's repository so it apply with a
>  'fuzz' on net-next/wireless-drivers-next but the patch is ok. Do I need to
>  resend or it is ok?

Doesn't seem to apply to wireless-drivers (which I fast forwarded to
v4.20-rc1 today):

Failed to apply the patch: ['git', 'am', '-s', '-3'] failed: 128
fatal: sha1 information is lacking or useless (drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c).
error: could not build fake ancestor

So please rebase and resend.

-- 
Kalle Valo

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

end of thread, other threads:[~2018-11-05 14:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <cover.1541150589.git.lorenzo.bianconi@redhat.com>
2018-11-02  9:32 ` [PATCH] mt76: fix building without CONFIG_LEDS_CLASS Lorenzo Bianconi
2018-11-02 11:33   ` Kalle Valo
2018-11-02 13:20     ` Lorenzo Bianconi
2018-11-05 14:54       ` Kalle Valo

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