* [PATCH] accel: habanalabs: pm: use SIMPLE_DEV_OPS for pm struct
@ 2026-08-19 6:59 Li Jun
2026-08-20 8:57 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Li Jun @ 2026-08-19 6:59 UTC (permalink / raw)
To: lijun01, koby.elbaz, konstantin.sinyuk, ogabbay, dri-devel
use SIMPLE_DEV_PM_OPS for hl_pm_ops,and add the value of
.freeze .thaw .poweroff .restore.if these address are null, may cause
error in s4.
Signed-off-by: Li Jun <lijun01@kylinos.cn>
---
drivers/accel/habanalabs/common/habanalabs_drv.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/accel/habanalabs/common/habanalabs_drv.c b/drivers/accel/habanalabs/common/habanalabs_drv.c
index 483e1ad9fc41..f3f01a5336a9 100644
--- a/drivers/accel/habanalabs/common/habanalabs_drv.c
+++ b/drivers/accel/habanalabs/common/habanalabs_drv.c
@@ -706,10 +706,7 @@ static void hl_pci_reset_done(struct pci_dev *pdev)
hl_device_reset(hdev, flags);
}
-static const struct dev_pm_ops hl_pm_ops = {
- .suspend = hl_pmops_suspend,
- .resume = hl_pmops_resume,
-};
+static SIMPLE_DEV_PM_OPS(hl_pm_ops, hl_pmops_suspend, hl_pmops_resume);
static const struct pci_error_handlers hl_pci_err_handler = {
.error_detected = hl_pci_err_detected,
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] accel: habanalabs: pm: use SIMPLE_DEV_OPS for pm struct
2026-08-19 6:59 [PATCH] accel: habanalabs: pm: use SIMPLE_DEV_OPS for pm struct Li Jun
@ 2026-08-20 8:57 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-08-20 8:57 UTC (permalink / raw)
To: Li Jun; +Cc: dri-devel
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The patch uses the explicitly deprecated `SIMPLE_DEV_PM_OPS` macro, introducing `-Wunused-function` compiler warnings when `CONFIG_PM_SLEEP` is disabled.
--
--- Patch [1]: [PATCH] accel: habanalabs: pm: use SIMPLE_DEV_OPS for pm struct ---
commit 7be438c53b791de9d91a0802f0d42bfdaf8018e9
Author: Li Jun <lijun01@kylinos.cn>
accel: habanalabs: pm: use SIMPLE_DEV_OPS for pm struct
This commit replaces the manual assignment of dev_pm_ops with the
SIMPLE_DEV_PM_OPS macro to ensure the freeze, thaw, poweroff, and restore
callbacks are properly assigned and to prevent errors in s4.
> diff --git a/drivers/accel/habanalabs/common/habanalabs_drv.c b/drivers/accel/habanalabs/common/habanalabs_drv.c
> index 220954d730136..ca316f495fe61 100644
> --- a/drivers/accel/habanalabs/common/habanalabs_drv.c
> +++ b/drivers/accel/habanalabs/common/habanalabs_drv.c
> @@ -1630,10 +1630,7 @@ static void hl_pci_reset_done(struct pci_dev *pdev)
> hl_device_reset(hdev, flags);
> }
>
> -static const struct dev_pm_ops hl_pm_ops = {
> - .suspend = hl_pmops_suspend,
> - .resume = hl_pmops_resume,
> -};
> +static SIMPLE_DEV_PM_OPS(hl_pm_ops, hl_pmops_suspend, hl_pmops_resume);
[Severity: Low]
Will this introduce -Wunused-function warnings for hl_pmops_suspend() and
hl_pmops_resume() when the kernel is built with CONFIG_PM_SLEEP disabled?
Since SIMPLE_DEV_PM_OPS evaluates to empty when CONFIG_PM_SLEEP=n, and the
callback functions lack the __maybe_unused attribute, they become completely
unreferenced.
Would it be better to use the modern DEFINE_SIMPLE_DEV_PM_OPS() macro
instead, which uses pm_sleep_ptr() to safely drop the references without
triggering compiler warnings?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260819065917.2488984-1-lijun01@kylinos.cn?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-20 8:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-19 6:59 [PATCH] accel: habanalabs: pm: use SIMPLE_DEV_OPS for pm struct Li Jun
2026-08-20 8:57 ` 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.