public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH v4] drm/bridge: cdns-dsi: Replace deprecated UNIVERSAL_DEV_PM_OPS()
@ 2026-04-07 14:41 Vitor Soares
  2026-04-12  3:22 ` Claude review: " Claude Code Review Bot
  2026-04-12  3:22 ` Claude Code Review Bot
  0 siblings, 2 replies; 3+ messages in thread
From: Vitor Soares @ 2026-04-07 14:41 UTC (permalink / raw)
  To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
	Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter
  Cc: Vitor Soares, dri-devel, linux-kernel, stable, Tomi Valkeinen

From: Vitor Soares <vitor.soares@toradex.com>

The deprecated UNIVERSAL_DEV_PM_OPS() macro uses the provided callbacks
for both runtime PM and system sleep. This causes the DSI clocks to be
disabled twice: once during runtime suspend and again during system
suspend, resulting in a WARN message from the clock framework when
attempting to disable already-disabled clocks.

[   84.384540] clk:231:5 already disabled
[   84.388314] WARNING: CPU: 2 PID: 531 at /drivers/clk/clk.c:1181 clk_core_disable+0xa4/0xac
...
[   84.579183] Call trace:
[   84.581624]  clk_core_disable+0xa4/0xac
[   84.585457]  clk_disable+0x30/0x4c
[   84.588857]  cdns_dsi_suspend+0x20/0x58 [cdns_dsi]
[   84.593651]  pm_generic_suspend+0x2c/0x44
[   84.597661]  ti_sci_pd_suspend+0xbc/0x15c
[   84.601670]  dpm_run_callback+0x8c/0x14c
[   84.605588]  __device_suspend+0x1a0/0x56c
[   84.609594]  dpm_suspend+0x17c/0x21c
[   84.613165]  dpm_suspend_start+0xa0/0xa8
[   84.617083]  suspend_devices_and_enter+0x12c/0x634
[   84.621872]  pm_suspend+0x1fc/0x368

To address this issue, replace UNIVERSAL_DEV_PM_OPS() with
SET_RUNTIME_PM_OPS(), enabling suspend/resume handling through the
_enable()/_disable() hooks managed by the DRM framework for both
runtime and system-wide PM.

Cc: stable@vger.kernel.org # 6.1.x
Fixes: e19233955d9e ("drm/bridge: Add Cadence DSI driver")
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Vitor Soares <vitor.soares@toradex.com>
---
v3 -> v4
 - Add Reviewed-by from Tomi Valkeinen
 - Rebase on top of drm-misc-fixes
 - Verified issue still present on current mainline

v2 -> v3
 - Fix warning: 'cdns_dsi_suspend' defined but not used [-Wunused-function]
 - Fix warning: 'cdns_dsi_resume' defined but not used [-Wunused-function]

v1 -> v2
 - Rely only on SET_RUNTIME_PM_OPS() for the PM.

 drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
index 0dd85e26248c..e07a9892df4e 100644
--- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
+++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
@@ -1230,7 +1230,7 @@ static const struct mipi_dsi_host_ops cdns_dsi_ops = {
 	.transfer = cdns_dsi_transfer,
 };
 
