mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Neil Armstrong <neil.armstrong@linaro.org>
To: Arnd Bergmann <arnd@kernel.org>,
	Andrzej Hajda <andrzej.hajda@intel.com>,
	Robert Foss <rfoss@kernel.org>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Xin Ji <xji@analogixsemi.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Jonas Karlman <jonas@kwiboo.se>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Ayushi Makhija <quic_amakhija@quicinc.com>,
	Douglas Anderson <dianders@chromium.org>,
	Luca Ceresoli <luca.ceresoli@bootlin.com>,
	Loic Poulain <loic.poulain@oss.qualcomm.com>,
	Chen-Yu Tsai <wenst@chromium.org>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm: bridge: anx7625: enforce CONFIG_USB_ROLE_SWITCH dependency
Date: Fri, 6 Mar 2026 10:48:36 +0100	[thread overview]
Message-ID: <4902bc08-a5af-42a8-8655-8debcd31576a@linaro.org> (raw)
In-Reply-To: <20260304083604.724519-1-arnd@kernel.org>

On 3/4/26 09:35, Arnd Bergmann wrote:
> 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)
>   {

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>

Thanks,
Neil

  reply	other threads:[~2026-03-06  9:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-04  8:35 Arnd Bergmann
2026-03-06  9:48 ` Neil Armstrong [this message]
2026-03-11  2:20 ` Dmitry Baryshkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4902bc08-a5af-42a8-8655-8debcd31576a@linaro.org \
    --to=neil.armstrong@linaro.org \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@gmail.com \
    --cc=andrzej.hajda@intel.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=dianders@chromium.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loic.poulain@oss.qualcomm.com \
    --cc=luca.ceresoli@bootlin.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=quic_amakhija@quicinc.com \
    --cc=rfoss@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    --cc=wenst@chromium.org \
    --cc=xji@analogixsemi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®