From patchwork Thu Sep 15 15:46:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101778 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp22182qgf; Thu, 15 Sep 2016 08:47:39 -0700 (PDT) X-Received: by 10.98.9.210 with SMTP id 79mr15637688pfj.33.1473954459580; Thu, 15 Sep 2016 08:47:39 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h64si3470491pfk.87.2016.09.15.08.47.39 for ; Thu, 15 Sep 2016 08:47:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-spi-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-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-spi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754400AbcIOPra (ORCPT ); Thu, 15 Sep 2016 11:47:30 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:63911 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754165AbcIOPr3 (ORCPT ); Thu, 15 Sep 2016 11:47:29 -0400 Received: from wuerfel.lan. ([78.43.20.153]) by mrelayeu.kundenserver.de (mreue005) with ESMTPA (Nemesis) id 0Mh8wH-1bOmuI2B97-00MIUY; Thu, 15 Sep 2016 17:47:15 +0200 From: Arnd Bergmann To: Mark Brown Cc: Arnd Bergmann , Kamal Dasu , Yendapally Reddy Dhananjaya Reddy , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] spi: bcm-qspi: fix suspend/resume #ifdef Date: Thu, 15 Sep 2016 17:46:53 +0200 Message-Id: <20160915154712.3007781-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:4p1lV/P3nEsD/cB55N5ZumJgIjAIsV8u+DhpbOANusFcnqE6vRQ aBS7HN2wmyqlNNOm0B3nCMteq019KCPlgsGs+EU96xzfMPFvd71+PPXzmuL+3NuK4XId10d EMBI8hZRznU8gnnmd1EP6GPaVgp5kxVjUkFgPfD3F6WsnAZ7HTssLkhWxLcuBBkpNhWlgnL tQUr2sWPqcOP+11JteW2w== X-UI-Out-Filterresults: notjunk:1; V01:K0:y6Bt9Hv9kZs=:Ra85Yl7hU+/KFaavSDHDtx J9r7+Yp3eb8jrT/ly+8lK0Qo8Z2y9Zd9MYL9mjY2oqocazeEfhL/08S+yL1NFaIVn7zS5LPpO w+jlPhaZHz5B1lBN4dy6zkxq9AZxosAfJ/YCVVOwEKKTbRNvTcMeYm0jc8hj7WtPH2q1Uh+fK fCQ16hAAc1phSk9UxlE35yI8PGTLCyyA8Vh4/pfAEJd3ZvM0cq88lr7BESSRvN+FISLQEIRW9 nLVr54dgmW81Nyptza9UjRTE1U6tNlGOAWopj2/k0LXSFbWRjUmwidekaaGkRpzmBunXZ9GeU ju7p8YRdKvhpIdFtZAaAs/giP2UQtsFcSilElycNISQB1r+kqYlXuIvEw1QUZt+nkfuaqfRwQ x+jiJ2boBjqc6Q8QO2cD0xL/0xKiWXLMS/9DAyoyFGs40hS+KqGULwPPqtuHKI2CW9tGmGvr3 UNpqonKhHZFxZ2IcnTMPUhOcDyN8ESBneJklkDmupKp6J/wlUBPldQlpNuH3mLOb8mMREFdu6 2HX5VbXSCaawva6cLeHxwPTJuTumWnD4ghMCwMFyj1MTd3cysO5UfGhKllYTrlDreVxaWLa3v UoV2dFcLljBq/xsD/kdu4TcgpeBKnYNC3VS/bgOGgGuaEusBMxN1k4hlyJ7ZFbOYIWFzSfuPN 5rf5M7650CpT6BcMqy65jSyHeW9SPaq21LoY2GRAmsKQlAncczkpwB/hfpIt+vyJaW+4= Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org The two power management functions are define inside of an #ifdef but referenced unconditionally, which is obviously broken when CONFIG_PM_SLEEP is not set: drivers/spi/spi-bcm-qspi.c:1300:13: error: 'bcm_qspi_suspend' undeclared here (not in a function) drivers/spi/spi-bcm-qspi.c:1301:13: error: 'bcm_qspi_resume' undeclared here (not in a function) This replaces the #ifdef with a __maybe_unused annotation that lets the compiler figure out whether to drop the functions itself, and uses SIMPLE_DEV_PM_OPS() to refer to the functions. This will also fill the freeze/thaw/poweroff/restore callback pointers in addition to suspend/resume, but as far as I can tell, this is what we want. Signed-off-by: Arnd Bergmann Fixes: fa236a7ef240 ("spi: bcm-qspi: Add Broadcom MSPI driver") --- drivers/spi/spi-bcm-qspi.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) -- 2.9.0 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/spi/spi-bcm-qspi.c b/drivers/spi/spi-bcm-qspi.c index 5da182be073e..64e693de1486 100644 --- a/drivers/spi/spi-bcm-qspi.c +++ b/drivers/spi/spi-bcm-qspi.c @@ -1268,8 +1268,7 @@ int bcm_qspi_remove(struct platform_device *pdev) /* function to be called by SoC specific platform driver remove() */ EXPORT_SYMBOL_GPL(bcm_qspi_remove); -#ifdef CONFIG_PM_SLEEP -static int bcm_qspi_suspend(struct device *dev) +static int __maybe_unused bcm_qspi_suspend(struct device *dev) { struct bcm_qspi *qspi = dev_get_drvdata(dev); @@ -1280,7 +1279,7 @@ static int bcm_qspi_suspend(struct device *dev) return 0; }; -static int bcm_qspi_resume(struct device *dev) +static int __maybe_unused bcm_qspi_resume(struct device *dev) { struct bcm_qspi *qspi = dev_get_drvdata(dev); int ret = 0; @@ -1293,12 +1292,9 @@ static int bcm_qspi_resume(struct device *dev) return ret; } -#endif /* CONFIG_PM_SLEEP */ -const struct dev_pm_ops bcm_qspi_pm_ops = { - .suspend = bcm_qspi_suspend, - .resume = bcm_qspi_resume, -}; +SIMPLE_DEV_PM_OPS(bcm_qspi_pm_ops, bcm_qspi_suspend, bcm_qspi_resume); + /* pm_ops to be called by SoC specific platform driver */ EXPORT_SYMBOL_GPL(bcm_qspi_pm_ops);