* [PATCH] drm/tegra: vic: fix unused-function warnings
[not found] <20220316183708.1505846-1-arnd@kernel.org>
@ 2022-03-16 18:36 ` Arnd Bergmann
2022-04-06 13:21 ` Thierry Reding
0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2022-03-16 18:36 UTC (permalink / raw)
To: Thierry Reding, David Airlie, Daniel Vetter, Jonathan Hunter,
Dmitry Osipenko, Ulf Hansson
Cc: Arnd Bergmann, Mikko Perttunen, Robin Murphy, dri-devel,
linux-tegra, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
The use of the old-style SET_RUNTIME_PM_OPS() and
SET_SYSTEM_SLEEP_PM_OPS() macros requires function definitions
to be hidden to avoid
drivers/gpu/drm/tegra/vic.c:326:12: error: 'vic_runtime_suspend' defined but not used [-Werror=unused-function]
326 | static int vic_runtime_suspend(struct device *dev)
| ^~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/tegra/vic.c:292:12: error: 'vic_runtime_resume' defined but not used [-Werror=unused-function]
292 | static int vic_runtime_resume(struct device *dev)
| ^~~~~~~~~~~~~~~~~~
Use the new-style SYSTEM_SLEEP_PM_OPS() and RUNTIME_PM_OPS() instead.
Fixes: 1e15f5b911d6 ("drm/tegra: vic: Stop channel on suspend")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/gpu/drm/tegra/vic.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
I see this warning on 5.17-rc8, but did not test it on linux-next,
which may already have a fix.
diff --git a/drivers/gpu/drm/tegra/vic.c b/drivers/gpu/drm/tegra/vic.c
index 1e342fa3d27b..f56f5921a8c2 100644
--- a/drivers/gpu/drm/tegra/vic.c
+++ b/drivers/gpu/drm/tegra/vic.c
@@ -513,9 +513,8 @@ static int vic_remove(struct platform_device *pdev)
}
static const struct dev_pm_ops vic_pm_ops = {
- SET_RUNTIME_PM_OPS(vic_runtime_suspend, vic_runtime_resume, NULL)
- SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
- pm_runtime_force_resume)
+ RUNTIME_PM_OPS(vic_runtime_suspend, vic_runtime_resume, NULL)
+ SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
};
struct platform_driver tegra_vic_driver = {
--
2.29.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/tegra: vic: fix unused-function warnings
2022-03-16 18:36 ` [PATCH] drm/tegra: vic: fix unused-function warnings Arnd Bergmann
@ 2022-04-06 13:21 ` Thierry Reding
2022-04-06 15:51 ` Arnd Bergmann
0 siblings, 1 reply; 3+ messages in thread
From: Thierry Reding @ 2022-04-06 13:21 UTC (permalink / raw)
To: Arnd Bergmann
Cc: David Airlie, Daniel Vetter, Jonathan Hunter, Dmitry Osipenko,
Ulf Hansson, Arnd Bergmann, Mikko Perttunen, Robin Murphy,
dri-devel, linux-tegra, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2263 bytes --]
On Wed, Mar 16, 2022 at 07:36:47PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The use of the old-style SET_RUNTIME_PM_OPS() and
> SET_SYSTEM_SLEEP_PM_OPS() macros requires function definitions
> to be hidden to avoid
>
> drivers/gpu/drm/tegra/vic.c:326:12: error: 'vic_runtime_suspend' defined but not used [-Werror=unused-function]
> 326 | static int vic_runtime_suspend(struct device *dev)
> | ^~~~~~~~~~~~~~~~~~~
> drivers/gpu/drm/tegra/vic.c:292:12: error: 'vic_runtime_resume' defined but not used [-Werror=unused-function]
> 292 | static int vic_runtime_resume(struct device *dev)
> | ^~~~~~~~~~~~~~~~~~
>
> Use the new-style SYSTEM_SLEEP_PM_OPS() and RUNTIME_PM_OPS() instead.
>
> Fixes: 1e15f5b911d6 ("drm/tegra: vic: Stop channel on suspend")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/gpu/drm/tegra/vic.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> I see this warning on 5.17-rc8, but did not test it on linux-next,
> which may already have a fix.
>
> diff --git a/drivers/gpu/drm/tegra/vic.c b/drivers/gpu/drm/tegra/vic.c
> index 1e342fa3d27b..f56f5921a8c2 100644
> --- a/drivers/gpu/drm/tegra/vic.c
> +++ b/drivers/gpu/drm/tegra/vic.c
> @@ -513,9 +513,8 @@ static int vic_remove(struct platform_device *pdev)
> }
>
> static const struct dev_pm_ops vic_pm_ops = {
> - SET_RUNTIME_PM_OPS(vic_runtime_suspend, vic_runtime_resume, NULL)
> - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
> - pm_runtime_force_resume)
> + RUNTIME_PM_OPS(vic_runtime_suspend, vic_runtime_resume, NULL)
> + SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
> };
>
> struct platform_driver tegra_vic_driver = {
Hi Arnd,
is this a replacement for __maybe_unused annotations that we would
typically use to address these? Is the ternary operator in PTR_IF enough
to eliminate the warning? Does that work the same way for structure
definitions as it does for conditionals where we use IS_ENABLED() to use
the compiler's DCE for improved coverage?
It looks like it, but just making sure because there's another patch
that fixes this warning by adding __maybe_unused.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/tegra: vic: fix unused-function warnings
2022-04-06 13:21 ` Thierry Reding
@ 2022-04-06 15:51 ` Arnd Bergmann
0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2022-04-06 15:51 UTC (permalink / raw)
To: Thierry Reding
Cc: David Airlie, Daniel Vetter, Jonathan Hunter, Dmitry Osipenko,
Ulf Hansson, Arnd Bergmann, Mikko Perttunen, Robin Murphy,
dri-devel, open list:TEGRA ARCHITECTURE SUPPORT,
Linux Kernel Mailing List
On Wed, Apr 6, 2022 at 3:21 PM Thierry Reding <thierry.reding@gmail.com> wrote:
> On Wed, Mar 16, 2022 at 07:36:47PM +0100, Arnd Bergmann wrote:
> > static const struct dev_pm_ops vic_pm_ops = {
> > - SET_RUNTIME_PM_OPS(vic_runtime_suspend, vic_runtime_resume, NULL)
> > - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
> > - pm_runtime_force_resume)
> > + RUNTIME_PM_OPS(vic_runtime_suspend, vic_runtime_resume, NULL)
> > + SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
> > };
> >
> > struct platform_driver tegra_vic_driver = {
>
> Hi Arnd,
>
> is this a replacement for __maybe_unused annotations that we would
> typically use to address these? Is the ternary operator in PTR_IF enough
> to eliminate the warning? Does that work the same way for structure
> definitions as it does for conditionals where we use IS_ENABLED() to use
> the compiler's DCE for improved coverage?
Yes to all three.
> It looks like it, but just making sure because there's another patch
> that fixes this warning by adding __maybe_unused.
I sent a lot of patches in the past to add __maybe_unused, but this was
mainly because we could never come up with a good replacement.
Paul Cercueil has finally come up with a good solution, so this is how
we should do it from now on.
Arnd
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-04-06 17:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20220316183708.1505846-1-arnd@kernel.org>
2022-03-16 18:36 ` [PATCH] drm/tegra: vic: fix unused-function warnings Arnd Bergmann
2022-04-06 13:21 ` Thierry Reding
2022-04-06 15:51 ` Arnd Bergmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox