From nobody Mon Feb 9 21:00:02 2026 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (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 25CEE340DB1; Sat, 31 Jan 2026 15:59:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769875142; cv=none; b=dWi6u389rRPb5uw4orcxsuIFlJwIQNruINTajQ3AGPh4OyoZKab6QRnocFjdZ/hFJxOB/5wNzEkq3ocoPODF66wOdz8EUullCPaTCWDg54uqNFUG4pOg1mqphageG8YCkZS46ZQ007gtC+I5v+NM+TqOUuozdXw+Y8pjKvbBzgI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769875142; c=relaxed/simple; bh=m2qDoKi91f3lAIwsCV6C3vIi8YqJ6O3APi5f5Uf5onY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gw6qvMTfXAE9Nc5KYhjAxNKZzCVu7gp4QXjMYKyfMHUIZJsvez56WO+VQlmfgakZqX+xil0zlgSzj3qZaU4wKUzrGu1RKEzitW85eH+qAmQdN+F6D9AGkyvLREZImN0CxOJnXIC/904+Ip8rknwMvPEmmUxvTFfSoVMyY5vVjaE= 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=fzMmmqFn; arc=none smtp.client-ip=185.171.202.116 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="fzMmmqFn" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 939F2C22F7F; Sat, 31 Jan 2026 15:59:03 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id AA1A1606B6; Sat, 31 Jan 2026 15:58:59 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 9735E119A88F3; Sat, 31 Jan 2026 16:58:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1769875138; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=rN3xt3h5v4YQ9J23cLsAxFTBdfizY8hmnA3Lo4/tdxE=; b=fzMmmqFnipcPBSbm3bJCtchU+67qXPft4La/14Rp1esg5WA85F1cyD0Oh97WbaA3nSoQxi VC+LnwQ3RITlnkoto/J7GiN9FU3XnwV4UdDme37IAUj2xQA7pIHj0GC8uyP0T527anWvda iG+wCgUPXh7LicPwmJh2RswEAyjNkPTgVzITS6OKTBtWvhkRI3Zl7+kfZ45wgEckjOYFMT 73jSnetbMzMzy5On+HtYhvADonMZqt71mKN1PJWHXjLDrUkS5adxxiDfX6+spKAVh/aRpy 6EM9judsNxy0bqCJzMjsZeqDYNFfIWBErZI7aKzlzsc7aR7ZI6T5pZo9F+hWpQ== From: Luca Ceresoli Date: Sat, 31 Jan 2026 16:58:36 +0100 Subject: [PATCH v2 4/6] drm/mcde: dsi: convert to of_drm_find_and_get_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: <20260131-drm-bridge-alloc-getput-drm_of_find_bridge-4-v2-4-e081bcdc1467@bootlin.com> References: <20260131-drm-bridge-alloc-getput-drm_of_find_bridge-4-v2-0-e081bcdc1467@bootlin.com> In-Reply-To: <20260131-drm-bridge-alloc-getput-drm_of_find_bridge-4-v2-0-e081bcdc1467@bootlin.com> To: Biju Das , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Anitha Chrisanthus , Linus Walleij , Laurent Pinchart , Tomi Valkeinen , Kieran Bingham , Geert Uytterhoeven , Magnus Damm , Tomi Valkeinen Cc: Hui Pu , Ian Ray , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Luca Ceresoli X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 of_drm_find_bridge() is deprecated. Move to its replacement of_drm_find_and_get_bridge() which gets a bridge reference, and ensure it is put when done. We need to handle the two cases: when a panel is found and when it isn't, even though the latter is not supported. So: * in case a panel is not found and bridge is, get a reference to the found bridge * in case a panel is found, get a reference to the panel_bridge when it is added, so the following code always get exactly one reference that it needs to put Finally, use the next_bridge pointer in struct drm_bridge in order to simplify putting the reference. Signed-off-by: Luca Ceresoli Reviewed-by: Linus Walleij --- Changes in v2: - Removed drm_bridge_put(), not needed after the previous patch changes: the loop cannot assign 'bridge' more than once now - Not added Linus' R-by because of this change --- drivers/gpu/drm/mcde/mcde_dsi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/mcde/mcde_dsi.c b/drivers/gpu/drm/mcde/mcde_ds= i.c index 5893fd2681b3..47d45897ed06 100644 --- a/drivers/gpu/drm/mcde/mcde_dsi.c +++ b/drivers/gpu/drm/mcde/mcde_dsi.c @@ -40,7 +40,6 @@ struct mcde_dsi { struct mcde *mcde; struct drm_bridge bridge; struct drm_panel *panel; - struct drm_bridge *bridge_out; struct mipi_dsi_host dsi_host; struct mipi_dsi_device *mdsi; const struct drm_display_mode *mode; @@ -1060,7 +1059,7 @@ static int mcde_dsi_bridge_attach(struct drm_bridge *= bridge, } =20 /* Attach the DSI bridge to the output (panel etc) bridge */ - return drm_bridge_attach(encoder, d->bridge_out, bridge, flags); + return drm_bridge_attach(encoder, d->bridge.next_bridge, bridge, flags); } =20 static const struct drm_bridge_funcs mcde_dsi_bridge_funcs =3D { @@ -1076,7 +1075,7 @@ static int mcde_dsi_bind(struct device *dev, struct d= evice *master, struct mcde_dsi *d =3D dev_get_drvdata(dev); struct device_node *child; struct drm_panel *panel =3D NULL; - struct drm_bridge *bridge =3D NULL; + struct drm_bridge *bridge __free(drm_bridge_put) =3D NULL; =20 if (!of_get_available_child_count(dev->of_node)) { dev_info(dev, "unused DSI interface\n"); @@ -1109,7 +1108,7 @@ static int mcde_dsi_bind(struct device *dev, struct d= evice *master, PTR_ERR(panel)); panel =3D NULL; =20 - bridge =3D of_drm_find_bridge(child); + bridge =3D of_drm_find_and_get_bridge(child); if (!bridge) { dev_err(dev, "failed to find bridge\n"); of_node_put(child); @@ -1129,6 +1128,7 @@ static int mcde_dsi_bind(struct device *dev, struct d= evice *master, 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) { @@ -1140,7 +1140,7 @@ static int mcde_dsi_bind(struct device *dev, struct d= evice *master, return -ENODEV; } =20 - d->bridge_out =3D bridge; + d->bridge.next_bridge =3D drm_bridge_get(bridge); =20 /* Create a bridge for this DSI channel */ d->bridge.of_node =3D dev->of_node; @@ -1160,7 +1160,7 @@ 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_out); + 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.52.0