From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C0637CD342C for ; Mon, 4 May 2026 10:46:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2055610E657; Mon, 4 May 2026 10:46:03 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="McGIlkQL"; dkim-atps=neutral Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9673910E651 for ; Mon, 4 May 2026 10:46:01 +0000 (UTC) Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id CCE76C5D72B; Mon, 4 May 2026 10:46:46 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 7682E5FD5F; Mon, 4 May 2026 10:46:00 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 5C14611AD2697; Mon, 4 May 2026 12:45:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1777891558; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=yUEV9MYSt3pHOUbVC0XEstJh+n5Nd9x9JzYSEpAeTFA=; b=McGIlkQLxAaeShqBoEvdrTM5fFesioCNkCLtafyxwCYfTwd3EVgpNQ2nCqYGEYEM1Xhbiv rqBkN7qzsAOzABelx+a09kgKTj72VRZLeIIy80rAoKN0ZOnw5QBJOl0UqWdIcvLQIkBPHZ CaG9upRrgU3APYACR8lQXFKGNCphYc1iE9cxpVQpvFVo6rlxwzT9tUDg+VenmVpQsYEqMI sqnrp0Ry3YKXWJfvzpReE5UtXf9OkTjtc+cpHsmL4b5kQ4Toi8/VIq5pzwSqWE1+D4QNXH klxmCSmhB8bBkS25tR5DXZhARN6oxSCHdA+O1uw5+esIlANyzDswlXVdAczsWA== From: Luca Ceresoli Date: Mon, 04 May 2026 12:45:12 +0200 Subject: [PATCH v4 09/11] drm/bridge: lt8713sx: switch to of_drm_get_bridge_by_endpoint() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260504-drm-bridge-alloc-getput-panel_or_bridge-v4-9-b578c3daaf10@bootlin.com> References: <20260504-drm-bridge-alloc-getput-panel_or_bridge-v4-0-b578c3daaf10@bootlin.com> In-Reply-To: <20260504-drm-bridge-alloc-getput-panel_or_bridge-v4-0-b578c3daaf10@bootlin.com> To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Sean Paul , Marijn Suijten , Sumit Semwal , John Stultz , Tomi Valkeinen , Michal Simek Cc: Hui Pu , Ian Ray , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, Luca Ceresoli , Dmitry Baryshkov X-Mailer: b4 0.15.2 X-Last-TLS-Session-Version: TLSv1.3 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This driver calls drm_of_find_panel_or_bridge() with a NULL pointer in the @panel parameter, thus using a reduced feature set of that function. Replace this call with the simpler of_drm_get_bridge_by_endpoint(). Since of_drm_get_bridge_by_endpoint() increases the refcount of the returned bridge, ensure it is put on removal. To achieve this, instead of adding an explicit drm_bridge_put(), migrate to the bridge::next_bridge pointer which is automatically put when the bridge is eventually freed. Reviewed-by: Dmitry Baryshkov Signed-off-by: Luca Ceresoli --- drivers/gpu/drm/bridge/lontium-lt8713sx.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt8713sx.c b/drivers/gpu/drm/bridge/lontium-lt8713sx.c index 18fac6a46db4..cee485adf5e5 100644 --- a/drivers/gpu/drm/bridge/lontium-lt8713sx.c +++ b/drivers/gpu/drm/bridge/lontium-lt8713sx.c @@ -32,7 +32,6 @@ DECLARE_CRC8_TABLE(lt8713sx_crc_table); struct lt8713sx { struct device *dev; struct drm_bridge bridge; - struct drm_bridge *next_bridge; struct regmap *regmap; /* Protects all accesses to registers by stopping the on-chip MCU */ @@ -458,7 +457,7 @@ static int lt8713sx_bridge_attach(struct drm_bridge *bridge, struct lt8713sx *lt8713sx = container_of(bridge, struct lt8713sx, bridge); return drm_bridge_attach(encoder, - lt8713sx->next_bridge, + lt8713sx->bridge.next_bridge, bridge, flags); } @@ -537,10 +536,9 @@ static int lt8713sx_probe(struct i2c_client *client) if (IS_ERR(lt8713sx->regmap)) return dev_err_probe(dev, PTR_ERR(lt8713sx->regmap), "regmap i2c init failed\n"); - ret = drm_of_find_panel_or_bridge(lt8713sx->dev->of_node, 1, -1, NULL, - <8713sx->next_bridge); - if (ret < 0) - return ret; + lt8713sx->bridge.next_bridge = of_drm_get_bridge_by_endpoint(lt8713sx->dev->of_node, 1, -1); + if (IS_ERR(lt8713sx->bridge.next_bridge)) + return PTR_ERR(lt8713sx->bridge.next_bridge); ret = lt8713sx_gpio_init(lt8713sx); if (ret < 0) -- 2.53.0