From patchwork Thu Nov 29 05:54:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 152365 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1988390ljp; Wed, 28 Nov 2018 21:56:57 -0800 (PST) X-Google-Smtp-Source: AFSGD/XAkqs/nJn5C9o5UhMh85KQQz+BXdgmgum+9AkPbLQ//2aH9uP7LVhoPES1txDm5bZIKIcM X-Received: by 2002:a62:13c3:: with SMTP id 64mr163192pft.93.1543471017714; Wed, 28 Nov 2018 21:56:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543471017; cv=none; d=google.com; s=arc-20160816; b=UyLxM1kNCQG5Y0WKjIKeh02oVmvumMxe9/XpasvE0T7nbe+tLr+NtBm94xPDyo+NVQ 0iwI/eFZ50Ix0+U3nqPCOJrLAHj3+EYjOc00eHjMrbTucy/6IIE66hrdY616YVWKEkWQ lneFtxBsiK7EFWisl0IXmUrelWsVSRgTRhAxMsZdpR8peV9O6d7lMfvUAj82BKCnAFXY 6PrUZTEaMhd5Ytqq7xdA2tq8yHs5Xx+oeM8DyfE/k4SXL++TC4seOjJXbfk6Mt1cK7bi ryA+6G+y+O6nl/etd9S+yX8nkC+j2rh4FS7K1RPfTZ6DZAHvZ1NuzKNxW5a9RzSLt0FD b4dQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=qpU/sT1fzFwjomzAgpfwRseqy2fvMp1wTT/MEZ0pbxg=; b=xc0uTK+nL5pUUePp5TnTsSsQkDdq6RuZO3JDZSGZQlhd8mj3nADzwQHQtT4DxFB5uq IklLMGCbMsZdlqu95+rBjA5gbhVTS+18TXa52dCTM0ZYm3u4SZgxaO245OiTagCCJf/s boaQ50NysuAD27U+o55YJMrVYygoJcUWWd16H4yFwaA2CxWRSKe6yWcBXzpMgAczttBN kvcXqixzyVv0rG0Kc6EikZGubp2o2/XuabA7Kj5pXG8TT3cwomBE7ecrmjwO8ycMlhwd sVaLyFJBQRY640ot1I1JevAKVBPo2+BthlgUpLC93ECH9fgWrN8PbvpIaWzCB4j8NQ6C TWwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NnNMAVhj; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x9si878014pgh.12.2018.11.28.21.56.57; Wed, 28 Nov 2018 21:56:57 -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; dkim=pass header.i=@kernel.org header.s=default header.b=NnNMAVhj; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727867AbeK2RBF (ORCPT + 32 others); Thu, 29 Nov 2018 12:01:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:34254 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727477AbeK2RBF (ORCPT ); Thu, 29 Nov 2018 12:01:05 -0500 Received: from sasha-vm.mshome.net (unknown [37.142.5.207]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6EB1120834; Thu, 29 Nov 2018 05:56:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543471014; bh=/kg7qZuMBFfoHlY5b6U195LYbC86eXaRO1YXj45utqU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NnNMAVhj4hkxejk8oUdbHAtQRh3uzy6NvWiHthZ0kFna3xdKKPtmXT8jtMsVPCsFu jNhVT3BCKncs+uldnIBRPuTvljgiGp/Q9uMXrOjfINmevfoHMmAOPzx+z3+TqG2WOf Q4Zrk0rkBgZ8HohXGCH2r5O/zw/swJ5GPMgYzxyE= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , Lorenzo Bianconi , Kalle Valo , Sasha Levin , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 07/68] mt76: fix building without CONFIG_LEDS_CLASS Date: Thu, 29 Nov 2018 00:54:58 -0500 Message-Id: <20181129055559.159228-7-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181129055559.159228-1-sashal@kernel.org> References: <20181129055559.159228-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann [ Upstream commit b374e8686fc35ae124e62dc78725ea656ba1ef8a ] 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 Signed-off-by: Lorenzo Bianconi Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/Kconfig | 6 ++++++ drivers/net/wireless/mediatek/mt76/mac80211.c | 8 +++++--- drivers/net/wireless/mediatek/mt76/mt76x2_init.c | 6 ++++-- 3 files changed, 15 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/drivers/net/wireless/mediatek/mt76/Kconfig b/drivers/net/wireless/mediatek/mt76/Kconfig index b6c5f17dca30..27826217ff76 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 029d54bce9e8..ade4a2029a24 100644 --- a/drivers/net/wireless/mediatek/mt76/mac80211.c +++ b/drivers/net/wireless/mediatek/mt76/mac80211.c @@ -342,9 +342,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 b814391f79ac..03b103c45d69 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c @@ -581,8 +581,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));