All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/rockchip: vop: use IS_REACHABLE(CONFIG_DRM_ANALOGIX_DP)
@ 2026-12-04  2:25 ` Pengpeng Hou
  0 siblings, 0 replies; 3+ messages in thread
From: Pengpeng Hou @ 2026-12-04  2:25 UTC (permalink / raw)
  To: Sandy Huang, Heiko Stübner, Andy Yan, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter
  Cc: Chaoyi Chen, Damon Ding, dri-devel, linux-rockchip,
	linux-arm-kernel, Pengpeng Hou

Rockchip VOP's eDP CRC callbacks return the unavailable result if
Analogix DP is modular, even when VOP is itself in a module. The
provider exports the start and stop interfaces.

Use the same reachability test for both callbacks. Retain the existing
output and chip checks.

The issue was found by our static-analysis tool and manually reviewed.

Fixes: 6cca3869c598 ("drm/rockchip: Fix link error when CONFIG_DRM_ANALOGIX_DP undefined")
Signed-off-by: Pengpeng Hou <hppiscas@163.com>
---
The original patch was prepared with Gemini. Codex assisted with this
review and revision (Assisted-by: gpt 5).
Built rockchip_drm_vop.o for arm64 with Clang 18 and W=1, with
DRM_ROCKCHIP=m and DRM_ANALOGIX_DP=m. The patched object references both
Analogix CRC entry points; the original did not reference both. No
display CRC was measured.

 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index 69e72727da24f33ced4724b673babb594ab96d07..0860b189918a64a6a5eb1b00545caffbd14b53c6 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -32,7 +32,7 @@
 #include <drm/drm_self_refresh_helper.h>
 #include <drm/drm_vblank.h>
 
-#ifdef CONFIG_DRM_ANALOGIX_DP
+#if IS_REACHABLE(CONFIG_DRM_ANALOGIX_DP)
 #include <drm/bridge/analogix_dp.h>
 #endif
 
@@ -1669,7 +1669,7 @@ static struct drm_crtc_state *vop_crtc_create_state(struct drm_crtc *crtc)
 	return &crtc_state->base;
 }
 
-#ifdef CONFIG_DRM_ANALOGIX_DP
+#if IS_REACHABLE(CONFIG_DRM_ANALOGIX_DP)
 static struct drm_connector *vop_get_edp_connector(struct vop *vop)
 {
 	struct drm_connector *connector;

base-commit: d06ce6f1eb5eeffd4ebcfde345dc34a98131d106



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

* [PATCH] drm/rockchip: vop: use IS_REACHABLE(CONFIG_DRM_ANALOGIX_DP)
@ 2026-12-04  2:25 ` Pengpeng Hou
  0 siblings, 0 replies; 3+ messages in thread
From: Pengpeng Hou @ 2026-12-04  2:25 UTC (permalink / raw)
  To: Sandy Huang, Heiko Stübner, Andy Yan, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter
  Cc: Chaoyi Chen, Damon Ding, dri-devel, linux-rockchip,
	linux-arm-kernel, Pengpeng Hou

Rockchip VOP's eDP CRC callbacks return the unavailable result if
Analogix DP is modular, even when VOP is itself in a module. The
provider exports the start and stop interfaces.

Use the same reachability test for both callbacks. Retain the existing
output and chip checks.

The issue was found by our static-analysis tool and manually reviewed.

Fixes: 6cca3869c598 ("drm/rockchip: Fix link error when CONFIG_DRM_ANALOGIX_DP undefined")
Signed-off-by: Pengpeng Hou <hppiscas@163.com>
---
The original patch was prepared with Gemini. Codex assisted with this
review and revision (Assisted-by: gpt 5).
Built rockchip_drm_vop.o for arm64 with Clang 18 and W=1, with
DRM_ROCKCHIP=m and DRM_ANALOGIX_DP=m. The patched object references both
Analogix CRC entry points; the original did not reference both. No
display CRC was measured.

 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index 69e72727da24f33ced4724b673babb594ab96d07..0860b189918a64a6a5eb1b00545caffbd14b53c6 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -32,7 +32,7 @@
 #include <drm/drm_self_refresh_helper.h>
 #include <drm/drm_vblank.h>
 
