public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH v1] drm/bridge: analogix_dp: Convert status check functions to bool
@ 2026-05-21 10:27 Damon Ding
  2026-05-21 19:57 ` Luca Ceresoli
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Damon Ding @ 2026-05-21 10:27 UTC (permalink / raw)
  To: andrzej.hajda, neil.armstrong, rfoss, maarten.lankhorst, mripard,
	tzimmermann, airlied, simona
  Cc: Laurent.pinchart, jonas, jernej.skrabec, luca.ceresoli,
	dmitry.baryshkov, heiko, m.szyprowski, dri-devel, linux-kernel,
	Damon Ding

Convert analogix_dp_is_slave_video_stream_clock_on() and
analogix_dp_is_video_stream_on() from int to bool return type.

This makes the code more readable and aligns with kernel best
practices for boolean status checks, while simplifying the
callers by removing unnecessary "== 0" comparisons.

Signed-off-by: Damon Ding <damon.ding@rock-chips.com>
---
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c |  4 ++--
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.h |  4 ++--
 drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c  | 14 +++++++-------
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index 8cf6b73bceac..573900c2cefc 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -619,7 +619,7 @@ static int analogix_dp_config_video(struct analogix_dp_device *dp)
 
 	for (;;) {
 		timeout_loop++;
-		if (analogix_dp_is_slave_video_stream_clock_on(dp) == 0)
+		if (analogix_dp_is_slave_video_stream_clock_on(dp))
 			break;
 		if (timeout_loop > DP_TIMEOUT_LOOP_COUNT) {
 			dev_err(dp->dev, "Timeout of slave video streamclk ok\n");
@@ -647,7 +647,7 @@ static int analogix_dp_config_video(struct analogix_dp_device *dp)
 
 	for (;;) {
 		timeout_loop++;
-		if (analogix_dp_is_video_stream_on(dp) == 0) {
+		if (analogix_dp_is_video_stream_on(dp)) {
 			done_count++;
 			if (done_count > 10)
 				break;
diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h
index 17347448c6b0..94348c4e3623 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h
@@ -211,7 +211,7 @@ void analogix_dp_reset_macro(struct analogix_dp_device *dp);
 void analogix_dp_init_video(struct analogix_dp_device *dp);
 
 void analogix_dp_set_video_color_format(struct analogix_dp_device *dp);
-int analogix_dp_is_slave_video_stream_clock_on(struct analogix_dp_device *dp);
+bool analogix_dp_is_slave_video_stream_clock_on(struct analogix_dp_device *dp);
 void analogix_dp_set_video_cr_mn(struct analogix_dp_device *dp,
 				 enum clock_recovery_m_value_type type,
 				 u32 m_value,
@@ -220,7 +220,7 @@ void analogix_dp_set_video_timing_mode(struct analogix_dp_device *dp, u32 type);
 void analogix_dp_enable_video_master(struct analogix_dp_device *dp,
 				     bool enable);
 void analogix_dp_start_video(struct analogix_dp_device *dp);
-int analogix_dp_is_video_stream_on(struct analogix_dp_device *dp);
+bool analogix_dp_is_video_stream_on(struct analogix_dp_device *dp);
 void analogix_dp_config_video_slave_mode(struct analogix_dp_device *dp);
 void analogix_dp_enable_scrambling(struct analogix_dp_device *dp);
 void analogix_dp_disable_scrambling(struct analogix_dp_device *dp);
diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
index 38fd8d5014d2..f84c1d48d671 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
@@ -713,7 +713,7 @@ void analogix_dp_set_video_color_format(struct analogix_dp_device *dp)
 	writel(reg, dp->reg_base + ANALOGIX_DP_VIDEO_CTL_3);
 }
 
-int analogix_dp_is_slave_video_stream_clock_on(struct analogix_dp_device *dp)
+bool analogix_dp_is_slave_video_stream_clock_on(struct analogix_dp_device *dp)
 {
 	u32 reg;
 
@@ -724,7 +724,7 @@ int analogix_dp_is_slave_video_stream_clock_on(struct analogix_dp_device *dp)
 
 	if (!(reg & DET_STA)) {
 		dev_dbg(dp->dev, "Input stream clock not detected.\n");
-		return -EINVAL;
+		return false;
 	}
 
 	reg = readl(dp->reg_base + ANALOGIX_DP_SYS_CTL_2);
@@ -735,10 +735,10 @@ int analogix_dp_is_slave_video_stream_clock_on(struct analogix_dp_device *dp)
 
 	if (reg & CHA_STA) {
 		dev_dbg(dp->dev, "Input stream clk is changing\n");
-		return -EINVAL;
+		return false;
 	}
 
-	return 0;
+	return true;
 }
 
 void analogix_dp_set_video_cr_mn(struct analogix_dp_device *dp,
@@ -816,7 +816,7 @@ void analogix_dp_start_video(struct analogix_dp_device *dp)
 	writel(reg, dp->reg_base + ANALOGIX_DP_VIDEO_CTL_1);
 }
 
-int analogix_dp_is_video_stream_on(struct analogix_dp_device *dp)
+bool analogix_dp_is_video_stream_on(struct analogix_dp_device *dp)
 {
 	u32 reg;
 
@@ -826,10 +826,10 @@ int analogix_dp_is_video_stream_on(struct analogix_dp_device *dp)
 	reg = readl(dp->reg_base + ANALOGIX_DP_SYS_CTL_3);
 	if (!(reg & STRM_VALID)) {
 		dev_dbg(dp->dev, "Input video stream is not detected.\n");
-		return -EINVAL;
+		return false;
 	}
 
-	return 0;
+	return true;
 }
 
 void analogix_dp_config_video_slave_mode(struct analogix_dp_device *dp)
-- 
2.34.1


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

* Re: [PATCH v1] drm/bridge: analogix_dp: Convert status check functions to bool
  2026-05-21 10:27 [PATCH v1] drm/bridge: analogix_dp: Convert status check functions to bool Damon Ding
@ 2026-05-21 19:57 ` Luca Ceresoli
  2026-05-25 10:22 ` Claude review: " Claude Code Review Bot
  2026-05-25 10:22 ` Claude Code Review Bot
  2 siblings, 0 replies; 4+ messages in thread
