From patchwork Wed Mar 2 15:59:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 8483051 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C2395C0553 for ; Wed, 2 Mar 2016 16:02:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D3DF5200E8 for ; Wed, 2 Mar 2016 16:02:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E9F7D20398 for ; Wed, 2 Mar 2016 16:02:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932145AbcCBQAx (ORCPT ); Wed, 2 Mar 2016 11:00:53 -0500 Received: from mout.kundenserver.de ([212.227.17.24]:61285 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932099AbcCBQAv (ORCPT ); Wed, 2 Mar 2016 11:00:51 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue103) with ESMTPA (Nemesis) id 0MP2NL-1aUpng2zwd-006KYI; Wed, 02 Mar 2016 17:00:19 +0100 From: Arnd Bergmann To: Solomon Peachy , Kalle Valo Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 10/14] wireless: cw1200: use __maybe_unused to hide pm functions_ Date: Wed, 2 Mar 2016 16:59:02 +0100 Message-Id: <1456934350-1389172-11-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1456934350-1389172-1-git-send-email-arnd@arndb.de> References: <1456934350-1389172-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:p8aMqJH87b5UuRBZKNODGj92QwY6n6rwjL6oo5bNnLsg6a2E9B0 a4Tc3dAH0dbt33IwrzZm+/CVwQ4x+3GOnxrCycovCxmZRXrBQNLjjI2rzauzM+t1DDhZMDa +NCQkC+EYXnyCvPScAeWvkxrjFaOTzLbCb8KnQ3GS660ToLZYuzvfHHeHhErzvJbEfxIO78 iAlAuaX+Jx/NvQotJIvwg== X-UI-Out-Filterresults: notjunk:1; V01:K0:tGATYwamzD4=:AVDVANBco9LTxvivPYEQrO s+j8NhDNVS+IpUloqna98rShdLuUBRztSR6YSQlP4exJpPfggJJD3dhi0dgRslTZYWlJ61//I o4Jsmfq6/PXAnqlSYAKZ3O0BNZfLcjzPyniLdgfD5ZAFerOtjaGffH2oO9wx6czaBA5QZhsT7 9tFAEwzAWlsf7trpfrqzw89nYpcRyHi6nvKudzPrG5tA80/0epAAmfAteFFMhwE35ajp27dPK fxJOvxjNYt3NbQj6kTUTSMCzg6eWnXMf7xP0szcxHasl03a+b3Z1p0fB2MT7cuJCWA8C47Lx2 mOu8/Da5nU90sjWDXQurVbF8des9cEWKMibZwfNsivjhsLEJdRHKxUZ0qUc61iL3DWqKZ8v1A NQs03pOZB8oKA6vEe0kUto27g44jEtOj6GfydK4PyGrxq515I0L8nsiFZbqmz1vZxkjEMl2W0 ZPRBDlln6UO0kX/ixv6VcFITsFRDWt4PmapPGs5eOYM8f0VvBQGKnlxlIl74W4M9pAuKbv7lJ +YIfq7g9FioYNov23Of2zzKpQD6SzO2C9FnfGZpzy4hONKeHOPBapm2XyrUFUwN2qliBY9IED pa1NbGK0XrQDK5RLJQ72igW97J+AdolD6PBeLwV94tL93E+o7I0HEMXIsYETgmowjNZXtQJRN QFrn9O/3Ep19muGOzYgR+HRp9qLAyGMXL65jlNU4KFM2LOzNxqhu9rcBTScxhkt6jXng= Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/net/wireless/st/cw1200/cw1200_spi.c | 9 ++------- drivers/net/wireless/st/cw1200/pm.h | 9 +++++++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/st/cw1200/cw1200_spi.c b/drivers/net/wireless/st/cw1200/cw1200_spi.c index a740083634d8..63f95e9c2992 100644 --- a/drivers/net/wireless/st/cw1200/cw1200_spi.c +++ b/drivers/net/wireless/st/cw1200/cw1200_spi.c @@ -446,8 +446,7 @@ static int cw1200_spi_disconnect(struct spi_device *func) 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 device *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, }, }; diff --git a/drivers/net/wireless/st/cw1200/pm.h b/drivers/net/wireless/st/cw1200/pm.h index 3ed90ff22bb8..534548470ebc 100644 --- a/drivers/net/wireless/st/cw1200/pm.h +++ b/drivers/net/wireless/st/cw1200/pm.h @@ -31,13 +31,18 @@ int cw1200_pm_init(struct cw1200_pm_state *pm, 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