public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Chester Lin <clin@suse.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Phu Luu An <phu.luuan@nxp.com>,
	Ghennadi Procopciuc <Ghennadi.Procopciuc@oss.nxp.com>,
	Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>,
	Andrei Stefanescu <andrei.stefanescu@nxp.com>
Cc: Arnd Bergmann <arnd@arndb.de>, NXP S32 Linux Team <s32@nxp.com>,
	Matthew Nunez <matthew.nunez@nxp.com>,
	Radu Pirea <radu-nicolae.pirea@nxp.com>,
	Larisa Grigore <larisa.grigore@nxp.com>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] pinctrl: s32cc: fix !CONFIG_PM_SLEEP build error
Date: Fri, 10 Mar 2023 15:02:35 +0100	[thread overview]
Message-ID: <20230310140250.359147-1-arnd@kernel.org> (raw)

From: Arnd Bergmann <arnd@arndb.de>

The declaration of s32_pinctrl_suspend/s32_pinctrl_resume is hidden
in an #ifdef, causing a compilation failure when CONFIG_PM_SLEEP is
disabled:

drivers/pinctrl/nxp/pinctrl-s32g2.c:754:38: error: 's32_pinctrl_suspend' undeclared here (not in a function); did you mean 's32_pinctrl_probe'?
drivers/pinctrl/nxp/pinctrl-s32g2.c:754:9: note: in expansion of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
  754 |         SET_LATE_SYSTEM_SLEEP_PM_OPS(s32_pinctrl_suspend,
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

Remove the bogus #ifdef and __maybe_unused annation on the global
functions, and instead use the proper LATE_SYSTEM_SLEEP_PM_OPS()
macro to pick set the function pointer.

As the function definition is still in the #ifdef block, this leads
to the correct code in all configurations.

Fixes: fd84aaa8173d ("pinctrl: add NXP S32 SoC family support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/pinctrl/nxp/pinctrl-s32.h   | 6 ++----
 drivers/pinctrl/nxp/pinctrl-s32cc.c | 4 ++--
 drivers/pinctrl/nxp/pinctrl-s32g2.c | 3 +--
 3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/pinctrl/nxp/pinctrl-s32.h b/drivers/pinctrl/nxp/pinctrl-s32.h
index b6d530a62051..545bf16b988d 100644
--- a/drivers/pinctrl/nxp/pinctrl-s32.h
+++ b/drivers/pinctrl/nxp/pinctrl-s32.h
@@ -68,8 +68,6 @@ struct s32_pinctrl_soc_info {
 
 int s32_pinctrl_probe(struct platform_device *pdev,
 			struct s32_pinctrl_soc_info *info);
-#ifdef CONFIG_PM_SLEEP
-int __maybe_unused s32_pinctrl_resume(struct device *dev);
-int __maybe_unused s32_pinctrl_suspend(struct device *dev);
-#endif
+int s32_pinctrl_resume(struct device *dev);
+int s32_pinctrl_suspend(struct device *dev);
 #endif /* __DRIVERS_PINCTRL_S32_H */
diff --git a/drivers/pinctrl/nxp/pinctrl-s32cc.c b/drivers/pinctrl/nxp/pinctrl-s32cc.c
index 2c945523af80..e1da332433a3 100644
--- a/drivers/pinctrl/nxp/pinctrl-s32cc.c
+++ b/drivers/pinctrl/nxp/pinctrl-s32cc.c
@@ -658,7 +658,7 @@ static bool s32_pinctrl_should_save(struct s32_pinctrl *ipctl,
 	return false;
 }
 
-int __maybe_unused s32_pinctrl_suspend(struct device *dev)
+int s32_pinctrl_suspend(struct device *dev)
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	struct s32_pinctrl *ipctl = platform_get_drvdata(pdev);
@@ -685,7 +685,7 @@ int __maybe_unused s32_pinctrl_suspend(struct device *dev)
 	return 0;
 }
 
-int __maybe_unused s32_pinctrl_resume(struct device *dev)
+int s32_pinctrl_resume(struct device *dev)
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	struct s32_pinctrl *ipctl = platform_get_drvdata(pdev);
diff --git a/drivers/pinctrl/nxp/pinctrl-s32g2.c b/drivers/pinctrl/nxp/pinctrl-s32g2.c
index 7dd0b4f8904d..5028f4adc389 100644
--- a/drivers/pinctrl/nxp/pinctrl-s32g2.c
+++ b/drivers/pinctrl/nxp/pinctrl-s32g2.c
@@ -751,8 +751,7 @@ static int s32g_pinctrl_probe(struct platform_device *pdev)
 }
 
 static const struct dev_pm_ops s32g_pinctrl_pm_ops = {
-	SET_LATE_SYSTEM_SLEEP_PM_OPS(s32_pinctrl_suspend,
-				     s32_pinctrl_resume)
+	LATE_SYSTEM_SLEEP_PM_OPS(s32_pinctrl_suspend, s32_pinctrl_resume)
 };
 
 static struct platform_driver s32g_pinctrl_driver = {
-- 
2.39.2


             reply	other threads:[~2023-03-10 14:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-10 14:02 Arnd Bergmann [this message]
2023-03-10 16:51 ` [PATCH] pinctrl: s32cc: fix !CONFIG_PM_SLEEP build error Chester Lin
2023-03-10 17:01   ` Arnd Bergmann
2023-03-13 10:20 ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230310140250.359147-1-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=Ghennadi.Procopciuc@oss.nxp.com \
    --cc=andrei.stefanescu@nxp.com \
    --cc=arnd@arndb.de \
    --cc=clin@suse.com \
    --cc=larisa.grigore@nxp.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew.nunez@nxp.com \
    --cc=phu.luuan@nxp.com \
    --cc=radu-nicolae.pirea@nxp.com \
    --cc=s32@nxp.com \
    --cc=stefan-gabriel.mirea@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox