* [PATCH] drm/mediatek: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
@ 2026-08-20 8:56 Triet Hoang
2026-08-20 9:10 ` Markus Elfring
2026-08-20 9:11 ` sashiko-bot
0 siblings, 2 replies; 3+ messages in thread
From: Triet Hoang @ 2026-08-20 8:56 UTC (permalink / raw)
To: chunkuang.hu
Cc: p.zabel, airlied, simona, matthias.bgg, angelogioacchino.delregno,
dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel,
Triet Hoang
Convert the deprecated SIMPLE_DEV_PM_OPS
to DEFINE_SIMPLE_DEV_PM_OPS and pm_sleep_ptr().
This lets us drop the __maybe_unused annotations from its suspend and
resume callbacks, and reduces kernel size in case CONFIG_PM or
CONFIG_PM_SLEEP is disabled.
Signed-off-by: Triet Hoang <triet.hoang.dev@gmail.com>
---
drivers/gpu/drm/mediatek/mtk_hdmi_v2.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c b/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c
index ffe456238a2b..a2acb2d9742e 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c
@@ -1412,7 +1412,7 @@ static const struct hdmi_codec_ops mtk_hdmi_v2_audio_codec_ops = {
.hook_plugged_cb = mtk_hdmi_v2_audio_hook_plugged_cb,
};
-static __maybe_unused int mtk_hdmi_v2_suspend(struct device *dev)
+static int mtk_hdmi_v2_suspend(struct device *dev)
{
struct mtk_hdmi *hdmi = dev_get_drvdata(dev);
@@ -1421,14 +1421,14 @@ static __maybe_unused int mtk_hdmi_v2_suspend(struct device *dev)
return 0;
}
-static __maybe_unused int mtk_hdmi_v2_resume(struct device *dev)
+static int mtk_hdmi_v2_resume(struct device *dev)
{
struct mtk_hdmi *hdmi = dev_get_drvdata(dev);
return mtk_hdmi_v2_enable(hdmi);
}
-static SIMPLE_DEV_PM_OPS(mtk_hdmi_v2_pm_ops, mtk_hdmi_v2_suspend, mtk_hdmi_v2_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(mtk_hdmi_v2_pm_ops, mtk_hdmi_v2_suspend, mtk_hdmi_v2_resume);
static const struct mtk_hdmi_ver_conf mtk_hdmi_conf_v2 = {
.bridge_funcs = &mtk_v2_hdmi_bridge_funcs,
@@ -1511,7 +1511,7 @@ static struct platform_driver mtk_hdmi_v2_driver = {
.driver = {
.name = "mediatek-drm-hdmi-v2",
.of_match_table = mtk_drm_hdmi_v2_of_ids,
- .pm = &mtk_hdmi_v2_pm_ops,
+ .pm = pm_sleep_ptr(&mtk_hdmi_v2_pm_ops),
},
};
module_platform_driver(mtk_hdmi_v2_driver);
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] drm/mediatek: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
2026-08-20 8:56 [PATCH] drm/mediatek: Convert to DEFINE_SIMPLE_DEV_PM_OPS() Triet Hoang
@ 2026-08-20 9:10 ` Markus Elfring
2026-08-20 9:11 ` sashiko-bot
1 sibling, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2026-08-20 9:10 UTC (permalink / raw)
To: Triet Hoang, dri-devel, linux-mediatek, linux-arm-kernel,
Angelo Gioacchino Del Regno, Chun-Kuang Hu, David Airlie,
Matthias Brugger, Philipp Zabel, Simona Vetter
Cc: LKML
…
> This lets us drop the __maybe_unused annotations from its suspend and
…
Thus drop …?
Regards,
Markus
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/mediatek: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
2026-08-20 8:56 [PATCH] drm/mediatek: Convert to DEFINE_SIMPLE_DEV_PM_OPS() Triet Hoang
2026-08-20 9:10 ` Markus Elfring
@ 2026-08-20 9:11 ` sashiko-bot
1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-08-20 9:11 UTC (permalink / raw)
To: Triet Hoang; +Cc: dri-devel
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The patch uses `pm_sleep_ptr()` for the `dev_pm_ops` structure pointer instead of `pm_ptr()`, violating PM subsystem guidelines.
--
--- Patch [1]: [PATCH] drm/mediatek: Convert to DEFINE_SIMPLE_DEV_PM_OPS() ---
commit 400d629fa164bd607d4a5ca22f02d2a6a8f25fe6
Author: Triet Hoang <triet.hoang.dev@gmail.com>
drm/mediatek: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
This commit replaces the deprecated SIMPLE_DEV_PM_OPS with
DEFINE_SIMPLE_DEV_PM_OPS and pm_sleep_ptr(). It removes the __maybe_unused
annotations from the suspend and resume callbacks to reduce kernel size
when PM features are disabled.
> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c b/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c
> index f0277fcf3345b..c1a12c5a0f905 100644
> --- a/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c
> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c
[ ... ]
> @@ -1511,7 +1511,7 @@ static struct platform_driver mtk_hdmi_v2_driver = {
> .driver = {
> .name = "mediatek-drm-hdmi-v2",
> .of_match_table = mtk_drm_hdmi_v2_of_ids,
> - .pm = &mtk_hdmi_v2_pm_ops,
> + .pm = pm_sleep_ptr(&mtk_hdmi_v2_pm_ops),
[Severity: Low]
Should this use pm_ptr() instead of pm_sleep_ptr()?
According to power management guidelines, pm_sleep_ptr() evaluates to NULL
when CONFIG_PM_SLEEP is disabled. If runtime PM callbacks were ever added
to the dev_pm_ops structure in the future, wouldn't using pm_sleep_ptr()
here silently disable those runtime PM callbacks when system sleep is
disabled but CONFIG_PM is still enabled?
The standard pattern is to use pm_sleep_ptr() for the individual sleep
callbacks inside the structure definition, and pm_ptr() for the structure
pointer assignment itself.
> },
> };
> module_platform_driver(mtk_hdmi_v2_driver);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260820085609.2103835-1-triet.hoang.dev@gmail.com?part=1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-20 9:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-20 8:56 [PATCH] drm/mediatek: Convert to DEFINE_SIMPLE_DEV_PM_OPS() Triet Hoang
2026-08-20 9:10 ` Markus Elfring
2026-08-20 9:11 ` sashiko-bot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.