* [PATCH] drm: bridge: anx7625: enforce CONFIG_USB_ROLE_SWITCH dependency
@ 2026-03-04 8:35 Arnd Bergmann
2026-03-05 3:44 ` Claude review: " Claude Code Review Bot
2026-03-05 3:44 ` Claude Code Review Bot
0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2026-03-04 8:35 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Dmitry Baryshkov, Heikki Krogerus, Xin Ji
Cc: Arnd Bergmann, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
Ayushi Makhija, Douglas Anderson, Luca Ceresoli, Loic Poulain,
Chen-Yu Tsai, dri-devel, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
When CONFIG_TYPEC is enabled, but USB_ROLE_SWITCH=m, the anx7625 driver
fails to link as built-in:
aarch64-linux-ld: drivers/gpu/drm/bridge/analogix/anx7625.o: in function `anx7625_i2c_remove':
anx7625.c:(.text+0x6ec): undefined reference to `usb_role_switch_put'
aarch64-linux-ld: drivers/gpu/drm/bridge/analogix/anx7625.o: in function `anx7625_typec_set_status':
anx7625.c:(.text+0x3080): undefined reference to `usb_role_switch_set_role'
aarch64-linux-ld: drivers/gpu/drm/bridge/analogix/anx7625.o: in function `anx7625_i2c_probe':
anx7625.c:(.text+0x5368): undefined reference to `fwnode_usb_role_switch_get'
The problem is that both dependencies are optional in the sense of allowing
the anx7625 driver to call the exported interfaces to be used from a loadable
module, but cannot work for built-in drivers. It would be possible to handle
all nine combinations of the CONFIG_TYPEC and CONFIG_USB_ROLE_SWITCH tristate
options, but that does add a lot of complexity that seems unnecessary when
in reality any user of this driver would have both enabled anyway.
Turn both dependencies into hard 'depends on' here to only allow configurations
where it's possible to actually use them, and remove the misguided IS_REACHABLE()
check that did nothing here.
Fixes: f81455b2d332 ("drm: bridge: anx7625: implement minimal Type-C support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/gpu/drm/bridge/analogix/Kconfig | 3 ++-
drivers/gpu/drm/bridge/analogix/anx7625.c | 17 -----------------
2 files changed, 2 insertions(+), 18 deletions(-)
diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig b/drivers/gpu/drm/bridge/analogix/Kconfig
index f3448b0631fe..03dc7ffe824a 100644
--- a/drivers/gpu/drm/bridge/analogix/Kconfig
+++ b/drivers/gpu/drm/bridge/analogix/Kconfig
@@ -34,7 +34,8 @@ config DRM_ANALOGIX_ANX7625
tristate "Analogix Anx7625 MIPI to DP interface support"
depends on DRM
depends on OF
- depends on TYPEC || !TYPEC
+ depends on TYPEC
+ depends on USB_ROLE_SWITCH
select DRM_DISPLAY_DP_HELPER
select DRM_DISPLAY_HDCP_HELPER
select DRM_DISPLAY_HELPER
diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
index c43519097a45..ec4b24481987 100644
--- a/drivers/gpu/drm/bridge/analogix/anx7625.c
+++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
@@ -1483,7 +1483,6 @@ static void anx7625_start_dp_work(struct anx7625_data *ctx)
DRM_DEV_DEBUG_DRIVER(dev, "Secure OCM version=%02x\n", ret);
}
-#if IS_REACHABLE(CONFIG_TYPEC)
static u8 anx7625_checksum(u8 *buf, u8 len)
{
u8 ret = 0;
@@ -1635,22 +1634,6 @@ static void anx7625_typec_unregister(struct anx7625_data *ctx)
usb_role_switch_put(ctx->role_sw);
typec_unregister_port(ctx->typec_port);
}
-#else
-static void anx7625_typec_set_status(struct anx7625_data *ctx,
- unsigned int intr_status,
- unsigned int intr_vector)
-{
-}
-
-static int anx7625_typec_register(struct anx7625_data *ctx)
-{
- return 0;
-}
-
-static void anx7625_typec_unregister(struct anx7625_data *ctx)
-{
-}
-#endif
static int anx7625_read_hpd_status_p0(struct anx7625_data *ctx)
{
--
2.39.5
^ permalink raw reply related [flat|nested] 3+ messages in thread* Claude review: drm: bridge: anx7625: enforce CONFIG_USB_ROLE_SWITCH dependency
2026-03-04 8:35 [PATCH] drm: bridge: anx7625: enforce CONFIG_USB_ROLE_SWITCH dependency Arnd Bergmann
@ 2026-03-05 3:44 ` Claude Code Review Bot
2026-03-05 3:44 ` Claude Code Review Bot
1 sibling, 0 replies; 3+ messages in thread
From: Claude Code Review Bot @ 2026-03-05 3:44 UTC (permalink / raw)
To: dri-devel-reviews
Overall Series Review
Subject: drm: bridge: anx7625: enforce CONFIG_USB_ROLE_SWITCH dependency
Author: Arnd Bergmann <arnd@kernel.org>
Patches: 1
Reviewed: 2026-03-05T13:44:42.327497
---
This is a single, well-motivated build fix patch. The problem is clearly described: when `CONFIG_TYPEC=y` but `USB_ROLE_SWITCH=m`, the anx7625 driver fails to link as built-in because it calls `usb_role_switch_*` functions from a module. The original Kconfig used the idiom `depends on TYPEC || !TYPEC` which makes TYPEC optional, and the C code had `#if IS_REACHABLE(CONFIG_TYPEC)` guards with stub fallbacks. However, USB_ROLE_SWITCH had no such protection, leading to the link failure.
The fix is clean and pragmatic: make both TYPEC and USB_ROLE_SWITCH hard dependencies, and remove the now-unnecessary `#if IS_REACHABLE()` / `#else` stub code. The rationale that any real user of this hardware would have both enabled is sound.
**Verdict: Looks good.** No issues found.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 3+ messages in thread
* Claude review: drm: bridge: anx7625: enforce CONFIG_USB_ROLE_SWITCH dependency
2026-03-04 8:35 [PATCH] drm: bridge: anx7625: enforce CONFIG_USB_ROLE_SWITCH dependency Arnd Bergmann
2026-03-05 3:44 ` Claude review: " Claude Code Review Bot
@ 2026-03-05 3:44 ` Claude Code Review Bot
1 sibling, 0 replies; 3+ messages in thread
From: Claude Code Review Bot @ 2026-03-05 3:44 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
**Kconfig change** (`drivers/gpu/drm/bridge/analogix/Kconfig`):
The change from:
```
depends on TYPEC || !TYPEC
```
to:
```
depends on TYPEC
depends on USB_ROLE_SWITCH
```
is correct. The old `TYPEC || !TYPEC` idiom meant "allow building regardless of TYPEC state but ensure we can't be built-in when TYPEC=m" — effectively making it optional. Changing to a hard `depends on` for both TYPEC and USB_ROLE_SWITCH eliminates all nine problematic tristate combinations and ensures the driver can only be built when both subsystems are available at the right level (built-in or module).
**C code change** (`drivers/gpu/drm/bridge/analogix/anx7625.c`):
Removing the `#if IS_REACHABLE(CONFIG_TYPEC)` / `#else` block with the three empty stub functions (`anx7625_typec_set_status`, `anx7625_typec_register`, `anx7625_typec_unregister`) is the correct cleanup. Since TYPEC is now a hard dependency, these stubs can never be reached. The real implementations remain intact and are now unconditionally compiled.
I verified that after the patch, no `IS_REACHABLE` guards or `#if`/`#else` blocks related to TYPEC remain in the file.
**Minor observation**: The commit message mentions the `Fixes:` tag pointing to `f81455b2d332` which introduced the Type-C support — this is appropriate since that commit introduced the USB_ROLE_SWITCH usage without the corresponding Kconfig dependency.
**No issues found.**
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-05 3:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-04 8:35 [PATCH] drm: bridge: anx7625: enforce CONFIG_USB_ROLE_SWITCH dependency Arnd Bergmann
2026-03-05 3:44 ` Claude review: " Claude Code Review Bot
2026-03-05 3:44 ` 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