From: Luca Ceresoli @ 2026-05-21 19:57 UTC (permalink / raw)
  To: Damon Ding, andrzej.hajda, neil.armstrong, rfoss,
	maarten.lankhorst, mripard, tzimmermann, airlied, simona
  Cc: Laurent.pinchart, jonas, jernej.skrabec, luca.ceresoli,
	dmitry.baryshkov, heiko, m.szyprowski, dri-devel, linux-kernel

On Thu May 21, 2026 at 12:27 PM CEST, Damon Ding wrote:
> Convert analogix_dp_is_slave_video_stream_clock_on() and
> analogix_dp_is_video_stream_on() from int to bool return type.
>
> This makes the code more readable and aligns with kernel best
> practices for boolean status checks, while simplifying the
> callers by removing unnecessary "== 0" comparisons.
>
> Signed-off-by: Damon Ding <damon.ding@rock-chips.com>

Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* Claude review: drm/bridge: analogix_dp: Convert status check functions to bool
  2026-05-21 10:27 [PATCH v1] drm/bridge: analogix_dp: Convert status check functions to bool Damon Ding
  2026-05-21 19:57 ` Luca Ceresoli
@ 2026-05-25 10:22 ` Claude Code Review Bot
  2026-05-25 10:22 ` Claude Code Review Bot
  2 siblings, 0 replies; 4+ messages in thread
From: Claude Code Review Bot @ 2026-05-25 10:22 UTC (permalink / raw)
  To: dri-devel-reviews

Overall Series Review

Subject: drm/bridge: analogix_dp: Convert status check functions to bool
Author: Damon Ding <damon.ding@rock-chips.com>
Patches: 2
Reviewed: 2026-05-25T20:22:40.229679

---

This is a single-patch cleanup that converts two status-check functions (`analogix_dp_is_slave_video_stream_clock_on` and `analogix_dp_is_video_stream_on`) from `int` (returning 0/-EINVAL) to `bool` (returning true/false), and updates their two callers accordingly.

The conversion is **logically correct** — the semantic inversion between the old `== 0` check and the new truthy check is properly handled. Both functions are internal to this driver (no out-of-tree callers possible), and the grep confirms exactly one call site each. The patch is straightforward and low-risk.

One minor style observation below, but no correctness issues.

**Verdict: Looks good. Suitable for merge.**

---
Generated by Claude Code Patch Reviewer

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

* Claude review: drm/bridge: analogix_dp: Convert status check functions to bool
  2026-05-21 10:27 [PATCH v1] drm/bridge: analogix_dp: Convert status check functions to bool Damon Ding
  2026-05-21 19:57 ` Luca Ceresoli
  2026-05-25 10:22 ` Claude review: " Claude Code Review Bot
@ 2026-05-25 10:22 ` Claude Code Review Bot
  2 siblings, 0 replies; 4+ messages in thread
From: Claude Code Review Bot @ 2026-05-25 10:22 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

**Correctness — OK.** The key semantic question is whether the inversion is handled correctly:

- **Original:** `return 0` means "clock/stream IS on", callers test `if (func() == 0)` to enter the success path.
- **New:** `return true` means "clock/stream IS on", callers test `if (func())` to enter the success path.

Both call sites are correct after the change:

```c
// analogix_dp_core.c, first loop (slave video stream clock):
-		if (analogix_dp_is_slave_video_stream_clock_on(dp) == 0)
+		if (analogix_dp_is_slave_video_stream_clock_on(dp))
 			break;
```

```c
// analogix_dp_core.c, second loop (video stream on):
-		if (analogix_dp_is_video_stream_on(dp) == 0) {
+		if (analogix_dp_is_video_stream_on(dp)) {
 			done_count++;
```

Both loops preserve identical behavior — the `else if (done_count)` branch in the second loop is also unaffected since the boolean false case maps exactly to the old non-zero case.

**Scope — OK.** Both functions are static-linkage internal to the analogix_dp driver. There are no other callers anywhere in the tree. The header, implementation, and call sites are all updated consistently.

**No issues found.** This is a clean, correct cleanup patch.

---
Generated by Claude Code Patch Reviewer

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

end of thread, other threads:[~2026-05-25 10:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-21 10:27 [PATCH v1] drm/bridge: analogix_dp: Convert status check functions to bool Damon Ding
2026-05-21 19:57 ` Luca Ceresoli
2026-05-25 10:22 ` Claude review: " Claude Code Review Bot
2026-05-25 10: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