From patchwork Thu Jan 18 13:14:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 124946 Delivered-To: patch@linaro.org Received: by 10.46.64.27 with SMTP id n27csp121439lja; Thu, 18 Jan 2018 05:15:56 -0800 (PST) X-Google-Smtp-Source: ACJfBotdCWvu5PkRXd/Cn5xwzEge2qIAAjg5/6+CsB5B02uDhBYemZNmDuW/L2k3e48H1R7GBu3N X-Received: by 10.99.152.84 with SMTP id l20mr17230020pgo.382.1516281356308; Thu, 18 Jan 2018 05:15:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516281356; cv=none; d=google.com; s=arc-20160816; b=Rl6deSOQnAqBy2HrZ7oPhwFAh/ZYO4y2N7KbjrhHIHUwBIh35vCVHLBN+aj1wKIDpR qXp8CJxUiptLFdzxUn2QF/z76XpUIVS98ZdVQm0kkMd2qCIc/8gnfQP4QPRdB3CjkmLj EnoAXv+ujGnm178Q4jWTvEKhUXpuFuSBLk8BQhyiGOqwqV2eqQW8jywmIMYyMFFa66TD sYg9IEBDBSLJbY2TtYhPgfxlCQnMDZeDhmplriZupAfwXhLSr0SN3xGseQanToYhtPUd Dq639bJvJ9q70KNCC1Sa0Qpwa+grxl59ihC4K1MNgFsyHdNuAdGZW0rh+gA1IqmKwiVg Bpng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=bC4UD/WVpIchdaG3FC/a4lNHtVXrKoBi+9sFql3m64U=; b=JlVT4fmY/HAS13RByUHMFA46cHUGGPy4F5CowIb4AohBe+fl17NiNXOpian1h9BM+f GPbIBLP7EN3YwGIpFNiLLhR2oygFh6FiBfNCoeGt8Lz3tto2GeFIcB0j+M38kJpqmOfY sNBdBRHMebiAajKFDIOF1UFDklwFIwCjjBC+4MBN0uHZgNhI+yiAntJ3qD2zaysnjXZe eOa18KVRaTDcScwJhNnS8Hit2aX0HWu4zPd7v7tIslbZI7uUBlPKHIDLjva3tUzKgAar OTxpApG1A8MtctQcf15bKNDogY1oCIHnxj6VT7ckmjEvuZCO8nYZyDgeVhMfnwjtBwg9 7YOw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a9si5932580pgv.684.2018.01.18.05.15.56; Thu, 18 Jan 2018 05:15:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756150AbeARNPy (ORCPT + 28 others); Thu, 18 Jan 2018 08:15:54 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:49832 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755715AbeARNPw (ORCPT ); Thu, 18 Jan 2018 08:15:52 -0500 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.145]) with ESMTPA (Nemesis) id 0Lkxnh-1fCaea1uJJ-00aniz; Thu, 18 Jan 2018 14:15:29 +0100 From: Arnd Bergmann To: Kalle Valo Cc: Arnd Bergmann , Lorenzo Bianconi , Felix Fietkau , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH] [wireless-next] mt76: fix building without CONFIG_LEDS_CLASS Date: Thu, 18 Jan 2018 14:14:11 +0100 Message-Id: <20180118131524.817297-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:vdvdCeukQTmG1/7hjQjCAOspxxxE7XN8bcQISMhYdrrSsHF8p77 fbOhwiU/u2StBKAEhh889B5LYTacQ/EgLCy1gUagn9zewUmUSagL7ulKuM2eVCYMdJyUyDa 1kIYSUST+kd9cd2Pn/LRDriYUDhpTW6gceMXEkDx71Lx+uzZCpIeY9dIYkeIq1XnlEm4jHw HvLjrorYQGXjdL909VwGQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:Djlq+l4b3RQ=:R+pggZ/U4lNLFzW/rbzJN5 QLnpohBafLLyx/cZ3LfQXAf6MleDn2RH/4dKSCyYEUuzg8wiXWsAHbUrEnOotfLMnesmBt+eZ sSPvexu+u9WULfkeNvX2zSF8p7yPfsDGho0WCXsW+Gx4WZ8uDc2QpkFEJ58dJqlA9BAiZAAvd sad2oKsJ12m2Mf58rgzCIbScpN1gdjk0kG6pQDhaVee0qa2TDNV9eDGNGeRTGSuWSf+ulYZaa JKF1jtR3B0U0Hutm4PhtuFGDqTY/BOcqEC4IjFPO+FuyR49/mZEas1zwyiMmZo5K6Fq2NOz9I PWQjxGDMbGpVGr5ODXHwnwuKvgjw51wGH2vbehWw4bTJIIbgd0hntwIKdFLD/g9nSvqYLfUxc C+9/xA/9azwShmtR56ZP9INVgwWshKHVe38dtETaf+Ez6IBnJC+jiOAfULN7qVdP0FLHObSM/ 5YXNL09W0zFUsF4FpOSCODTmUFXqNiFV7lNVxKW65WPtrMX2Eb2K7in2kYZrEL3hasRM8uxXy XWivrXmCQQkpgalAL6FbZ8DDX3imkQBK+Pz8LSxkjXgjqvHAOunNgmAS4MDAwlhGnpZMkgbZz sg9XrVy7HETZu8s0lKHp6cLQ6fownbNCZJ/kbaYVhYnDMCflGDKhgGl/Aa8Bh5Jr4DQPL55D7 jqevBXzrRdFbI0XxR8kYhnsI1o5Upm6fkkCPPFvmsqmtJS06JRyqXDWVudOGKb0PpGT8Tu2tS ih+krmTASyQZxw5wU+0cS3+Ej64Ln4ttVFVP3w== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/net/wireless/mediatek/mt76/Kconfig | 5 +++++ drivers/net/wireless/mediatek/mt76/mac80211.c | 8 +++++--- drivers/net/wireless/mediatek/mt76/mt76x2_init.c | 6 ++++-- 3 files changed, 14 insertions(+), 5 deletions(-) -- 2.9.0 diff --git a/drivers/net/wireless/mediatek/mt76/Kconfig b/drivers/net/wireless/mediatek/mt76/Kconfig index fc05d79c80d0..9d12c1f5284e 100644 --- a/drivers/net/wireless/mediatek/mt76/Kconfig +++ b/drivers/net/wireless/mediatek/mt76/Kconfig @@ -8,3 +8,8 @@ config MT76x2E depends on PCI ---help--- This adds support for MT7612/MT7602/MT7662-based wireless PCIe devices. + +config MT76_LEDS + bool "LED support for MT76" + depends on MT76_CORE + depends on LEDS_CLASS=y || MT76_CORE=LEDS_CLASS diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c index 3acf0e175d71..144e312a9407 100644 --- a/drivers/net/wireless/mediatek/mt76/mac80211.c +++ b/drivers/net/wireless/mediatek/mt76/mac80211.c @@ -295,9 +295,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_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c index 4373a2ba5143..0c9d02af205d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c @@ -849,8 +849,10 @@ int mt76x2_register_device(struct mt76x2_dev *dev) mt76x2_dfs_init_detector(dev); /* 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, mt76x2_rates, ARRAY_SIZE(mt76x2_rates));