-static int __maybe_unused cdns_dsi_resume(struct device *dev)
+static int cdns_dsi_resume(struct device *dev)
 {
 	struct cdns_dsi *dsi = dev_get_drvdata(dev);
 
@@ -1241,7 +1241,7 @@ static int __maybe_unused cdns_dsi_resume(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused cdns_dsi_suspend(struct device *dev)
+static int cdns_dsi_suspend(struct device *dev)
 {
 	struct cdns_dsi *dsi = dev_get_drvdata(dev);
 
@@ -1251,8 +1251,9 @@ static int __maybe_unused cdns_dsi_suspend(struct device *dev)
 	return 0;
 }
 
-static UNIVERSAL_DEV_PM_OPS(cdns_dsi_pm_ops, cdns_dsi_suspend, cdns_dsi_resume,
-			    NULL);
+static const struct dev_pm_ops cdns_dsi_pm_ops = {
+	RUNTIME_PM_OPS(cdns_dsi_suspend, cdns_dsi_resume, NULL)
+};
 
 static int cdns_dsi_drm_probe(struct platform_device *pdev)
 {
@@ -1399,7 +1400,7 @@ static struct platform_driver cdns_dsi_platform_driver = {
 	.driver = {
 		.name   = "cdns-dsi",
 		.of_match_table = cdns_dsi_of_match,
-		.pm = &cdns_dsi_pm_ops,
+		.pm = pm_ptr(&cdns_dsi_pm_ops),
 	},
 };
 module_platform_driver(cdns_dsi_platform_driver);
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Claude review: drm/bridge: cdns-dsi: Replace deprecated UNIVERSAL_DEV_PM_OPS()
  2026-04-07 14:41 [PATCH v4] drm/bridge: cdns-dsi: Replace deprecated UNIVERSAL_DEV_PM_OPS() Vitor Soares
@ 2026-04-12  3:22 ` Claude Code Review Bot
  2026-04-12  3:22 ` Claude Code Review Bot
  1 sibling, 0 replies; 3+ messages in thread
From: Claude Code Review Bot @ 2026-04-12  3:22 UTC (permalink / raw)
  To: dri-devel-reviews

Overall Series Review

Subject: drm/bridge: cdns-dsi: Replace deprecated UNIVERSAL_DEV_PM_OPS()
Author: Vitor Soares <ivitro@gmail.com>
Patches: 1
Reviewed: 2026-04-12T13:22:17.990676

---

This is a single well-motivated bugfix patch that replaces the deprecated `UNIVERSAL_DEV_PM_OPS()` macro with runtime-PM-only ops in the Cadence DSI bridge driver. The problem is clearly described: `UNIVERSAL_DEV_PM_OPS` registers the same callbacks for both system sleep *and* runtime PM, causing clocks to be disabled twice during system suspend (once via runtime PM, once via system sleep), triggering a clock framework warning.

The fix is correct and appropriate. The driver already uses `pm_runtime_get_sync()` / `pm_runtime_put()` in its bridge `atomic_pre_enable` / `atomic_post_disable` callbacks (lines 736 and 631), so the DRM framework already manages the system suspend/resume path through the bridge lifecycle. Only the runtime PM callbacks are needed at the driver PM ops level.

The patch has a Reviewed-by from Tomi Valkeinen and a Fixes tag with stable CC. It is in good shape for merging.

**Verdict: Looks good.**

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Claude review: drm/bridge: cdns-dsi: Replace deprecated UNIVERSAL_DEV_PM_OPS()
  2026-04-07 14:41 [PATCH v4] drm/bridge: cdns-dsi: Replace deprecated UNIVERSAL_DEV_PM_OPS() Vitor Soares
  2026-04-12  3:22 ` Claude review: " Claude Code Review Bot
@ 2026-04-12  3:22 ` Claude Code Review Bot
  1 sibling, 0 replies; 3+ messages in thread
From: Claude Code Review Bot @ 2026-04-12  3:22 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

**Correctness: Good**

The core change is replacing:
```c
static UNIVERSAL_DEV_PM_OPS(cdns_dsi_pm_ops, cdns_dsi_suspend, cdns_dsi_resume, NULL);
```
with:
```c
static const struct dev_pm_ops cdns_dsi_pm_ops = {
    RUNTIME_PM_OPS(cdns_dsi_suspend, cdns_dsi_resume, NULL)
};
```

This is correct because:

1. `UNIVERSAL_DEV_PM_OPS` (pm.h:458-462) expands to both `SET_SYSTEM_SLEEP_PM_OPS` and `SET_RUNTIME_PM_OPS` using the *same* callbacks, which is exactly what causes the double-disable bug described in the commit message.

2. The bridge's `atomic_pre_enable` calls `pm_runtime_get_sync()` (line 736) and `atomic_post_disable` calls `pm_runtime_put()` (line 631). This means the DRM framework already handles bringing the device in/out of runtime PM around display usage. During system suspend, the DRM core will call `atomic_post_disable` which triggers `pm_runtime_put` → runtime suspend → `cdns_dsi_suspend`. There is no need for separate system sleep PM ops.

3. The `__maybe_unused` removal from `cdns_dsi_resume` and `cdns_dsi_suspend` is correct. The old `SET_RUNTIME_PM_OPS` macro was conditionally compiled (guarded by `#ifdef CONFIG_PM`), which could leave the functions unreferenced when PM was disabled, requiring `__maybe_unused`. The new `RUNTIME_PM_OPS` macro (pm.h:338-341) unconditionally expands regardless of CONFIG_PM, so the functions are always referenced. The `pm_ptr()` wrapper on the driver side handles the compile-out when CONFIG_PM is disabled.

4. The change from `.pm = &cdns_dsi_pm_ops` to `.pm = pm_ptr(&cdns_dsi_pm_ops)` is the correct modern pattern — it compiles out the PM ops pointer when `CONFIG_PM` is not enabled, allowing the compiler to dead-code-eliminate the entire `cdns_dsi_pm_ops` structure and the suspend/resume functions.

**Minor note on commit message:** The commit message text says "SET_RUNTIME_PM_OPS()" but the actual code uses `RUNTIME_PM_OPS()`. These are functionally equivalent (`SET_RUNTIME_PM_OPS` is just an alias per pm.h:365-366), but ideally the commit message would match the code. This is a very minor nit and not worth respinning the patch for, especially since it already has a Reviewed-by.

**No issues found. Patch is ready to merge.**

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-04-12  3:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-07 14:41 [PATCH v4] drm/bridge: cdns-dsi: Replace deprecated UNIVERSAL_DEV_PM_OPS() Vitor Soares
2026-04-12  3:22 ` Claude review: " Claude Code Review Bot
2026-04-12  3:22 ` Claude Code Review Bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox