From patchwork Wed Mar 2 15:58:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102617 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2460936lbc; Wed, 2 Mar 2016 08:01:54 -0800 (PST) X-Received: by 10.98.11.217 with SMTP id 86mr39067429pfl.71.1456934514355; Wed, 02 Mar 2016 08:01:54 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id d80si33086765pfj.215.2016.03.02.08.01.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Mar 2016 08:01:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ab9Co-00028s-L4; Wed, 02 Mar 2016 16:00:54 +0000 Received: from mout.kundenserver.de ([212.227.17.13]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ab9C9-0000Sm-3k for linux-arm-kernel@lists.infradead.org; Wed, 02 Mar 2016 16:00:17 +0000 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue103) with ESMTPA (Nemesis) id 0LfY1R-1a8S8C1q3t-00p3Hk; Wed, 02 Mar 2016 16:59:49 +0100 From: Arnd Bergmann To: Sebastian Reichel , Dmitry Eremin-Solenikov , David Woodhouse Subject: [PATCH 04/14] power: pm2301-charger: use __maybe_unused to hide pm functions Date: Wed, 2 Mar 2016 16:58:56 +0100 Message-Id: <1456934350-1389172-5-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:q/d50msHGWJEWOZCac4D+fMZLdV8699O5nrUVplAk9/qG/slgdt pGmXs+owt35nTgpYw/VXH0sbw+yvvqXHhB7rRLDITnpxEf3ua8ilHwpVldTW51eTmgkofMk aGHKeCgvcy+Btcam9WgF15l/prs91k9K+xg8BcHnXGjKRGFy5tDIi/1Heto/sA12SBmZQWT cjoawuJ5rUjQtUSGPDD+A== X-UI-Out-Filterresults: notjunk:1; V01:K0:l0AX95QIZ40=:B7/uKtRPpQXlg0l2etBh0Y tICaPtl88chp2DZJhkIxthJRKoET2G2+nDdjcer9qCh3lVn557evO2gCc/7zgIDzcKb2ex15F eY3R1ui//W5foou1aW6TrayJJrSzm0siaHkteMXR4ya2wUc/m3b3CZ/ipKlxA93+cEa2qjbVz eP54pkyrxrcxzj9CgF9i8OBC79SUeioC5VAIvqprr+g4Q1vj1mkFFxLM6AnVO1OaGL50VvdUb /smNQnNLOs8uJXNcXkPRXk44Iv+ct82LGcrMbFtioxkoAp5z31Ixw9Glqxmm4h19a8XltX15z Y3ymIuaQHawGfQWGVlZIW2de/b7B/ITNELpc2TE/TMDLb2VwrZ6hngOE9HnyM2S7lAjspJiyh DjHNd4y/TDq9WGbmQduKyIe5Hyvdxgj2oF8NEJb211Syk4SpI+rE0MyrflONG98XlujobwvRT og+bf09e+XeoxvwRhIFtbL6/q67Ankilc85FMPRB94ZGSgOhdsbUi1R9hPykD1KSG09hBHvkG B8MfjN7tbJxjXv+CYceJdss2TBZu81pHPLi6zLSJIhqahsNnwoFoq81HDv9SEmG9K0LEjd+NI UhITfrKp9TyKHToS2lVGSC/sGk6N21ak16unApo/nqSQM5HO3K4YGC8VYd2v07ZR3WNZJJouM /0lQds3Mum/JfHYxp4jisGzO+hyhKMdEhF+bz5gR29u4Ch3pSFC6qzGXq3OB+6BUVrCo= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160302_080013_746520_FEF6EA52 X-CRM114-Status: GOOD ( 14.87 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [212.227.17.13 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [212.227.17.13 listed in wl.mailspike.net] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org The pm2301 charger driver uses nested #ifdefs to check for both CONFIG_PM and CONFIG_PM_SLEEP in an attempt to hide its suspend and runtime-pm operations when they are unused, but it does not hide the clear_lpn_pin() function in the same way, so we get a build warning when everything is disabled: drivers/power/pm2301_charger.c:123:13: error: 'clear_lpn_pin' defined but not used [-Werror=unused-function] This removes all the #ifdef and instead uses __maybe_unused annotations to let the compiler know it can silently drop the function definition. For the PM2XXX_PM_OPS, 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/power/pm2301_charger.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) -- 2.7.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/drivers/power/pm2301_charger.c b/drivers/power/pm2301_charger.c index 8f9bd1d0eeb6..fb62ed3fc38c 100644 --- a/drivers/power/pm2301_charger.c +++ b/drivers/power/pm2301_charger.c @@ -911,11 +911,7 @@ static struct pm2xxx_irq pm2xxx_charger_irq[] = { {"PM2XXX_IRQ_INT", pm2xxx_irq_int}, }; -#ifdef CONFIG_PM - -#ifdef CONFIG_PM_SLEEP - -static int pm2xxx_wall_charger_resume(struct device *dev) +static int __maybe_unused pm2xxx_wall_charger_resume(struct device *dev) { struct i2c_client *i2c_client = to_i2c_client(dev); struct pm2xxx_charger *pm2; @@ -931,7 +927,7 @@ static int pm2xxx_wall_charger_resume(struct device *dev) return 0; } -static int pm2xxx_wall_charger_suspend(struct device *dev) +static int __maybe_unused pm2xxx_wall_charger_suspend(struct device *dev) { struct i2c_client *i2c_client = to_i2c_client(dev); struct pm2xxx_charger *pm2; @@ -949,9 +945,7 @@ static int pm2xxx_wall_charger_suspend(struct device *dev) return 0; } -#endif - -static int pm2xxx_runtime_suspend(struct device *dev) +static int __maybe_unused pm2xxx_runtime_suspend(struct device *dev) { struct i2c_client *pm2xxx_i2c_client = to_i2c_client(dev); struct pm2xxx_charger *pm2; @@ -962,7 +956,7 @@ static int pm2xxx_runtime_suspend(struct device *dev) return 0; } -static int pm2xxx_runtime_resume(struct device *dev) +static int __maybe_unused pm2xxx_runtime_resume(struct device *dev) { struct i2c_client *pm2xxx_i2c_client = to_i2c_client(dev); struct pm2xxx_charger *pm2; @@ -975,15 +969,11 @@ static int pm2xxx_runtime_resume(struct device *dev) return 0; } -static const struct dev_pm_ops pm2xxx_pm_ops = { +static const struct dev_pm_ops pm2xxx_pm_ops __maybe_unused = { SET_SYSTEM_SLEEP_PM_OPS(pm2xxx_wall_charger_suspend, pm2xxx_wall_charger_resume) SET_RUNTIME_PM_OPS(pm2xxx_runtime_suspend, pm2xxx_runtime_resume, NULL) }; -#define PM2XXX_PM_OPS (&pm2xxx_pm_ops) -#else -#define PM2XXX_PM_OPS NULL -#endif static int pm2xxx_wall_charger_probe(struct i2c_client *i2c_client, const struct i2c_device_id *id) @@ -1244,7 +1234,7 @@ static struct i2c_driver pm2xxx_charger_driver = { .remove = pm2xxx_wall_charger_remove, .driver = { .name = "pm2xxx-wall_charger", - .pm = PM2XXX_PM_OPS, + .pm = IS_ENABLED(CONFIG_PM) ? &pm2xxx_pm_ops : NULL, }, .id_table = pm2xxx_id, };