From patchwork Mon Nov 5 15:51:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 150212 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2765080ljp; Mon, 5 Nov 2018 07:52:10 -0800 (PST) X-Google-Smtp-Source: AJdET5dxN466uhQr7LqDWJPFvcaOtC+t04H+3jzpZxhuU7p3MK+1seKKjNGhVbl1+fXSplUFHVF5 X-Received: by 2002:a17:902:4643:: with SMTP id o61-v6mr132266pld.43.1541433130096; Mon, 05 Nov 2018 07:52:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541433130; cv=none; d=google.com; s=arc-20160816; b=gw4ht/6qtBjocmk8CSBa1BqYrk1BC/sSUOVsHDmf4z2IRVP6ROOR8EAvEU2JJAD2AW Aw2P0OUlj4Nu6xwGxyG0+BATbq5dlyjc7DwVWBi0Xf3Os90vywuSYnuEwhSntcbRhX5s b7XrcwR9UHDTHjf5j9O/yOeCKobMrjj3Y+rEXOwTcnaJd1hAW02DgQ+Imm4+Lm2MPAuk t/+2voOeJOSMIfqoJrdwuFBHlwocgfv91/IqeXvGgCo3MvunS3+1wSBzm6FsuhON6SOz VOdyc0DfJMP36pj3RKpUG8ziE63LknbD90YASNhcU8HxvHbYCtdfYMi1TR63zVxl3Z/p XE2g== 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; bh=TFedjIpQBAFd7awSZcqwYx7ieDOkJuidkc7bA7AOd24=; b=JpprpsMB9evpp9FFsmAGCZutw14KCAvxbZpwAfBKB6kMa8p9DuZm+adUVT8fqrgN0s VecQ0+NkolyRgS98R0/GMrR/oKBrUNNwkwLU4qS4cMzXmsq1tLGyDmiKfBOq6OGi25dM gcKB+9YkLBpnGvME3U44bPV7hsLBRSsEBXjxEdejsnl4qvth0qwnDQV/05ZBLIg4xs9m iGDKF/JGUGRHHiH6FsrzHT6X02gJv5vlUk2D1bOM0jQqcrQDNT0ZoS28exj83c93QXtS XAcMJm/APvmymC9OgaPwp3MZKsmdtn+57mmKomZzmxFaimrSMZq/arg0YRDqHXFhnNAe Vx1w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u15-v6si22851321plq.353.2018.11.05.07.52.09; Mon, 05 Nov 2018 07:52:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-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-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729871AbeKFBM2 (ORCPT + 3 others); Mon, 5 Nov 2018 20:12:28 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:36338 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729657AbeKFBM2 (ORCPT ); Mon, 5 Nov 2018 20:12:28 -0500 Received: by mail-wm1-f66.google.com with SMTP id a8-v6so8527966wmf.1 for ; Mon, 05 Nov 2018 07:52:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TFedjIpQBAFd7awSZcqwYx7ieDOkJuidkc7bA7AOd24=; b=JZfhbvB+EZ5op/bxnGaCj3Hc7vtry122dGXBF7XLrM4hL17xc5kGqO+CxLCCzRHU2n 98H9H9cJASShfv4tzM1ULTAp9Kk6+QieO92Xo1JFcEsrMpmH+6l572V1WZ8oNHs3b+ta boeM582Fo8o459JkJQ5R+RirjFVJrOKUVhcl39QAYb8qYN+M+DPbiutlTpEoRrig+Zm1 D8ybc13ELpgr9FbEemedclMAefkk+kkadWF6qaHsawuy2D+alI9SuOo5+vBwiQopQrjX Rwb0MCQF9auXcZmwv1MdP/h4ZrAhoavOSlWgY0+gV1dkUq0Z//vRAaHogHgcUxLQmn4o LuNw== X-Gm-Message-State: AGRZ1gIjOPgyy866e3HvmalA+OtdLe/hk3Pr9vmTCRRqhQKRGd1y0+Mw Ct8YvKNJemoBFOePtk7tEisQKstvM5Y= X-Received: by 2002:a1c:1692:: with SMTP id 140-v6mr4623257wmw.119.1541433126170; Mon, 05 Nov 2018 07:52:06 -0800 (PST) Received: from localhost.localdomain.com (nat-pool-mxp-t.redhat.com. [149.6.153.186]) by smtp.gmail.com with ESMTPSA id y4-v6sm30729866wrd.61.2018.11.05.07.52.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Nov 2018 07:52:05 -0800 (PST) From: Lorenzo Bianconi To: linux-wireless@vger.kernel.org Cc: nbd@nbd.name, sgruszka@redhat.com, arnd@arndb.de Subject: [PATCH v2] mt76: fix building without CONFIG_LEDS_CLASS Date: Mon, 5 Nov 2018 16:51:47 +0100 Message-Id: <33a74f5182ddf9bf90c883884924dc93547a5fb4.1541432864.git.lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: References: Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Arnd Bergmann 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 --- Changes since v1: - rebased on top of wireless-drivers repository --- 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(-) -- 2.17.2 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 3824290b219d..fd125722d1fb 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c @@ -507,8 +507,10 @@ int mt76x2_register_device(struct mt76x02_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, mt76x02_rates, ARRAY_SIZE(mt76x02_rates));