-#ifdef CONFIG_DRM_ANALOGIX_DP
+#if IS_REACHABLE(CONFIG_DRM_ANALOGIX_DP)
 #include <drm/bridge/analogix_dp.h>
 #endif
 
@@ -1669,7 +1669,7 @@ static struct drm_crtc_state *vop_crtc_create_state(struct drm_crtc *crtc)
 	return &crtc_state->base;
 }
 
-#ifdef CONFIG_DRM_ANALOGIX_DP
+#if IS_REACHABLE(CONFIG_DRM_ANALOGIX_DP)
 static struct drm_connector *vop_get_edp_connector(struct vop *vop)
 {
 	struct drm_connector *connector;

base-commit: d06ce6f1eb5eeffd4ebcfde345dc34a98131d106


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

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

* Re: [PATCH] drm/rockchip: vop: use IS_REACHABLE(CONFIG_DRM_ANALOGIX_DP)
  2026-12-04  2:25 ` Pengpeng Hou
  (?)
@ 2026-12-04  2:40 ` sashiko-bot
  -1 siblings, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-12-04  2:40 UTC (permalink / raw)
  To: Pengpeng Hou; +Cc: dri-devel

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/rockchip: vop: Kconfig guard couples rockchipdrm.ko to
  analogix_dp.ko
--

commit 980649bcef71c0bdd585246e281f58fbe008efa0
Author: Pengpeng Hou <hppiscas@163.com>

drm/rockchip: vop: use IS_REACHABLE(CONFIG_DRM_ANALOGIX_DP)

This commit replaces #ifdef CONFIG_DRM_ANALOGIX_DP with
IS_REACHABLE(CONFIG_DRM_ANALOGIX_DP) in rockchip_drm_vop.c so that the
Analogix DP header and eDP CRC callbacks are compiled when both VOP and
Analogix DP are built as modules.

> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index 69e72727da24f..0860b189918a6 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -32,7 +32,7 @@
>  #include <drm/drm_self_refresh_helper.h>
>  #include <drm/drm_vblank.h>
>  
> -#ifdef CONFIG_DRM_ANALOGIX_DP
> +#if IS_REACHABLE(CONFIG_DRM_ANALOGIX_DP)
>  #include <drm/bridge/analogix_dp.h>
>  #endif
>  
> @@ -1669,7 +1669,7 @@ static struct drm_crtc_state *vop_crtc_create_state(struct drm_crtc *crtc)
>  	return &crtc_state->base;
>  }
>  
> -#ifdef CONFIG_DRM_ANALOGIX_DP
> +#if IS_REACHABLE(CONFIG_DRM_ANALOGIX_DP)
>  static struct drm_connector *vop_get_edp_connector(struct vop *vop)
>  {
>  	struct drm_connector *connector;

[Severity: Medium]
Should these guards check IS_ENABLED(CONFIG_ROCKCHIP_ANALOGIX_DP) instead
of IS_REACHABLE(CONFIG_DRM_ANALOGIX_DP)?

Unrelated drivers like CONFIG_DRM_ANALOGIX_ANX6345 select
CONFIG_DRM_ANALOGIX_DP=m even when CONFIG_ROCKCHIP_ANALOGIX_DP=n.  With
CONFIG_DRM_ROCKCHIP=m, rockchipdrm.ko now pulls in analogix_dp.ko via
analogix_dp_start_crc() and analogix_dp_stop_crc().

Enabling these callbacks without CONFIG_ROCKCHIP_ANALOGIX_DP also exposes
any non-Analogix eDP bridge attached to VOP to an invalid to_dp(bridge)
cast in analogix_dp_start_crc() and analogix_dp_stop_crc().

DRM_ROCKCHIP already selects DRM_ANALOGIX_DP when ROCKCHIP_ANALOGIX_DP is
enabled in drivers/gpu/drm/rockchip/Kconfig, so
IS_ENABLED(CONFIG_ROCKCHIP_ANALOGIX_DP) guarantees reachability in both
built-in and modular builds without this spurious dependency.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/179635110183.74470.16936220701661292951@163.com?part=1

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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04  2:25 [PATCH] drm/rockchip: vop: use IS_REACHABLE(CONFIG_DRM_ANALOGIX_DP) Pengpeng Hou
2026-12-04  2:25 ` Pengpeng Hou
2026-12-04  2:40 ` 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.