Commit 10e9ff46 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Dmitry Baryshkov
Browse files

drm: bridge: anx7625: enforce CONFIG_USB_ROLE_SWITCH dependency



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: f81455b2 ("drm: bridge: anx7625: implement minimal Type-C support")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Reviewed-by: default avatarNeil Armstrong <neil.armstrong@linaro.org>
Link: https://patch.msgid.link/20260304083604.724519-1-arnd@kernel.org


Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
parent 66b0baaa
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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
+0 −17
Original line number Diff line number Diff line
@@ -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)
{