Received: by 10.223.185.116 with SMTP id b49csp1032227wrg; Fri, 23 Feb 2018 10:40:25 -0800 (PST) X-Google-Smtp-Source: AH8x227JS3s5gYl0BFHMXzGLI7Sn+7ackCsbByRY2tFYw+RJI4kqX+HtkIGdiOF42R3PaRlHaYPG X-Received: by 2002:a17:902:10d:: with SMTP id 13-v6mr2528409plb.266.1519411225679; Fri, 23 Feb 2018 10:40:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519411225; cv=none; d=google.com; s=arc-20160816; b=USw9udtpR7CvE9VmOn9BcpYiuk3BJm7RZxHy0LxuBioNOx64f8cLFD/8Bsz2+JMn3t sKaj/PpipxtTX3oCveLSQkZvTKYrmb5ttQnkYr7YFwEbQZSATIHq6MgWyY55ar6AaI+E b3z15924GvhdFlbp2NSPTnuOn7QhKqDIZ3S8vNjlRUs9rgPdwVbknaQKX9mDiPpTklV5 e+LjEoFY3MuFKVJumJypzOAdgyu42hVSghmfJsczDFwCIAsZRLsZG6gQhN/3h72nPlCh UF3MoRXhQpR12k0n8zL4f94LiF1EoAPhAwJLjHcJvnAQeCZ6BUw5DwDPennvqzwahzxQ reAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=gNWgNaMgj93FnEqvnI0LBCd/bROy5z0lxsR5qmQthp0=; b=fpcbENhsZuKrGBOfMxint4AU83tgcKQgPN8qYBY0co1w98PwKDoIPwm6TA0OjDfsgo Vg5GjZqzlMRD5RX4tA2X666EQKsnWQjAPRjpNzvnMd5eHhoibhLT/uIcUWS0lOAk3YaI Zv91d16rkx2Z8znbYIaVwaZkSnIq/gg56LyEvbyVuHWvl8wrKDecHPWylyK9c/GOTHD5 6LaO6n9bDROy35ZI5ymvZFgiBbANJhdqsnhdrjiKXwl1tJEhIgrx3eJLhCI343PKHQUE xzInnMhDeMmjMb8Ku4xIHvDP6e9ySInbHsWKhu9fEkb8h8dnTGia7+MC1qo/8o97tIdd 8ijg== 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 g11si2210670pfd.272.2018.02.23.10.40.11; Fri, 23 Feb 2018 10:40:25 -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 S1754359AbeBWSja (ORCPT + 99 others); Fri, 23 Feb 2018 13:39:30 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:39698 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753559AbeBWSj1 (ORCPT ); Fri, 23 Feb 2018 13:39:27 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id C1EAF11AC; Fri, 23 Feb 2018 18:39:26 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Kalle Valo Subject: [PATCH 4.4 143/193] wireless: cw1200: use __maybe_unused to hide pm functions_ Date: Fri, 23 Feb 2018 19:26:16 +0100 Message-Id: <20180223170348.255073308@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180223170325.997716448@linuxfoundation.org> References: <20180223170325.997716448@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Arnd Bergmann commit 836856e3bd61d0644e5178a2c1b51d90459e2788 upstream. The cw1200 uses #ifdef to check for CONFIG_PM, but then uses SIMPLE_DEV_PM_OPS, which leaves the references out when CONFIG_PM_SLEEP is not defined, so we get a warning with PM=y && PM_SLEEP=n: drivers/net/wireless/st/cw1200/cw1200_spi.c:450:12: error: 'cw1200_spi_suspend' defined but not used [-Werror=unused-function] This removes the incorrect #ifdef and instead uses a __maybe_unused annotation to let the compiler know it can silently drop the function definition. For the DEV_PM_OPS definition, we can use an IS_ENABLED() check to avoid defining the structure when CONFIG_PM is not set without the #ifdef. Signed-off-by: Arnd Bergmann Signed-off-by: Kalle Valo Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/cw1200/cw1200_spi.c | 9 ++------- drivers/net/wireless/cw1200/pm.h | 9 +++++++-- 2 files changed, 9 insertions(+), 9 deletions(-) --- a/drivers/net/wireless/cw1200/cw1200_spi.c +++ b/drivers/net/wireless/cw1200/cw1200_spi.c @@ -446,8 +446,7 @@ static int cw1200_spi_disconnect(struct return 0; } -#ifdef CONFIG_PM -static int cw1200_spi_suspend(struct device *dev) +static int __maybe_unused cw1200_spi_suspend(struct device *dev) { struct hwbus_priv *self = spi_get_drvdata(to_spi_device(dev)); @@ -460,16 +459,12 @@ static int cw1200_spi_suspend(struct dev static SIMPLE_DEV_PM_OPS(cw1200_pm_ops, cw1200_spi_suspend, NULL); -#endif - static struct spi_driver spi_driver = { .probe = cw1200_spi_probe, .remove = cw1200_spi_disconnect, .driver = { .name = "cw1200_wlan_spi", -#ifdef CONFIG_PM - .pm = &cw1200_pm_ops, -#endif + .pm = IS_ENABLED(CONFIG_PM) ? &cw1200_pm_ops : NULL, }, }; --- a/drivers/net/wireless/cw1200/pm.h +++ b/drivers/net/wireless/cw1200/pm.h @@ -31,13 +31,18 @@ int cw1200_pm_init(struct cw1200_pm_stat void cw1200_pm_deinit(struct cw1200_pm_state *pm); int cw1200_wow_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan); -int cw1200_wow_resume(struct ieee80211_hw *hw); int cw1200_can_suspend(struct cw1200_common *priv); +int cw1200_wow_resume(struct ieee80211_hw *hw); void cw1200_pm_stay_awake(struct cw1200_pm_state *pm, unsigned long tmo); #else static inline void cw1200_pm_stay_awake(struct cw1200_pm_state *pm, - unsigned long tmo) { + unsigned long tmo) +{ +} +static inline int cw1200_can_suspend(struct cw1200_common *priv) +{ + return 0; } #endif #endif