From nobody Thu Oct 2 18:15:56 2025 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 D0AB432253A for ; Fri, 12 Sep 2025 17:04:13 +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=1757696656; cv=none; b=LK4d2va06hbBZ06qA9Qmn3EdIifZiFwlmmCStOxj8+zWAlq3ZFD0dBSb2IZlGQ43CX8E2+2Y9Az9LY/WfyLWzEMBnn7rE/BwbJhJTNgQk1FObN92P6R3K8H63pZFxC/7YdKvInGo3wIUwpd+x3+BW3s+lFLr11HRfQWaow1mWZI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757696656; c=relaxed/simple; bh=bLV44phdZF6IwzElEWY6DCNKe/BP3KfKgsfZQgqScks=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VVeeesgQVQmb7oTn58v5wx3dH01a8rftH7LtYlp+k079TEG9bZRLjOLvuSGM0zIPeip3dPu/ImbbUgL1hhyJ/8YqzvNW4FQDwwkQO8mD2MFwTT8Z3sVqb1nkKFbBYqYT27cdGvRm7X7YYnDebU3oqPrdfFqdWAcvWigA1ga5SnA= 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=WB3kqPDw; 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="WB3kqPDw" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id D6C41C6B3A1; Fri, 12 Sep 2025 17:03:55 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id D733960638; Fri, 12 Sep 2025 17:04:11 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 97C05102F29DE; Fri, 12 Sep 2025 19:04:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1757696650; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=VeIuv3p4vjC6zIz1+BgG4iyoBoMir2Kb6ZfTMyf/iCE=; b=WB3kqPDwQLyNQe/deyMo2e6Unw4gHLGsq63w2MTopgrErcUwzgWytMgUprczAUlUlafGQY WGJvwBaoOA8iTVCJKuOGzA0KaE1f8Mprd1g38NbeLBkD/bVibEkg6sdfmH3lvhwEEsQTaX WkWBh0hM6uggb2a83DY9/R9D/6PfjJNgsoTUgNqfBflytZcvv+0KLdTxCpebDbzTVfgDxe OlARIpUFYxbZFNEYoLVmWQi7gpsCxBD89JaGQq2nNXi3pOiXfV14K08LCcknf4B/jZDaIy Hy2/uKlu6ECy5ssS4KTPNV/ZmEnLBSEbCgEjOEeAHKBTSGKc5UOqn5bY5Qf1CA== From: Luca Ceresoli Date: Fri, 12 Sep 2025 19:03:41 +0200 Subject: [PATCH v8 1/3] drm/bridge: add list of removed refcounted bridges 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: <20250912-drm-bridge-debugfs-removed-v8-1-5c33d87ccb55@bootlin.com> References: <20250912-drm-bridge-debugfs-removed-v8-0-5c33d87ccb55@bootlin.com> In-Reply-To: <20250912-drm-bridge-debugfs-removed-v8-0-5c33d87ccb55@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 Cc: Hui Pu , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Luca Ceresoli , Dmitry Baryshkov X-Mailer: b4 0.14.2 X-Last-TLS-Session-Version: TLSv1.3 Between drm_bridge_add() and drm_bridge_remove() bridges are registered to the DRM core via the global bridge_list and visible in /sys/kernel/debug/dri/bridges. However between drm_bridge_remove() and the last drm_bridge_put() memory is still allocated even though the bridge is not registered, i.e. not in bridges_list, and also not visible in debugfs. This prevents debugging refcounted bridges lifetime, especially leaks due to a missing drm_bridge_put(). In order to allow debugfs to also show the removed bridges, move such bridges into a new ad-hoc list until they are eventually freed. Note this requires adding INIT_LIST_HEAD(&bridge->list) in the bridge initialization code. The lack of such init was not exposing any bug so far, but it would with the new code, for example when a bridge is allocated and then freed without calling drm_bridge_add(), which is common on probe errors. drm_bridge_add() needs special care for bridges being added after having been previously added and then removed. This happens for example for many non-DCS DSI host bridge drivers like samsung-dsim which drm_bridge_add/remove() themselves every time the DSI device does a DSI attaches/detach. When the DSI device is hot-pluggable this happens multiple times in the lifetime of the DSI host bridge. On every attach after the first one, drm_bridge_add() finds bridge->list in the removed list, not at the initialized state as drm_bridge_add() currently expects. Add a list_del_init() to remove the bridge from the lingering list and bring bridge->list back to the initialized state. Signed-off-by: Luca Ceresoli Reviewed-by: Maxime Ripard --- Changes in v8: - split the documentation changes to a separate patch - rename "removed" to "lingering" - improve commits message about the special care needed for "un-removed" bridges Changes in v7: - rebase on current drm-misc-next - remove if (drm_bridge_is_refcounted(bridge)), refcounting is now mandatory - add check to detect when re-adding a bridge that is in the removed list - improve commit message - fix typo This patch was added in v6. --- drivers/gpu/drm/drm_bridge.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index 5ec2ff77da79e51f614f98ebe58b6171c611867a..9491ae7c884d355be4a82fb02a4= 3a42d17fa8e0c 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -197,15 +197,22 @@ * driver. */ =20 +/* Protect bridge_list and bridge_lingering_list */ static DEFINE_MUTEX(bridge_lock); static LIST_HEAD(bridge_list); +static LIST_HEAD(bridge_lingering_list); =20 static void __drm_bridge_free(struct kref *kref) { struct drm_bridge *bridge =3D container_of(kref, struct drm_bridge, refco= unt); =20 + mutex_lock(&bridge_lock); + list_del(&bridge->list); + mutex_unlock(&bridge_lock); + if (bridge->funcs->destroy) bridge->funcs->destroy(bridge); + kfree(bridge->container); } =20 @@ -275,6 +282,7 @@ void *__devm_drm_bridge_alloc(struct device *dev, size_= t size, size_t offset, return ERR_PTR(-ENOMEM); =20 bridge =3D container + offset; + INIT_LIST_HEAD(&bridge->list); bridge->container =3D container; bridge->funcs =3D funcs; kref_init(&bridge->refcount); @@ -304,6 +312,14 @@ void drm_bridge_add(struct drm_bridge *bridge) =20 drm_bridge_get(bridge); =20 + /* + * If the bridge was previously added and then removed, it is now + * in bridge_lingering_list. Remove it or bridge_lingering_list will be + * corrupted when adding this bridge to bridge_list below. + */ + if (!list_empty(&bridge->list)) + list_del_init(&bridge->list); + mutex_init(&bridge->hpd_mutex); =20 if (bridge->ops & DRM_BRIDGE_OP_HDMI) @@ -357,7 +373,7 @@ void drm_bridge_remove(struct drm_bridge *bridge) br->funcs->bridge_event_notify(br, DRM_EVENT_BRIDGE_REMOVING, bridge); =20 mutex_lock(&bridge_lock); - list_del_init(&bridge->list); + list_move_tail(&bridge->list, &bridge_lingering_list); mutex_unlock(&bridge_lock); =20 mutex_destroy(&bridge->hpd_mutex); --=20 2.51.0 From nobody Thu Oct 2 18:15:56 2025 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 EB42530DED0 for ; Fri, 12 Sep 2025 17:04:15 +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=1757696658; cv=none; b=LohwOsZrQVYMsGUWpCODxSzmcAoL6VluZQ6DzInkzDTDSuW5alIPx0X0eYf7w0o21iSUhPwr07GIXUWbUN3itZI5umKAQ2hy7iuu39eg05Al/mMo/lvairpZ8Z8k/eK6x5LwNf3oog3nKUdHPe2MFBI6wWBfFIM4eVM1uThq8RI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757696658; c=relaxed/simple; bh=vuSX4FsmbWEEZpJ2iPXX3RYpav4VQJePAQGIRAt6hS4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iIoBtptDz1643ja7HOYLC/UJNrPGiRVbBS60jAdmPv2wwOyJhMxwC5RVhpVZhx8BrQbzSruRIwSEq9SbZgzXnRkBoEHVHJXFirl89RmorVr8OHbro0XNqZFQpE1+NTHHibqnTtyCtRreI30An37tqrjpx9q8jx1+Nx4YIKemxW0= 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=IH4OJtqO; 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="IH4OJtqO" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 86A9B1A0DAF; Fri, 12 Sep 2025 17:04:14 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 5C7B360638; Fri, 12 Sep 2025 17:04:14 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 5D9D2102F2A07; Fri, 12 Sep 2025 19:04:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1757696653; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=0FN+VQXH0gC957+CRfqZ7uNe9rZqNRVL8JKOdPNEbBI=; b=IH4OJtqOMV2F8MuFwjZurDp6r3Yg2bVrJ8qcFJ8GoqNNyl8nGxFFgE886dZgq4ayNwMUjs 6PhsXDJp1L7oryqO3JqoYgdTikkGaZfZG9SIdYSxJAyl8sgTyv3NgCwTJOzsF27PSdoIhY 3E9htP8NUJXvq13qQl1lHihPvbRuGlYbrUMGgkpQ7kyeVRAkUF6XYnoGqGELWAwfHQNlBP UZMgG2khlwOV4llSmRGR/LYgJrIVPAQJUVhxivlLLaGFrhpqlEgyN07SN3XzMrmgPelawi OQTCy0ga4CVXgkAu5oSSbaZ6W9ROsHjRRcMQnJf5cOTRO1nBR1CRwczFFyYqMQ== From: Luca Ceresoli Date: Fri, 12 Sep 2025 19:03:42 +0200 Subject: [PATCH v8 2/3] drm/debugfs: show removed bridges 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: <20250912-drm-bridge-debugfs-removed-v8-2-5c33d87ccb55@bootlin.com> References: <20250912-drm-bridge-debugfs-removed-v8-0-5c33d87ccb55@bootlin.com> In-Reply-To: <20250912-drm-bridge-debugfs-removed-v8-0-5c33d87ccb55@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 Cc: Hui Pu , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Luca Ceresoli , Dmitry Baryshkov X-Mailer: b4 0.14.2 X-Last-TLS-Session-Version: TLSv1.3 The usefulness of /sys/kernel/debug/dri/bridges is limited as it only shows bridges between drm_bridge_add() and drm_bridge_remove(). However refcounted bridges can stay allocated for a long time after drm_bridge_remove(), and a memory leak due to a missing drm_bridge_put() would not be visible in this debugfs file. Add removed bridges to the /sys/kernel/debug/dri/bridges output. Signed-off-by: Luca Ceresoli Reviewed-by: Maxime Ripard --- Changes in v8: - updated to rename bridge_removed_list -> bridge_lingering_list Changes in v7: - rebased on current code which is in drm_bridge.c now - removed if (drm_bridge_is_refcounted(bridge)), refcounting is not optional - don't show bridge address - improve commit message This patch was added in v6. --- drivers/gpu/drm/drm_bridge.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index 9491ae7c884d355be4a82fb02a43a42d17fa8e0c..fccc42017fd4df6ecfb596325df= 2dc4d17566f39 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -1491,17 +1491,20 @@ EXPORT_SYMBOL(devm_drm_put_bridge); =20 static void drm_bridge_debugfs_show_bridge(struct drm_printer *p, struct drm_bridge *bridge, - unsigned int idx) + unsigned int idx, + bool removed) { drm_printf(p, "bridge[%u]: %ps\n", idx, bridge->funcs); =20 - drm_printf(p, "\trefcount: %u\n", kref_read(&bridge->refcount)); + drm_printf(p, "\trefcount: %u%s\n", kref_read(&bridge->refcount), + removed ? " [removed]" : ""); =20 drm_printf(p, "\ttype: [%d] %s\n", bridge->type, drm_get_connector_type_name(bridge->type)); =20 - if (bridge->of_node) + /* The OF node could be freed after drm_bridge_remove() */ + if (bridge->of_node && !removed) drm_printf(p, "\tOF: %pOFfc\n", bridge->of_node); =20 drm_printf(p, "\tops: [0x%x]", bridge->ops); @@ -1527,7 +1530,10 @@ static int allbridges_show(struct seq_file *m, void = *data) mutex_lock(&bridge_lock); =20 list_for_each_entry(bridge, &bridge_list, list) - drm_bridge_debugfs_show_bridge(&p, bridge, idx++); + drm_bridge_debugfs_show_bridge(&p, bridge, idx++, false); + + list_for_each_entry(bridge, &bridge_lingering_list, list) + drm_bridge_debugfs_show_bridge(&p, bridge, idx++, true); =20 mutex_unlock(&bridge_lock); =20 @@ -1542,7 +1548,7 @@ static int encoder_bridges_show(struct seq_file *m, v= oid *data) unsigned int idx =3D 0; =20 drm_for_each_bridge_in_chain_scoped(encoder, bridge) - drm_bridge_debugfs_show_bridge(&p, bridge, idx++); + drm_bridge_debugfs_show_bridge(&p, bridge, idx++, false); =20 return 0; } --=20 2.51.0 From nobody Thu Oct 2 18:15:56 2025 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 5821A324B3B for ; Fri, 12 Sep 2025 17:04: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=1757696660; cv=none; b=BB9uuhMFGX00sQly/LWmoC6PCeeRj3ibdAu2O+aD8zsdphfQaoH0rlcDnh4xyiwUqKfNeMK+SZoQ4nRAsgQyP1+febESzIQqV4Gqza0Pdlf/fwqzYtTmPB3SA6TSe2mnGAgbiQDgnavF0iHdV7Vf5l4MNA4idq0Awpf7zGxAfcA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757696660; c=relaxed/simple; bh=NTVQLmxkeT6zaBWqWrh3MzMF5kVQNlli4aOM22XOisQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sEJt1GVeOZ04MsIkqPJX+G2q94o0Kp5RQczN/7njOIMqfz4sKq1r/jpykbUMUBOqt7ejrmkujoEHFK1+X+x6W7CozMA+4a3oI/VmAfprU4VIOto0YHLDtUROknJtPde423ejrypnH9240s7xml8VAJnFI00DsjeFrmG4+2jIn5s= 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=K+lA6hZo; 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="K+lA6hZo" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id BD0644E40C77; Fri, 12 Sep 2025 17:04:16 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 9498D60638; Fri, 12 Sep 2025 17:04:16 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id E88AE102F295C; Fri, 12 Sep 2025 19:04:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1757696655; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=FEZ1jJCZv48VMdKDRQ5LuktGboUwlVW2TP9ATDwpDto=; b=K+lA6hZomSNp04H6VpspZHYqW2Do8s+o3GORlSlA20Ybs6R73nI+/+kren6RYxgXB9qp1R mw5/RxIt+tvg4uy4N5M3nTYRoeF8neTRNTkBdZQ4AVTEH+5YQSx1fiSPKAyCJ5hQovoD4o tNgzUoezVM6edlF0rf5aWw9LLUhWRJl4ecs6uMYizXvePc/9cH6SFKqbtR1LRUjBvRYnID cPR5er+66zR0eupKHcUK6q+V1eZtsHfZivsN19NRaHoQULzLeEsFFIR8ffIV3Nk/2QBVHi sjgkeg8w8TywstN66mdkcPxUV0TZ7saV3pwZbcC5WuZLiVxQ8jdovv5xaJVmOA== From: Luca Ceresoli Date: Fri, 12 Sep 2025 19:03:43 +0200 Subject: [PATCH v8 3/3] drm/bridge: adapt drm_bridge_add/remove() docs, mention the lingering list 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: <20250912-drm-bridge-debugfs-removed-v8-3-5c33d87ccb55@bootlin.com> References: <20250912-drm-bridge-debugfs-removed-v8-0-5c33d87ccb55@bootlin.com> In-Reply-To: <20250912-drm-bridge-debugfs-removed-v8-0-5c33d87ccb55@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 Cc: Hui Pu , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Luca Ceresoli , Dmitry Baryshkov X-Mailer: b4 0.14.2 X-Last-TLS-Session-Version: TLSv1.3 The role of drm_bridge_add/remove() is more complex now after having added the lingering list. Update the kdoc accordingly. Also stop mentioning the global list(s) in the first line of the docs: the most important thing to mention here is that bridges are registered and deregistered, lists are just the type of container used to implement such (de)registration. Signed-off-by: Luca Ceresoli Reviewed-by: Maxime Ripard --- Changes in v8: - extracted to an ad-hoc patch from the v7 patch "drm/bridge: add list of removed refcounted bridges" --- drivers/gpu/drm/drm_bridge.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index fccc42017fd4df6ecfb596325df2dc4d17566f39..9a3db8f5adc8a4d1265679335d7= b05d0705194b7 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -296,10 +296,13 @@ void *__devm_drm_bridge_alloc(struct device *dev, siz= e_t size, size_t offset, EXPORT_SYMBOL(__devm_drm_bridge_alloc); =20 /** - * drm_bridge_add - add the given bridge to the global bridge list + * drm_bridge_add - register a bridge * * @bridge: bridge control structure * + * Add the given bridge to the global list of bridges, where they can be + * found by users via of_drm_find_bridge(). + * * The bridge to be added must have been allocated by * devm_drm_bridge_alloc(). */ @@ -360,9 +363,14 @@ int devm_drm_bridge_add(struct device *dev, struct drm= _bridge *bridge) EXPORT_SYMBOL(devm_drm_bridge_add); =20 /** - * drm_bridge_remove - remove the given bridge from the global bridge list + * drm_bridge_remove - unregister a bridge * * @bridge: bridge control structure + * + * Remove the given bridge from the global list of registered bridges, so + * it won't be found by users via of_drm_find_bridge(), and add it to the + * lingering bridge list, to keep track of it until its allocated memory is + * eventually freed. */ void drm_bridge_remove(struct drm_bridge *bridge) { --=20 2.51.0