From patchwork Fri Nov 2 09:32:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 150018 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1850962ljp; Fri, 2 Nov 2018 02:32:48 -0700 (PDT) X-Google-Smtp-Source: AJdET5fi9dLg1bR4b9WCJBoC1YC46cqtvGLI75JqsYJvWT9lPoycCyxq5wrfMN1joCT0xQvlkUzh X-Received: by 2002:a63:1f1c:: with SMTP id f28mr10320474pgf.193.1541151168608; Fri, 02 Nov 2018 02:32:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541151168; cv=none; d=google.com; s=arc-20160816; b=DX8CMUch4P4iVEwzRoPd3695/kPepQcDWde+HHp6+hMzGn0ilpmlDv6BrFICG46kG7 GKC87LQWqOmnBhU6QHyIjxnDnJHHsczKcgJigXcWmc9jPP3FjhOA5tgKzEGKMjFY/FuI CE+mAGAzRL45gaxwnXHVVlVq/2BH9iwb0B4h4NVCw2yNVHBSHzRIg90CsZoQtkQHwxAM XjyvnufuxbRY0AwtGUaN7r6BSelYH/qZ2AN9mSLX1iOZxibz7yPRytE/y6eZ8u5cofoQ 9zEX86NDH4XDQTLhbEqsmoOsS2g9AS031oSYG+YbLzbtzJ0Pu7cqCVBcThQLW4Rtt6qo 4r0Q== 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=cDEsRzYPhWsGVE2Frm/pfFQGbOxkLlYK9jCdGqFUq+w=; b=KOEJslmm7SrwvrIPCV1dapuNjDk+Z2ly01OvZtGg8fbcNGZPK9E0FahiWd2IiT+IFV Q00rcoLCL9+O8O32qi3Uqm9hZk7TweJVEz5AYDEhAYhTzKiwMR/G02+McAAd1/qsDT4u NISSI69zumUlICEOB3NHseVvG39Fc1Swqw4iLE4jpQVUx6RSmQGlUcCpWCKszZbnzlKy RTZd0jtwRkFWadMpHyM9sbVfevwrc3CjVyIRtzKP8PhEnoBDh08kxFc4jNPF0TyNSu1Y K2C1tIa25kGr04Q9PhzbKkBjHsJXXT9cYTO+SY39VUeV/AHTZcICwmkei7bWQ1rfRceG ymzQ== 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 r12-v6si32951755pga.346.2018.11.02.02.32.48; Fri, 02 Nov 2018 02:32:48 -0700 (PDT) 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 S1726021AbeKBSjT (ORCPT + 3 others); Fri, 2 Nov 2018 14:39:19 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:41336 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725986AbeKBSjT (ORCPT ); Fri, 2 Nov 2018 14:39:19 -0400 Received: by mail-wr1-f65.google.com with SMTP id x12-v6so1259501wrw.8 for ; Fri, 02 Nov 2018 02:32:46 -0700 (PDT) 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=cDEsRzYPhWsGVE2Frm/pfFQGbOxkLlYK9jCdGqFUq+w=; b=R423da5wegeuj7lyEb6xL+IYKv5jI84zbD4y3dODllfeT29O/7GfdsSbdNQeb4aoIt lxdsOWr6LOrlo0DzMKHc70Otw1tcGxvtggQqGzdaQuvFLGUxh0w/d/XUktxApDZKGNUv zt7F5qP0LOZOuKTnAprvep2nWmmW8/N2HE1FXOJ9sEezJJeCDEOXwYTvKtkZn5zpvNAX PACu3sH42CWADX0qPrpjdY9IMv5ZtG6p0z9HRMue2MIDqxOb+xTMwejSPCChqzNlt+Xi MQGoRF/uzcTji6dkP2yMQPiQNKWiCpVaoWAmISmu28Xh6yFmvNUPULJA+jfUGCJJQ0Ud LQyw== X-Gm-Message-State: AGRZ1gJDUtd7udNeLwQhA7RkfgHtwf+eXhyPAXvJHWh+hqumrK3ogh09 UljX6XEYvClbi7Pp8eWo3V7ZDA== X-Received: by 2002:adf:f748:: with SMTP id z8-v6mr586116wrp.237.1541151165480; Fri, 02 Nov 2018 02:32:45 -0700 (PDT) Received: from localhost.localdomain.com (nat-pool-mxp-t.redhat.com. [149.6.153.186]) by smtp.gmail.com with ESMTPSA id o126-v6sm21452848wmo.3.2018.11.02.02.32.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Nov 2018 02:32:44 -0700 (PDT) From: Lorenzo Bianconi To: nbd@nbd.name Cc: sgruszka@redhat.com, linux-wireless@vger.kernel.org, arnd@arndb.de Subject: [PATCH] mt76: fix building without CONFIG_LEDS_CLASS Date: Fri, 2 Nov 2018 10:32:32 +0100 Message-Id: <5d0d7286445acef822a806dc89fcbf9eb2672ade.1541150589.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 --- 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 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));