From nobody Tue Sep 29 00:32:58 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 869521448E0 for ; Fri, 14 Aug 2026 14:06:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786716404; cv=none; b=QJIYxA94E36pvk6wH6lnOrGFJygqvHOhoRTgveX+cO40d2PuAP3JiPvFsggZC/NCJ7B3aLdVlHQxbdHvtRqD36VDnskOF5TRHpx6fgbOPczE+36Fnkn0DElkVieq983m+9/3vtiSJyBk1u/IeF72I3w38DojTzlX3zcUVtfwwhE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786716404; c=relaxed/simple; bh=gJyGV/MxicV1iadkcvy0qeEumG4wi6Mhr+2yhO37hSc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QLo2Gk2mtiTth9Eo9wjP4FvpBXEG4rXkDrMV/EoiYXanFOpryGffCgk463quIzw+iit6i5SUi7OmyX/S6CJAfR639a6630P9QJkt3GIqssFSSIb41QrX87hb7CSpD8Q/XnLG3oSgwhj5A4OPxyyFvHhOLP5jD40XlZcWmpw4Ifk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=mhxK0Bz/; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="mhxK0Bz/" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id F2BA64E41210; Fri, 14 Aug 2026 14:06:31 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id C0CA06046D; Fri, 14 Aug 2026 14:06:31 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id A92D711C4EDA1; Fri, 14 Aug 2026 16:06:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1786716386; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=4CNxE/FuxQGyWTMn05IYNxmHPIwqZ0RRLrWbypLR/yw=; b=mhxK0Bz/dgnNNbPSHw00s/A+V/Pc8/zxujm5ptozjlKdk144PY4JHJBpz1C+9MqRXs7ON1 FMwWdTeY7mmr/dfjxOwtuyDmQTuoFJ617LYjISJZ5BceTGFzYjFc0z1RPPqUADBaO8+Lue FPKb6fz/O0uYEkf7QKZtN/jamYSdx6X6P6AJh/VWzS+qNBZ8rgkFYvN0WvfY3IJlfuvYP8 4c3cW9sK2+SipAgv8MPvtnZzJIgR3K4y+vnx92MwuDJAcQiAQT/qQEVZEr308C8RSSKjAC G4F0+Uk0NTBDxsrOTuiKQoD4514LjG5vJq4HdjRxsjN25+pKtA+s358DMlg00Q== From: Luca Ceresoli Date: Fri, 14 Aug 2026 16:05:49 +0200 Subject: [PATCH 01/11] drm: of: drm_of_find_panel_or_bridge: simplify freeing the remote node pointer Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260814-drm-bridge-every-panel-v1-1-19cd5277cc8d@bootlin.com> References: <20260814-drm-bridge-every-panel-v1-0-19cd5277cc8d@bootlin.com> In-Reply-To: <20260814-drm-bridge-every-panel-v1-0-19cd5277cc8d@bootlin.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Jessica Zhang , Linus Walleij , Inki Dae , Jagan Teki , Marek Szyprowski Cc: Dmitry Baryshkov , Hui Pu , Ian Ray , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Luca Ceresoli X-Mailer: b4 0.16.0 X-Last-TLS-Session-Version: TLSv1.3 In prepataion to further modify the logic of this function, simplify putting the struct device_node pointer by using a cleanup action. Signed-off-by: Luca Ceresoli Reviewed-by: Maxime Ripard --- drivers/gpu/drm/drm_of.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index e495117735e1..b42a321f3052 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -288,7 +288,6 @@ int drm_of_find_panel_or_bridge(const struct device_nod= e *np, struct drm_bridge **bridge) { int ret =3D -EPROBE_DEFER; - struct device_node *remote; =20 if (WARN_ON(!panel)) return -EINVAL; @@ -304,7 +303,8 @@ int drm_of_find_panel_or_bridge(const struct device_nod= e *np, if (!of_graph_is_present(np)) return -ENODEV; =20 - remote =3D of_graph_get_remote_node(np, port, endpoint); + struct device_node *remote __free(device_node) =3D + of_graph_get_remote_node(np, port, endpoint); if (!remote) return -ENODEV; =20 @@ -326,7 +326,6 @@ int drm_of_find_panel_or_bridge(const struct device_nod= e *np, =20 } =20 - of_node_put(remote); return ret; } EXPORT_SYMBOL_GPL(drm_of_find_panel_or_bridge); --=20 2.55.0 From nobody Tue Sep 29 00:32:58 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B16493A785C for ; Fri, 14 Aug 2026 14:06:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786716411; cv=none; b=T0SFOZxUQeY9EtSSLUPu4skjo7yWoD27KlRToGYUVA8d/dndHMGBUPe/rBsAdasOO9nk8IKs3KEBIDld1n9iNEbM5ZpIbmDYvmO9UZ8on68MOUe6d+3kJ+8no/3NshXNwN8O5U+q9zHtZEe5smUexhuPjZ6Q4e/UguvKi7voJ3U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786716411; c=relaxed/simple; bh=91mWSUkqIClwsq9GldWur1at7DaIjn1caSZYwkzL+nA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IOnu4p7Q8zu0BW+erOLmvM4qFnN7RImkPn7xR5lfqT5nhUF+wdvxYmr2DGHPaeUUSXprxPXigsDj8a65vM3iMKdtjraOYH6GPCsDTzEXt+qRmBcbjg78NkM4llOWGV/k3NuPDPkaHCioGESpnLRcLmQJaGm/8wECqNRrysWMcFc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=TL2S42RL; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="TL2S42RL" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 375F44E411D9; Fri, 14 Aug 2026 14:06:39 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 024F76046D; Fri, 14 Aug 2026 14:06:39 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id E054F11C4EDA3; Fri, 14 Aug 2026 16:06:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1786716393; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=zPffTQY3o0nckhG1kgJsg31X0NrLILf85FpE443vTjw=; b=TL2S42RL9GTyEW2CCCc+9L98eUADbRmyuyDUIjPgzgB/cIC2bohquh2rKR+j+MGDVbYylL 6mtYmPziJqQe/mDqmDCDIA6v75gPK6RzqGQk3c/MRVbsGAKM8/PSiuuWxfvE5ZztQdCory JDMg7+v2cJAXXNWZ/OXUUBT9urqQ/tiqYrXXkJbf95ABWB9oj0rBxRuku4mVD5x69TNfZ2 JcLsWVp6PKgzIsirFNUweYUB/CFp04FAmMqtE7LlzagAvQqmZMqufbhXtXFixagS73e4+4 up2IzL4YYumCfjxjYKz+6LvCbzFlzeo82FoUsRrn4mO8/1ShIpzfB/fz9AI1wg== From: Luca Ceresoli Date: Fri, 14 Aug 2026 16:05:50 +0200 Subject: [PATCH 02/11] drm: of: drm_of_find_panel_or_bridge: simplify error return paths Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260814-drm-bridge-every-panel-v1-2-19cd5277cc8d@bootlin.com> References: <20260814-drm-bridge-every-panel-v1-0-19cd5277cc8d@bootlin.com> In-Reply-To: <20260814-drm-bridge-every-panel-v1-0-19cd5277cc8d@bootlin.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Jessica Zhang , Linus Walleij , Inki Dae , Jagan Teki , Marek Szyprowski Cc: Dmitry Baryshkov , Hui Pu , Ian Ray , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Luca Ceresoli X-Mailer: b4 0.16.0 X-Last-TLS-Session-Version: TLSv1.3 In prepataion to further modify the logic of this function, simplify the error-returning code. With this change, on any error there is an immediate 'return -;' statement, without having to carry on the return value until the end. Additionally, clear both the panel and the bridge pointers at the beginning. Even though this is redundant in some code paths, it allows to have a simpler code in the rest of the function. Signed-off-by: Luca Ceresoli Reviewed-by: Maxime Ripard --- drivers/gpu/drm/drm_of.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index b42a321f3052..8ec352f3df93 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -287,12 +287,12 @@ int drm_of_find_panel_or_bridge(const struct device_n= ode *np, struct drm_panel **panel, struct drm_bridge **bridge) { - int ret =3D -EPROBE_DEFER; - if (WARN_ON(!panel)) return -EINVAL; =20 *panel =3D NULL; + if (bridge) + *bridge =3D NULL; =20 /* * of_graph_get_remote_node() produces a noisy error message if port @@ -310,23 +310,20 @@ int drm_of_find_panel_or_bridge(const struct device_n= ode *np, =20 *panel =3D of_drm_find_panel(remote); if (!IS_ERR(*panel)) - ret =3D 0; - else - *panel =3D NULL; + return 0; + + *panel =3D NULL; =20 if (bridge) { - if (ret) { - /* No panel found yet, check for a bridge next. */ - *bridge =3D of_drm_find_bridge(remote); - if (*bridge) - ret =3D 0; - } else { - *bridge =3D NULL; - } + /* No panel found yet, check for a bridge next. */ + *bridge =3D of_drm_find_bridge(remote); + if (*bridge) + return 0; =20 + *bridge =3D NULL; } =20 - return ret; + return -EPROBE_DEFER; } EXPORT_SYMBOL_GPL(drm_of_find_panel_or_bridge); =20 --=20 2.55.0 From nobody Tue Sep 29 00:32:58 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E8103ABD99 for ; Fri, 14 Aug 2026 14:06:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786716412; cv=none; b=M+tX7GqO8F0Oa1t36if5BnSFjGjyxPoEO2oYzk1mxULjVL0m2pX4WrH894PN5pCTd+VlEkyPW4imqHM/uPDkw4dTvowJNeM+NvS+YN8K5pjVAIqhaL3mNQyfP0ZQjPZyjcK+AjapxiFsNSkgKGZB361+vrHoOSrYlaOTz+GOaLs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786716412; c=relaxed/simple; bh=CYc9elUSZOYy9tAYoJoiXTMOFe6146NaTKhQKwJSXM4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pzzv0F4/xfrUhCVKWCVJZfo8pCmVCLdKTF1VYo+V8ti6oyr/xDoCBEfEUM857CF2+rncMp2Ii0Ry1px3GCMoWQFeWRvyp6LaPK9IfE+h4hhounTKU+nA/P0q7lDrEeGdjFchmWE7MxeP/Wg09n8TG5dk3P85YzZtZBbBxI2/JGM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=EfHXba7b; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="EfHXba7b" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 6FFF91A163E; Fri, 14 Aug 2026 14:06:42 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 44AF66046D; Fri, 14 Aug 2026 14:06:42 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 4129111C4EDA1; Fri, 14 Aug 2026 16:06:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1786716401; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=mVDFdzNDfjFRCBlyEIO+dC4L57v118Qe8Mg42pjRsBw=; b=EfHXba7bObx3vA0e53jV/8LKu+0pxhXm7cUHbNlI5OwlUAIKPMAM7wCWYX7WCzT8jM6Tv2 0pl2C9JM3QZyvOagR4mZ0noYaiER83JSqFvYPOWy9y1TKMxb0M/KTuHSulbBBEk3tVT1zY rvIw/rG7bAFenMiVsKJpKOE/VBU0aNiDTFvpO6QpDE91q60MUNcJ5n/n5zSqHfHDIPrzjx X5wbC+T8VZ4UDAJTboVC5L+wIVJu7CLURJs9+bx9cyfEF5NYvimIvERJRUkTomOoHfFuEz yspaawcKwC2Gx625tJQ7wbdn2h2FJUT2U9d3m27HO4+CHYDnVVmwzBGsb9PGcQ== From: Luca Ceresoli Date: Fri, 14 Aug 2026 16:05:51 +0200 Subject: [PATCH 03/11] drm: of: drm_of_find_panel_or_bridge: prioritize the bridge, not the panel Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260814-drm-bridge-every-panel-v1-3-19cd5277cc8d@bootlin.com> References: <20260814-drm-bridge-every-panel-v1-0-19cd5277cc8d@bootlin.com> In-Reply-To: <20260814-drm-bridge-every-panel-v1-0-19cd5277cc8d@bootlin.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Jessica Zhang , Linus Walleij , Inki Dae , Jagan Teki , Marek Szyprowski Cc: Dmitry Baryshkov , Hui Pu , Ian Ray , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Luca Ceresoli X-Mailer: b4 0.16.0 X-Last-TLS-Session-Version: TLSv1.3 By the documentation drm_of_find_panel_or_bridge() returns a "drm_panel or drm_bridge", without specifying which one is returned in case both exist. Definitely it never returns both. If both exist (and @bridge is !=3D NULL), the current implementation prioritizes the drm_panel pointer and returns that. In most cases (including devm_drm_of_get_bridge() and drmm_of_get_bridge()) this is used to implement the following logic (simplified): drm_of_find_panel_or_bridge(..., &panel, &bridge); if (panel) bridge =3D [devm_]drm_panel_bridge_add[_typed](panel); Work is in progress to make every drm_panel automatically create a panel_bridge, so a panel_bridge will always be present for every drm_panel. This means the above logic would create a panel_bridge that already exists. Avoid it by returning the drm_bridge when both are present, instead of the drm_panel. For the case where @bridge =3D=3D NULL, this commit does not change anythin= g: the 'if (bridge)' body is never executed and the drm_panel (if found) is always returned. Signed-off-by: Luca Ceresoli --- drivers/gpu/drm/drm_of.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 8ec352f3df93..f92f02f9b202 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -308,14 +308,7 @@ int drm_of_find_panel_or_bridge(const struct device_no= de *np, if (!remote) return -ENODEV; =20 - *panel =3D of_drm_find_panel(remote); - if (!IS_ERR(*panel)) - return 0; - - *panel =3D NULL; - if (bridge) { - /* No panel found yet, check for a bridge next. */ *bridge =3D of_drm_find_bridge(remote); if (*bridge) return 0; @@ -323,6 +316,13 @@ int drm_of_find_panel_or_bridge(const struct device_no= de *np, *bridge =3D NULL; } =20 + /* No bridge found yet, check for a panel next. */ + *panel =3D of_drm_find_panel(remote); + if (!IS_ERR(*panel)) + return 0; + + *panel =3D NULL; + return -EPROBE_DEFER; } EXPORT_SYMBOL_GPL(drm_of_find_panel_or_bridge); --=20 2.55.0 From nobody Tue Sep 29 00:32:58 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 388423939B1 for ; Fri, 14 Aug 2026 14:06:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786716414; cv=none; b=uLFG+Elj2S4jHCxH2eQeZ4dlN8SW9fnjZvgQ8szRcJYVT1O2I/Kh0cAnGb3boxGJsVbahO4sbbG8r2n80EjNjbPkkpx6UUe4Iqkb5bqTjy78OSiRE2FZCwSrIISRujJQYxWQRKJ8OgAsoDPJrHXTp7E53dYqG35ZWnxA3/zzz0A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786716414; c=relaxed/simple; bh=9lDSKMRU66IZ23NwUg8kj05ba+PLuumOHC5P7v6Fx2I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JkUPP5eCCbsJ/E8Pt4ZUCatxmyCM73UCmcOWuIDx0Ygklus4Oh9YydCC16qJ3BQkWVSkZmOQ85o+tnFIaeepKkYoG4VSC59xLd5Av7B32mFRKO1FzRYsNw/Gd4toI+/Kebhe6a8JdW2ofeSztioX19punhrRbnONlH+xbauseaI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=xyYRK6Qi; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="xyYRK6Qi" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 7512B1A163B; Fri, 14 Aug 2026 14:06:45 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 49B056046D; Fri, 14 Aug 2026 14:06:45 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 76FBB11C4EDA5; Fri, 14 Aug 2026 16:06:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1786716404; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=dQ3Jok/l1psHBc/8VDJALjoxzjXNRM6OdPzV1zrK2Ng=; b=xyYRK6QiO38EkCyy8JQwUGEgtDnLWNwg4FpCQExNQaO5Mi6w7DfacuGrx/R9fcpGLMYOya 58PfhTtMRyvb9S90l3eAYBLKRCU+iE06lbGkkcqlH8KoMYwlCdRr28LvsFxsGzmbhPmZto d372N3AhyCRwPRd5PahRW3tRQsDDZRKL58HdV0kCECgdKCO8A6okaFHbUQS/hzUU3oQ6rR IKyTd6yELspJbXWZm86r7HI5D15+O2g7vwngpT71wYcWrMVYCKjr06GQuJWEqLiWaFaJgs Dt5/60zfRMH8wuUc2wy8B15a5VLdeOFDIjjuM9ISxidLI1ygYXQA118IaUUn8g== From: Luca Ceresoli Date: Fri, 14 Aug 2026 16:05:52 +0200 Subject: [PATCH 04/11] drm/panel: merge the drm_kms_helper module into the drm module Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260814-drm-bridge-every-panel-v1-4-19cd5277cc8d@bootlin.com> References: <20260814-drm-bridge-every-panel-v1-0-19cd5277cc8d@bootlin.com> In-Reply-To: <20260814-drm-bridge-every-panel-v1-0-19cd5277cc8d@bootlin.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Jessica Zhang , Linus Walleij , Inki Dae , Jagan Teki , Marek Szyprowski Cc: Dmitry Baryshkov , Hui Pu , Ian Ray , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Luca Ceresoli X-Mailer: b4 0.16.0 X-Last-TLS-Session-Version: TLSv1.3 Work is in progress to make every drm_panel automatically create a panel_bridge [0][1]. This requires the panel code to call the drm_panel_bridge APIs. However this would create a circular dependency loop on modular builds: __devm_drm_panel_alloc() [drm] -> drm_panel_bridge_add() [drm_kms_helper] -> drm_bridge.c APIs [drm] Moving just the panel_brige.o file from [drm_kms_helper] to [drm] does not work because the panel bridge code uses the drm_atomic_helper and drm_probe_helper which add further dependencies on symbols in the [drm_kms_helper] module. So take a simple approach, and move the entire drm_kms_helper into the [drm] module. Link: https://lore.kernel.org/all/emuj2innmp6zmzd7pyakqzjqpdzhly6qfhakya3yd= wmd63pl26@5jwxaidpikjw/ [0] Link: https://lore.kernel.org/lkml/20250206-hotplug-drm-bridge-v6-8-9d6f2c9= c3058@bootlin.com/ [1] Signed-off-by: Luca Ceresoli --- *Note* This is just a quick implementation to open a discussion while having a working implementation. If the approach is approved there will be more details to polish. --- drivers/gpu/drm/Makefile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index e97faabcd783..945d4f117c3f 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -139,7 +139,7 @@ obj-$(CONFIG_DRM_TTM_HELPER) +=3D drm_ttm_helper.o # Modesetting helpers # =20 -drm_kms_helper-y :=3D \ +drm-$(CONFIG_DRM_KMS_HELPER) :=3D \ drm_atomic_helper.o \ drm_atomic_state_helper.o \ drm_bridge_helper.o \ @@ -156,9 +156,8 @@ drm_kms_helper-y :=3D \ drm_self_refresh_helper.o \ drm_simple_kms_helper.o \ drm_vblank_helper.o -drm_kms_helper-$(CONFIG_DRM_PANEL_BRIDGE) +=3D bridge/panel.o -drm_kms_helper-$(CONFIG_DRM_FBDEV_EMULATION) +=3D drm_fb_helper.o -obj-$(CONFIG_DRM_KMS_HELPER) +=3D drm_kms_helper.o +drm-$(CONFIG_DRM_PANEL_BRIDGE) +=3D bridge/panel.o +drm-$(CONFIG_DRM_FBDEV_EMULATION) +=3D drm_fb_helper.o =20 # # Drivers and the rest --=20 2.55.0 From nobody Tue Sep 29 00:32:58 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 055473AB284 for ; Fri, 14 Aug 2026 14:06:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786716420; cv=none; b=AJk9hCJ5O1g44XZN9QQUlD9x4Np+3Ybc0NWDunSMaw18OVg4/Df8z2JAY/lDRjjvY6pNNbUImq3+9DTis2LyMAwoqJLAZAG3Q/eESod+x6CDhBo2VR1ThVC4LHyeTZ6LQ8kSvaY0ZM3rmAappBKn/ZM+wORHMKkkBvZ81L4ZG/Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786716420; c=relaxed/simple; bh=sSPp/m6zfgMnJrFDkeQlaYQme7LlN2UckiOqe4foEzc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ssjNbRk/9Q8+zEB7/xL09hb/fEy7+s5zFTDy90jWqCIDbRUTXEi3b3gN9w9QPJvUoQDPaVcnuH4xKUNp0BwZCGYtPmp6ZoHrYPqYJC1inIvkbFOmIMA8KNC/Mfvm0nBjjiQvO5Tr3EdNjJalGZ3hGDF5xxiiSx/rLKbbq4Q9gK4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=dcI2YOqT; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="dcI2YOqT" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id EA3901A163D; Fri, 14 Aug 2026 14:06:52 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id BECCA6046D; Fri, 14 Aug 2026 14:06:52 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 7A2F611C4EDA1; Fri, 14 Aug 2026 16:06:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1786716407; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=/yjuBpwVLWPQyhvydWW+FG8ndzG0jMVfxEkaLMcgJ+o=; b=dcI2YOqTafKRmtij0ULH2nyMrUlXdeAACRHbQYdXQeX+C9pTxZ3g2TIZ57JrYC6WGqWfwe vSp4hCeacVVcZa81NOkxQgkVt/AigfKRk6EhBH09/98ddfA5cNav802CL8xYSSQTta9zj8 N0nbMuN/zKh8xJvJ4BzdcJWW+WCvgLymMsHc1jbH27LsgSXFJQGxFT20ujInbpfB7qqoTa 0owKzNtr1RJQkS39ocK8O0QKLc0AOUaRrBF+Ctfpr7ZYRX6942wkqDnEsUdaXda4LGN1kb Yx7ZqNH750COOEyW2fxcW0vL8VnuOTGKJTkx6n+ejOLt4/99eXl/hVfqtBE0fQ== From: Luca Ceresoli Date: Fri, 14 Aug 2026 16:05:53 +0200 Subject: [PATCH 05/11] drm/bridge: panel: add a panel_bridge to every panel Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260814-drm-bridge-every-panel-v1-5-19cd5277cc8d@bootlin.com> References: <20260814-drm-bridge-every-panel-v1-0-19cd5277cc8d@bootlin.com> In-Reply-To: <20260814-drm-bridge-every-panel-v1-0-19cd5277cc8d@bootlin.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Jessica Zhang , Linus Walleij , Inki Dae , Jagan Teki , Marek Szyprowski Cc: Dmitry Baryshkov , Hui Pu , Ian Ray , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Luca Ceresoli X-Mailer: b4 0.16.0 X-Last-TLS-Session-Version: TLSv1.3 Adding a panel does currently not add a panel_bridge wrapping it. Usually the panel_bridge creation happens later, when some other driver (e.g. the previous bridge or the encoder) calls *_of_get_bridge() and the following element in the pipeline is a panel. This has some drawbacks: * hte bridge API is currently the best practice to access various components of the pipeline, especially with complex cards where bridges can be combined in different ways on different hardware * the panel_bridge is not created in the context of the driver of the underlying physical device (the panel driver), but of some other driver * that other driver is not aware of whether the returned drm_bridge pointer is a panel_bridge created on the fly, a pre-existing panel_bridge or a non-panel bridge * removal of a panel_bridge requires calling drm_panel_bridge_remove(), but the other driver doesn't know whether this is needed because it doesn't know whether it has created a panel_bridge or not So far the current approach has been working because devm and drmm ensure the panel bridge would be dealloacted at some later point. However with the upcoming implementation of dynamic bridge lifetime this will get more complicated. Switch to the new approach: always create a panel_bridge with a drm_panel, thus matching the lifetime of the drm_panel and the panel_bridge wrapping it. This makes lifetime much more straightforward to understand and to further develop on. As a consequence devm_drm_of_get_bridge() and drmm_of_get_bridge() don't need to look for a panel anymore and become simple wrappers to of_drm_get_bridge_by_endpoint(). Also deprecate them as they can be replaced by of_drm_get_bridge_by_endpoint() which also handles refcount. Signed-off-by: Luca Ceresoli --- drivers/gpu/drm/bridge/panel.c | 47 +++++++++++++++++++++-----------------= ---- drivers/gpu/drm/drm_panel.c | 3 +++ include/drm/drm_panel.h | 8 +++++++ 3 files changed, 34 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c index 02388a3de626..d86555254aa9 100644 --- a/drivers/gpu/drm/bridge/panel.c +++ b/drivers/gpu/drm/bridge/panel.c @@ -412,6 +412,11 @@ struct drm_bridge *devm_drm_panel_bridge_add_typed(str= uct device *dev, { struct drm_bridge **ptr, *bridge; =20 + if (panel->bridge) { + dev_dbg(dev, "returning existing bridge=3D%p\n", panel->bridge); + return panel->bridge; + } + ptr =3D devres_alloc(devm_drm_panel_bridge_release, sizeof(*ptr), GFP_KERNEL); if (!ptr) @@ -495,9 +500,12 @@ EXPORT_SYMBOL(drm_panel_bridge_connector); * @port: port in the device tree node * @endpoint: endpoint in the device tree node * + * This function is deprecated and should not be used in new drivers. The + * returned bridge refcount is not incremented! Replace by + * of_drm_get_bridge_by_endpoint() and handle bridge refcount. + * * Given a DT node's port and endpoint number, finds the connected node - * and returns the associated bridge if any, or creates and returns a - * drm panel bridge instance if a panel is connected. + * and returns the associated bridge if any. * * Returns a pointer to the bridge if successful, or an error pointer * otherwise. @@ -507,18 +515,12 @@ struct drm_bridge *devm_drm_of_get_bridge(struct devi= ce *dev, u32 port, u32 endpoint) { struct drm_bridge *bridge; - struct drm_panel *panel; - int ret; =20 - ret =3D drm_of_find_panel_or_bridge(np, port, endpoint, - &panel, &bridge); - if (ret) - return ERR_PTR(ret); + bridge =3D of_drm_get_bridge_by_endpoint(np, port, endpoint); + if (IS_ERR(bridge)) + return bridge; =20 - if (panel) { - bridge =3D devm_drm_panel_bridge_add(dev, panel); - drm_panel_put(panel); - } + drm_bridge_put(bridge); =20 return bridge; } @@ -531,9 +533,12 @@ EXPORT_SYMBOL(devm_drm_of_get_bridge); * @port: port in the device tree node * @endpoint: endpoint in the device tree node * + * This function is deprecated and should not be used in new drivers. The + * returned bridge refcount is not incremented! Replace by + * of_drm_get_bridge_by_endpoint() and handle bridge refcount. + * * Given a DT node's port and endpoint number, finds the connected node - * and returns the associated bridge if any, or creates and returns a - * drm panel bridge instance if a panel is connected. + * and returns the associated bridge if any. * * Returns a drmm managed pointer to the bridge if successful, or an error * pointer otherwise. @@ -543,18 +548,12 @@ struct drm_bridge *drmm_of_get_bridge(struct drm_devi= ce *drm, u32 port, u32 endpoint) { struct drm_bridge *bridge; - struct drm_panel *panel; - int ret; =20 - ret =3D drm_of_find_panel_or_bridge(np, port, endpoint, - &panel, &bridge); - if (ret) - return ERR_PTR(ret); + bridge =3D of_drm_get_bridge_by_endpoint(np, port, endpoint); + if (IS_ERR(bridge)) + return bridge; =20 - if (panel) { - bridge =3D drmm_panel_bridge_add(drm, panel); - drm_panel_put(panel); - } + drm_bridge_put(bridge); =20 return bridge; } diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c index f8f6082e637f..95fc95d1b4b7 100644 --- a/drivers/gpu/drm/drm_panel.c +++ b/drivers/gpu/drm/drm_panel.c @@ -453,6 +453,9 @@ void *__devm_drm_panel_alloc(struct device *dev, size_t= size, size_t offset, =20 drm_panel_init(panel, dev, funcs, connector_type); =20 + panel->bridge =3D devm_drm_panel_bridge_add(dev, panel); + WARN_ON(!panel->bridge); + return container; } EXPORT_SYMBOL(__devm_drm_panel_alloc); diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h index b87323443f49..9a042675eb3e 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -210,6 +210,14 @@ struct drm_panel { */ struct device *dev; =20 + /** + * @bridge: + * + * Pointer to the panel bridge giving access to the panel using the + * DRM bridge API. + */ + struct drm_bridge *bridge; + /** * @backlight: * --=20 2.55.0 From nobody Tue Sep 29 00:32:58 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 66C693AAF5F for ; Fri, 14 Aug 2026 14:07:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786716426; cv=none; b=ILYxeAsSASZ0NqeN2EAOaeO3dfXw+mRtGtEXRlZPouA03j9TlNKNtL+JNf5yv39HIbQ25IhAP9R1zPG/rCFBFBrvF6FhYp2tAYFhnAqMQbOhiWhP3zL+i36UFEO9rg9tLakPseelm/ZB2M8SKQFpiEsfPGPPnAlXMlJBZvfDrkM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786716426; c=relaxed/simple; bh=KmVxwlNHv8mjFDTkynC8RksZ4NTlWAdsntpkcLrSf8Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MhUbPcLC1kCD+pFvbfxMZnVtJmN2xQxsKar7qIeJCGa5LJqg1u3L5k/PVRLYUom54Zun1DCXqY2Ud++vhxp+jAyJN8SN0nmfnWbFzPbocC6NiKMLFRS6Nq1WS8yuxMWxTvTmPOFVjjUXilBEtCMoLRn1Y6CWUDNL/UwWO0cSLmM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=GfLApfCD; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="GfLApfCD" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id EDF7C1A163B; Fri, 14 Aug 2026 14:07:00 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id BFB776046D; Fri, 14 Aug 2026 14:07:00 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id E232811C4EDAB; Fri, 14 Aug 2026 16:06:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1786716415; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=dT6AqRBbgI42Tlee7k0qD3Mg6uWqZG1Wn4SiXDAn13E=; b=GfLApfCDHtz13LkAvF2GtvMiVcXAJE+yu9aEpdtUlkoX8r6dQrrnikJHoEGvMRh7umijCG tBMxB0nnrj/FQQwVStpzsoyQ8ghHk0C47VTzE0LhvhV3PawtLovOb2SUaS7z745NUVFBu1 aolP7JW8OQOaweJ+YuUCpq8ips8YY2UXzEKESp3NnSYrMLxSby1D4UPI5ed13zUE3iYf/h 96DI1TeV62rSFJWhOpLHLXd6PRdm+5Hm2KfJy+OWWltOxpLJpuS9nf2ClTYMUrU14x5orW scD+5RtbvS+GaP2q9oO1yTvIkhJ2VRYjA6boTOwoFLKQ/b+lw5+r+88s1l141Q== From: Luca Ceresoli Date: Fri, 14 Aug 2026 16:05:54 +0200 Subject: [PATCH 06/11] drm/bridge: tc358767: don't create a panel_bridge Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260814-drm-bridge-every-panel-v1-6-19cd5277cc8d@bootlin.com> References: <20260814-drm-bridge-every-panel-v1-0-19cd5277cc8d@bootlin.com> In-Reply-To: <20260814-drm-bridge-every-panel-v1-0-19cd5277cc8d@bootlin.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Jessica Zhang , Linus Walleij , Inki Dae , Jagan Teki , Marek Szyprowski Cc: Dmitry Baryshkov , Hui Pu , Ian Ray , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Luca Ceresoli X-Mailer: b4 0.16.0 X-Last-TLS-Session-Version: TLSv1.3 Now a panel_bridge is automatically created for every drm_panel, so this panel-only call to drm_of_find_panel_or_bridge() would lead to creating a second panel_bridge for the same panel. Fix and simplify the code by just getting a reference to the already-existing panel_bridge using of_drm_get_bridge_by_endpoint(). As of_drm_get_bridge_by_endpoint() returns a refcouncted bridge, take care of putting the bridge reference on removal. Signed-off-by: Luca Ceresoli --- drivers/gpu/drm/bridge/tc358767.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc3= 58767.c index ac83af7902cd..d282db507d59 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -2347,24 +2347,15 @@ static int tc_probe_dpi_bridge_endpoint(struct tc_d= ata *tc) static int tc_probe_edp_bridge_endpoint(struct tc_data *tc) { struct device *dev =3D tc->dev; - struct drm_panel *panel; - int ret; + struct drm_bridge *bridge; =20 /* port@2 is the output port */ - ret =3D drm_of_find_panel_or_bridge(dev->of_node, 2, 0, &panel, NULL); - if (ret && ret !=3D -ENODEV) - return dev_err_probe(dev, ret, - "Could not find DSI panel or bridge\n"); + bridge =3D of_drm_get_bridge_by_endpoint(dev->of_node, 2, 0); + if (IS_ERR(bridge) && PTR_ERR(bridge) !=3D -ENODEV) + return dev_err_probe(dev, PTR_ERR(bridge), "Could not find DSI bridge\n"= ); =20 - if (panel) { - struct drm_bridge *panel_bridge; - - panel_bridge =3D devm_drm_panel_bridge_add(dev, panel); - drm_panel_put(panel); - if (IS_ERR(panel_bridge)) - return PTR_ERR(panel_bridge); - - tc->panel_bridge =3D panel_bridge; + if (!IS_ERR(bridge)) { + tc->panel_bridge =3D bridge; tc->bridge.type =3D DRM_MODE_CONNECTOR_eDP; } else { tc->bridge.type =3D DRM_MODE_CONNECTOR_DisplayPort; @@ -2607,6 +2598,7 @@ static void tc_remove(struct i2c_client *client) { struct tc_data *tc =3D i2c_get_clientdata(client); =20 + drm_bridge_put(tc->panel_bridge); drm_bridge_remove(&tc->bridge); } =20 --=20 2.55.0 From nobody Tue Sep 29 00:32:58 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ADF893B7B64 for ; Fri, 14 Aug 2026 14:07:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786716430; cv=none; b=OTS33JMx32geReyOjkXZlkpKH7NMrk6jHEr+9Lx5zXEeEkqNUbLB2sQadjkpaToDsIf0U3LHcqEjH5deSFQ0JbsFf2Zceo2owe0Qm5fH+eAIelWeizdfjoQ7hN92njHKzDNuecAPNwCLD0ZDMT13h4xO4dbgbht8SBqtIfyXDY4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786716430; c=relaxed/simple; bh=5EUTZ45EZ7ERUo8JZccbvWEA+0gAUudF1GukT3TSwgA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GRiB4SDzE2yE9GdyjNQcCtlxyQ6yrFTayuzXgL+cnjdDBfvDPsFtHG+fEegke+Rk6NQNpdDi787z2pqswl+zB6c1Fx8ppkYtATc3Y0N+FxXqGDAUFCZN+w3lvqtSC0ohzwT9RPrnv4lk4rR5Qtmg8t136fP8pcZriY8s0DQGqpg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=zD2lVxK/; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="zD2lVxK/" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 740FD1A163D; Fri, 14 Aug 2026 14:07:04 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 489F36046D; Fri, 14 Aug 2026 14:07:04 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 02C4B11C4EDAF; Fri, 14 Aug 2026 16:06:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1786716423; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=W47g4Q+NYk342rCC6QpiuRC+u7VsigF4CoJiynORV1Y=; b=zD2lVxK/VXoKuOuAbtULGsk9nbiSaPBmFJLXxe4bs81JWRPnhaZn7vmRdR2Y7FbhJKCn9K a0n6r9jpHe7jgIfLI3EpJKiCydHJWRceaHvsMfMS9Qu2UkMd7Ud9TOKeLEg/Y/8+aYeCti ZVfN6jkCHJxui+c7KIncPZCSSpRbBXUI/sN+EsuZvToq5oQO7eEwOXGx3phhuIpgoutpE2 0l16xqQXmCQdnZh05mezWRssxshA3ZpTiyiOQfsyPmOsKqTZVBjVYP9iRimdGElmEQIHqO sETv5AGk3bWFThYa8URcUtUr3kqWrXzo6+iAJbciMu0cdQCmpmT1lQM80UUaEw== From: Luca Ceresoli Date: Fri, 14 Aug 2026 16:05:55 +0200 Subject: [PATCH 07/11] drm/bridge: waveshare-dsi: don't create a panel_bridge Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260814-drm-bridge-every-panel-v1-7-19cd5277cc8d@bootlin.com> References: <20260814-drm-bridge-every-panel-v1-0-19cd5277cc8d@bootlin.com> In-Reply-To: <20260814-drm-bridge-every-panel-v1-0-19cd5277cc8d@bootlin.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Jessica Zhang , Linus Walleij , Inki Dae , Jagan Teki , Marek Szyprowski Cc: Dmitry Baryshkov , Hui Pu , Ian Ray , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Luca Ceresoli X-Mailer: b4 0.16.0 X-Last-TLS-Session-Version: TLSv1.3 Now a panel_bridge is automatically created for every drm_panel, so this panel-only call to drm_of_find_panel_or_bridge() would lead to creating a second panel_bridge for the same panel. Fix and simplify the code by just getting a reference to the already-existing panel_bridge using of_drm_get_bridge_by_endpoint(). As of_drm_get_bridge_by_endpoint() returns a refcouncted bridge, take care of putting the bridge reference by using bridge->next_bridge. Signed-off-by: Luca Ceresoli --- drivers/gpu/drm/bridge/waveshare-dsi.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/bridge/waveshare-dsi.c b/drivers/gpu/drm/bridg= e/waveshare-dsi.c index 420f3b870a74..b79a1d32e679 100644 --- a/drivers/gpu/drm/bridge/waveshare-dsi.c +++ b/drivers/gpu/drm/bridge/waveshare-dsi.c @@ -20,7 +20,6 @@ =20 struct ws_bridge { struct drm_bridge bridge; - struct drm_bridge *next_bridge; struct backlight_device *backlight; struct device *dev; struct regmap *reg_map; @@ -89,7 +88,7 @@ static int ws_bridge_bridge_attach(struct drm_bridge *bri= dge, { struct ws_bridge *ws =3D bridge_to_ws_bridge(bridge); =20 - return drm_bridge_attach(encoder, ws->next_bridge, + return drm_bridge_attach(encoder, ws->bridge.next_bridge, &ws->bridge, flags); } =20 @@ -150,7 +149,6 @@ static struct backlight_device *ws_bridge_create_backli= ght(struct ws_bridge *ws) static int ws_bridge_probe(struct i2c_client *i2c) { struct device *dev =3D &i2c->dev; - struct drm_panel *panel; struct ws_bridge *ws; int ret; =20 @@ -164,14 +162,10 @@ static int ws_bridge_probe(struct i2c_client *i2c) if (IS_ERR(ws->reg_map)) return dev_err_probe(dev, PTR_ERR(ws->reg_map), "Failed to allocate regm= ap\n"); =20 - ret =3D drm_of_find_panel_or_bridge(dev->of_node, 1, -1, &panel, NULL); - if (ret) - return dev_err_probe(dev, ret, "Failed to find remote panel\n"); - - ws->next_bridge =3D devm_drm_panel_bridge_add(dev, panel); - drm_panel_put(panel); - if (IS_ERR(ws->next_bridge)) - return PTR_ERR(ws->next_bridge); + ws->bridge.next_bridge =3D of_drm_get_bridge_by_endpoint(dev->of_node, 1,= -1); + if (IS_ERR(ws->bridge.next_bridge)) + return dev_err_probe(dev, PTR_ERR(ws->bridge.next_bridge), + "Failed to find remote panel\n"); =20 ws->backlight =3D ws_bridge_create_backlight(ws); if (IS_ERR(ws->backlight)) { --=20 2.55.0 From nobody Tue Sep 29 00:32:58 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F02023B5847 for ; Fri, 14 Aug 2026 14:07:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786716438; cv=none; b=h1MutHRPMZ13a2/Z33ryvOEsqOQsyMZRkkNKtW7TL7qoBWGnj/nGwHrbyZB++cVWzYniQgpgRdF79R5nIU1kOUQPwfW6vp1CWCnBk1+YYdBuLm5g7tyE7CtuKaFBmAGBVhdG4KZugFtAEmSCuVptcuaeltO8XdowlSqIf+ebCQU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786716438; c=relaxed/simple; bh=d0TNum3GN9INftX0HEt6hAzMak4SERMpoBS8soqdS6Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LHcGal51tURxIA50gQ1pIXYYXjvUP/sDHJoHEnHG350/rTX3kSCxOvwN2be3WFMzkCx/HU9vxUdnkkJ9xgJEp296yWR5JCWrSuEX5JNTCm/oUxFELT196iF6mxOjEjwIeZI5+qeibEu8o8wHdyARFzz5y4WlhtAeL/PrPWgGrgQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=WIPS4UAV; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="WIPS4UAV" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 7CB541A163B; Fri, 14 Aug 2026 14:07:07 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 506F56046D; Fri, 14 Aug 2026 14:07:07 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 757E511C4EDA1; Fri, 14 Aug 2026 16:07:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1786716426; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=trlbVuPsHDRX0y+Dzwj1wjF2hFnAKucY/izeM875Oyc=; b=WIPS4UAVR70N55fEk0oZXnD1u6K1ADHbs8NvDuKJJ/MT5gl6IiSusvx+yjUZY4nElWBqOB rEzecEnra9M8T/2m5ELwj9d/5Ebbaccm0w3vW8j3/gmbZY76YFLadgviaj9trtZXpbt6eM A+sYI1b5HXfTFDBAL4+LnUZLlsOQesWvf2zXX/nX7BNmumJ+OWxgyXBDcdAZakXUEikLVD lYVgB6myrxe5fnuRVh13Fv9Dlmq9Ibxc/rTnR8MadH/yw9doDzMdZvzXfcn4sQ+8kHBFbU 8IPfElplRrywmcyF5hTQJV0qLaeU5x4eHcm4eEuCjHqp96aGCGzUj7biFMPVnQ== From: Luca Ceresoli Date: Fri, 14 Aug 2026 16:05:56 +0200 Subject: [PATCH 08/11] drm/mcde: dsi: simplify device_node management using scoped for_each variant Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260814-drm-bridge-every-panel-v1-8-19cd5277cc8d@bootlin.com> References: <20260814-drm-bridge-every-panel-v1-0-19cd5277cc8d@bootlin.com> In-Reply-To: <20260814-drm-bridge-every-panel-v1-0-19cd5277cc8d@bootlin.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Jessica Zhang , Linus Walleij , Inki Dae , Jagan Teki , Marek Szyprowski Cc: Dmitry Baryshkov , Hui Pu , Ian Ray , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Luca Ceresoli X-Mailer: b4 0.16.0 X-Last-TLS-Session-Version: TLSv1.3 Before further modifying this function, simpify the struct device_node management using the scoped variat of for_each_available_child_of_node(). Signed-off-by: Luca Ceresoli Reviewed-by: Linus Walleij Reviewed-by: Maxime Ripard --- drivers/gpu/drm/mcde/mcde_dsi.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/mcde/mcde_dsi.c b/drivers/gpu/drm/mcde/mcde_ds= i.c index 694372581840..ce078aa3910f 100644 --- a/drivers/gpu/drm/mcde/mcde_dsi.c +++ b/drivers/gpu/drm/mcde/mcde_dsi.c @@ -1076,7 +1076,6 @@ static int mcde_dsi_bind(struct device *dev, struct d= evice *master, struct drm_device *drm =3D data; struct mcde *mcde =3D to_mcde(drm); struct mcde_dsi *d =3D dev_get_drvdata(dev); - struct device_node *child; struct drm_panel *panel =3D NULL; struct drm_bridge *bridge __free(drm_bridge_put) =3D NULL; =20 @@ -1104,7 +1103,7 @@ static int mcde_dsi_bind(struct device *dev, struct d= evice *master, } =20 /* Look for a panel as a child to this node */ - for_each_available_child_of_node(dev->of_node, child) { + for_each_available_child_of_node_scoped(dev->of_node, child) { panel =3D of_drm_find_panel(child); if (IS_ERR(panel)) { dev_err(dev, "failed to find panel try bridge (%ld)\n", @@ -1114,15 +1113,12 @@ static int mcde_dsi_bind(struct device *dev, struct= device *master, bridge =3D of_drm_find_and_get_bridge(child); if (!bridge) { dev_err(dev, "failed to find bridge\n"); - of_node_put(child); return -EINVAL; } } =20 - if (panel || bridge) { - of_node_put(child); + if (panel || bridge) break; - } } if (panel) { bridge =3D drm_panel_bridge_add_typed(panel, --=20 2.55.0 From nobody Tue Sep 29 00:32:58 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D240399340 for ; Fri, 14 Aug 2026 14:07:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786716441; cv=none; b=iTjXNHb0CA+Soq3foQ34m8HBGLzfB6efMFB+shR1zW2rz9rfe3D/JUNGtPWDaC3Wx8Aav01WF4gvF+JEwen9QIDnkNO+EVU06Gb9XwvUax6R78JRt288ZhkgDn+DpCHdoBZi7ud106s1qeGXVd6bJRyDOEtDYGJmB4ota9M3p0E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786716441; c=relaxed/simple; bh=dCzPzVrmk0BK0HVMSjLKfWO4F+6OOU2XznR02TNpzH4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=vDm1bMA3y07Y6LAD+BDtNUcDRvm6JDjjQME3qiSaXn9iW1CXXFk38NhwP0edKvnYEoXWBw4i03xu0BYLdXDPjLPP0SStudB5zKpD8euO1u/1SSUd4ZBK9DVZv8U7ninaIkvTT6r7dSRpolvpYQmG93H+dnf07Vl+zff1rlMP6e4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=T2rchZE9; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="T2rchZE9" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id C978C1A163E; Fri, 14 Aug 2026 14:07:10 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 9D9436046D; Fri, 14 Aug 2026 14:07:10 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 810A111C4EDAC; Fri, 14 Aug 2026 16:07:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1786716429; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=wg9Z6U2nX3MY5HKjLc3CNfSHC+SBoJiWnAqc9hBYIZE=; b=T2rchZE9ru1tYXyFTGeDpkwu88ALQDXMpDtnRZh1hycn2jIK4XkOF5AjJ17ZI92rP7aU8D iGcYag9YQgPe4kIgI20ayvl/UJOeb3AhfTZXhrxqVSLWPaOc4UIj4f0zB6dfvijfczZG9A i8zWsvNH+8iz8n92qRoKUXxgxBST9WsdWXzli3SDN4d5Efrx9HwtyCIM4IDyvCpXvz1h/i egSjpYqktRVCJU17rk/VArIqT8b0gKEx6KKKk6w/7Kd0zk7LWci419JjkSGswHt+1y2ut2 rj1g8gKEddIkDY87igs1xRzFQCtfLomwVxq0RMVqpve+mqg9rOsBiJeDdr/qIg== From: Luca Ceresoli Date: Fri, 14 Aug 2026 16:05:57 +0200 Subject: [PATCH 09/11] drm/mcde: dsi: don't create a panel_bridge Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260814-drm-bridge-every-panel-v1-9-19cd5277cc8d@bootlin.com> References: <20260814-drm-bridge-every-panel-v1-0-19cd5277cc8d@bootlin.com> In-Reply-To: <20260814-drm-bridge-every-panel-v1-0-19cd5277cc8d@bootlin.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Jessica Zhang , Linus Walleij , Inki Dae , Jagan Teki , Marek Szyprowski Cc: Dmitry Baryshkov , Hui Pu , Ian Ray , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Luca Ceresoli X-Mailer: b4 0.16.0 X-Last-TLS-Session-Version: TLSv1.3 Now a panel_bridge is automatically created for every drm_panel, so this code (similar to an open-coded variant of drm_of_find_panel_or_bridge()) would lead to creating a second panel_bridge for the same panel. Fix and simplify the code by just getting a reference to the already-existing bridge. Also keep the "connected to non-panel bridge (unsupported)\n" error logic by using the drm_bridge_is_panel() function. Signed-off-by: Luca Ceresoli Reviewed-by: Linus Walleij --- drivers/gpu/drm/mcde/mcde_dsi.c | 41 +++++++++----------------------------= ---- 1 file changed, 9 insertions(+), 32 deletions(-) diff --git a/drivers/gpu/drm/mcde/mcde_dsi.c b/drivers/gpu/drm/mcde/mcde_ds= i.c index ce078aa3910f..ec45440d20d7 100644 --- a/drivers/gpu/drm/mcde/mcde_dsi.c +++ b/drivers/gpu/drm/mcde/mcde_dsi.c @@ -39,7 +39,6 @@ struct mcde_dsi { struct device *dev; struct mcde *mcde; struct drm_bridge bridge; - struct drm_panel *panel; struct mipi_dsi_host dsi_host; struct mipi_dsi_device *mdsi; const struct drm_display_mode *mode; @@ -1076,7 +1075,6 @@ static int mcde_dsi_bind(struct device *dev, struct d= evice *master, struct drm_device *drm =3D data; struct mcde *mcde =3D to_mcde(drm); struct mcde_dsi *d =3D dev_get_drvdata(dev); - struct drm_panel *panel =3D NULL; struct drm_bridge *bridge __free(drm_bridge_put) =3D NULL; =20 if (!of_get_available_child_count(dev->of_node)) { @@ -1104,40 +1102,21 @@ static int mcde_dsi_bind(struct device *dev, struct= device *master, =20 /* Look for a panel as a child to this node */ for_each_available_child_of_node_scoped(dev->of_node, child) { - panel =3D of_drm_find_panel(child); - if (IS_ERR(panel)) { - dev_err(dev, "failed to find panel try bridge (%ld)\n", - PTR_ERR(panel)); - panel =3D NULL; - - bridge =3D of_drm_find_and_get_bridge(child); - if (!bridge) { - dev_err(dev, "failed to find bridge\n"); - return -EINVAL; - } + bridge =3D of_drm_find_and_get_bridge(child); + if (!bridge) { + dev_err(dev, "failed to find bridge\n"); + return -EINVAL; } =20 - if (panel || bridge) - break; + break; } - if (panel) { - bridge =3D drm_panel_bridge_add_typed(panel, - DRM_MODE_CONNECTOR_DSI); - drm_panel_put(panel); - if (IS_ERR(bridge)) { - dev_err(dev, "error adding panel bridge\n"); - return PTR_ERR(bridge); - } - drm_bridge_get(bridge); - dev_info(dev, "connected to panel\n"); - d->panel =3D panel; - } else if (bridge) { + if (!bridge) { + dev_err(dev, "no panel or bridge\n"); + return -ENODEV; + } else if (!drm_bridge_is_panel(bridge)) { /* TODO: AV8100 HDMI encoder goes here for example */ dev_info(dev, "connected to non-panel bridge (unsupported)\n"); return -ENODEV; - } else { - dev_err(dev, "no panel or bridge\n"); - return -ENODEV; } =20 d->bridge.next_bridge =3D drm_bridge_get(bridge); @@ -1159,8 +1138,6 @@ static void mcde_dsi_unbind(struct device *dev, struc= t device *master, { struct mcde_dsi *d =3D dev_get_drvdata(dev); =20 - if (d->panel) - drm_panel_bridge_remove(d->bridge.next_bridge); regmap_update_bits(d->prcmu, PRCM_DSI_SW_RESET, PRCM_DSI_SW_RESET_DSI0_SW_RESETN, 0); } --=20 2.55.0 From nobody Tue Sep 29 00:32:58 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 72A5239E6F0 for ; Fri, 14 Aug 2026 14:07:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786716444; cv=none; b=NKd7LRpYLpRyqSs1WG/BF+i7bWorIQYGRpFwh6qjHGoMRH+H+s2jyrHkZhqm59rX5sMg/Y5cDjnciAX9sNCKk7pbHmbivcK1YRiR0nB+L6gwKbjfHx18i/hxpt8QL1quNbXfEycNhfstSRo4Sm5pGVhuQ10LqHiK3NKo39yEJxw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786716444; c=relaxed/simple; bh=KKLy5EMnklXPbhnvbu9dl30pgZLAa7WMR+ilI4JN1Cw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Hy4t9cHmRtg/m5iq04LjF0NyfXEcQ0ra2EheCwvy0587SP7jOQ2Jg0MadI1LNE9Z7KRRhxVDbGDLWgTOZsjznLEvgF1qft9jGT5VBC8GWavi680MIoBmgT6wMHRP9/UANygCLCalLpSeC60lx42xQKYxo2WM3CehBRIVFqtDtxM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=rMLFKARK; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="rMLFKARK" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 0DFE24E411D9; Fri, 14 Aug 2026 14:07:14 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id D576B6046D; Fri, 14 Aug 2026 14:07:13 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id D266511C4ED7A; Fri, 14 Aug 2026 16:07:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1786716432; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=7wLBGn50vSLQ8v56Mg7/uG9rJVn+UFZHymtVBTKFZ88=; b=rMLFKARKiuHkTTZj7Ef2UbJhsshBBSZ/ffcAasj1WbNlsU8NjdUdWj+TZ/awrD/hGuaH7Y SIEvmCntfNjvF33mkduugRe2uR4+YuuHaRtm6wCQkIScl1giFAUTiWWsv1A7/q/0qx7tYd xrz/hM0Ve4PRe+Yp5lFRn6yD1TuIs0sbA0oOpm1uRGdd7hiv9uagrFCbhsr6K0y+0i6VZk 6v6AV0+laWI+ksBqmmORcwqAzCgmqEJe4TiKZ6LUdmG+azgyRAOm6bQxN8DzXQaAwSqHx4 96o/EoY61EnQpFOTDr7ofmpv+NsZ01NhspxcdNOR6Dc3TGOyb+nzUA2zCBFkGg== From: Luca Ceresoli Date: Fri, 14 Aug 2026 16:05:58 +0200 Subject: [PATCH 10/11] drm/bridge: fsl-ldb: don't create a panel_bridge Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260814-drm-bridge-every-panel-v1-10-19cd5277cc8d@bootlin.com> References: <20260814-drm-bridge-every-panel-v1-0-19cd5277cc8d@bootlin.com> In-Reply-To: <20260814-drm-bridge-every-panel-v1-0-19cd5277cc8d@bootlin.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Jessica Zhang , Linus Walleij , Inki Dae , Jagan Teki , Marek Szyprowski Cc: Dmitry Baryshkov , Hui Pu , Ian Ray , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Luca Ceresoli X-Mailer: b4 0.16.0 X-Last-TLS-Session-Version: TLSv1.3 Now a panel_bridge is automatically created for every drm_panel, so this code, looking only for a panel and unconditionally creating a panel_bridge for it, would lead to creating a second panel_bridge for the same panel. Fix and simplify the code by just getting a reference to the already-existing bridge from of_drm_find_and_get_bridge(). And since of_drm_find_and_get_bridge() returns a refcounted bridge, take care of putting the bridge reference by using bridge->next_bridge. Signed-off-by: Luca Ceresoli --- drivers/gpu/drm/bridge/fsl-ldb.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/bridge/fsl-ldb.c b/drivers/gpu/drm/bridge/fsl-= ldb.c index 26cc72948f31..c289139b9273 100644 --- a/drivers/gpu/drm/bridge/fsl-ldb.c +++ b/drivers/gpu/drm/bridge/fsl-ldb.c @@ -86,7 +86,6 @@ static const struct fsl_ldb_devdata fsl_ldb_devdata[] =3D= { struct fsl_ldb { struct device *dev; struct drm_bridge bridge; - struct drm_bridge *panel_bridge; struct clk *clk; struct regmap *regmap; const struct fsl_ldb_devdata *devdata; @@ -119,7 +118,7 @@ static int fsl_ldb_attach(struct drm_bridge *bridge, { struct fsl_ldb *fsl_ldb =3D to_fsl_ldb(bridge); =20 - return drm_bridge_attach(encoder, fsl_ldb->panel_bridge, + return drm_bridge_attach(encoder, fsl_ldb->bridge.next_bridge, bridge, flags); } =20 @@ -298,7 +297,6 @@ static int fsl_ldb_probe(struct platform_device *pdev) struct device *dev =3D &pdev->dev; struct device_node *panel_node; struct device_node *remote1, *remote2; - struct drm_panel *panel; struct fsl_ldb *fsl_ldb; int dual_link; =20 @@ -339,19 +337,13 @@ static int fsl_ldb_probe(struct platform_device *pdev) fsl_ldb_is_dual(fsl_ldb) ? "dual-link mode" : fsl_ldb->ch0_enabled ? "channel 0" : "channel 1"); =20 - panel =3D of_drm_find_panel(panel_node); - of_node_put(panel_node); - if (IS_ERR(panel)) - return PTR_ERR(panel); - if (of_property_present(dev->of_node, "nxp,enable-termination-resistor")) fsl_ldb->use_termination_resistor =3D true; =20 - fsl_ldb->panel_bridge =3D devm_drm_panel_bridge_add(dev, panel); - drm_panel_put(panel); - if (IS_ERR(fsl_ldb->panel_bridge)) - return PTR_ERR(fsl_ldb->panel_bridge); - + fsl_ldb->bridge.next_bridge =3D of_drm_find_and_get_bridge(panel_node); + of_node_put(panel_node); + if (!fsl_ldb->bridge.next_bridge) + return -ENODEV; =20 if (fsl_ldb_is_dual(fsl_ldb)) { struct device_node *port1, *port2; --=20 2.55.0 From nobody Tue Sep 29 00:32:58 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 53A413AB284 for ; Fri, 14 Aug 2026 14:07:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786716449; cv=none; b=Wu4vkbUzYLi7uLfukb9ayJmZlsNNh/NI3CjBIJ2OgNIT1e7FhmjlU5ufD6vRLSS/pRlSOLPHMrJBccOHjeMozQ2dGijYCUUbHL/asSyIpoDf/9ujFnmeXIPU/WC+g6ER6O1La7TAaaFZ+39GLvFmBpQxIilm1Ivb8qZETmAzS0w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786716449; c=relaxed/simple; bh=QUlJ2DjVbensS4bunAagtEbwqE8e8cfHcWU9E/iK/ww=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QpIFJKyE1z1iv5e+d066CKXNiFiZEWDmXz/3WYI6G/uQun169S0yMNMGwlE6z9jkEzZNbSLbSMdYaseqMUTH9fuop1bfuy9V+V7juYa8lDefz1oNNJeY6Yoy150Yeq072INjL1athJEmTjbAoK0On9HQikwGPQkJjqFCwq16GGw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=MA44EJQx; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="MA44EJQx" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id E655F1A163F; Fri, 14 Aug 2026 14:07:17 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id B31CA6046D; Fri, 14 Aug 2026 14:07:17 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 15BA111C4EDA6; Fri, 14 Aug 2026 16:07:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1786716436; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=wBKbzNKqN/AUW/MwcDfWph24Igbq8cdctbKLdKXyxMI=; b=MA44EJQxDJD9YBscVgJPSCgKZ2FjvIFFUD99HvnMfux9U1pk8YdDXdVceO/7xENKxrCpan IOcjjqf61V8zrYcGBDFfv9eY+Iy68TLeixTdTHYONql2iFIR0ztFReB3PZH4e83lsSdEWX WbLQ3BkdAqcE3duj8pO7FPl3FoDsNHbAGHvAqMajZvg4e3CYl0n2opgaVBJp73ApcQg6qA hRWiBTJtwYHzh0aCaDlLW1Phqpp+I+2zrg43wIyOfKaYL7+h1xkh3heQ5mvCOovQSHN70H UJIaE6ZFfbxC4rviQ7SDwlJSN6UrbW6CNEXVWlQY+nGaP2eIDvAjxiOZga/NWw== From: Luca Ceresoli Date: Fri, 14 Aug 2026 16:05:59 +0200 Subject: [PATCH 11/11] drm/bridge: samsung-dsim: don't create a panel_bridge Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260814-drm-bridge-every-panel-v1-11-19cd5277cc8d@bootlin.com> References: <20260814-drm-bridge-every-panel-v1-0-19cd5277cc8d@bootlin.com> In-Reply-To: <20260814-drm-bridge-every-panel-v1-0-19cd5277cc8d@bootlin.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Jessica Zhang , Linus Walleij , Inki Dae , Jagan Teki , Marek Szyprowski Cc: Dmitry Baryshkov , Hui Pu , Ian Ray , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Luca Ceresoli X-Mailer: b4 0.16.0 X-Last-TLS-Session-Version: TLSv1.3 Now a panel_bridge is automatically created for every drm_panel, so this code (similar to an open-coded variant of drm_of_find_panel_or_bridge()) would lead to creating a second panel_bridge for the same panel. Fix and simplify the code by just getting a reference to the already-existing bridge. Signed-off-by: Luca Ceresoli --- drivers/gpu/drm/bridge/samsung-dsim.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge= /samsung-dsim.c index 5457a7b02a33..55d4e3aedb3d 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1898,7 +1898,6 @@ static int samsung_dsim_host_attach(struct mipi_dsi_h= ost *host, struct device *dev =3D dsi->dev; struct device_node *np =3D dev->of_node; struct device_node *remote; - struct drm_panel *panel; int ret =3D 0; =20 /* @@ -1931,21 +1930,9 @@ static int samsung_dsim_host_attach(struct mipi_dsi_= host *host, if (!remote) return -ENODEV; =20 - panel =3D of_drm_find_panel(remote); - if (!IS_ERR(panel)) { - next_bridge =3D devm_drm_panel_bridge_add(dev, panel); - drm_panel_put(panel); - if (IS_ERR(next_bridge)) { - ret =3D PTR_ERR(next_bridge); - next_bridge =3D NULL; // Inhibit the cleanup action on an ERR_PTR - } else { - drm_bridge_get(next_bridge); - } - } else { - next_bridge =3D of_drm_find_and_get_bridge(remote); - if (!next_bridge) - ret =3D -EINVAL; - } + next_bridge =3D of_drm_find_and_get_bridge(remote); + if (!next_bridge) + ret =3D -EINVAL; =20 of_node_put(remote); =20 --=20 2.55.0