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: 9334121 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 857F9607FD for ; Thu, 15 Sep 2016 15:47:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A234299D7 for ; Thu, 15 Sep 2016 15:47:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6EA4E299DE; Thu, 15 Sep 2016 15:47:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C7402299D7 for ; Thu, 15 Sep 2016 15:47:34 +0000 (UTC) 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 X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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);