From nobody Wed Oct 22 15:53:55 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 1B1F31FA178 for ; Tue, 21 Oct 2025 21:01:21 +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=1761080485; cv=none; b=pUFUf0H2VEXuUkqqPwaOu/haK4YBP9pDZMAEZc99kVKfc5Y3b5xYRn/xsyO3oGwpnDWoTmTRjWZ1z0CKckhbPumDHTdXsaVAmjNUDbobPTKhZoZkuOKgy5FIOHezPolCPddDl8i/01uvaHa1dXxZseCEJ/datrox+a6unheNiK8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761080485; c=relaxed/simple; bh=GukjzdhrNSwMkpDtdNr9biLEjMNTzBdyrnCWtzsvraM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PbL0tmnecFWBQ5kG23kgk/G/v56cApxqbDw1fQdV1+IA/zV0pWmjd/fGUkk3MVDlxwh78lou49Br4SAI/Iwe2WUdxcg6TyNOD0NbxiUQ317eD2fAaKap+U3UJo5MiOU6Vpzarr6x206P0oYqmK6yJRXEiphlLuEs67ad8NAwle4= 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=neaVNvmC; 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="neaVNvmC" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 65C2AC0B8A3; Tue, 21 Oct 2025 21:01:00 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 1AAE260680; Tue, 21 Oct 2025 21:01:20 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 4F249102F2416; Tue, 21 Oct 2025 23:01:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1761080479; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=b0w3PlRCn8AXDASJDWQBx6mglmsv4W7JDgIPcOEiCNo=; b=neaVNvmCD5ETz7+fvroOyps0QsXqsLCHCndlM86FhF/RRbvG+D53Yt6u3iIq98RJjIhnG0 /aeTCkZuMq4NvdVQ5IxCFdJ4GLO/VU0JHVFAn+cPEliuAS9T8SJTj25CAtnrgwdt6eqfGg u5GUN6saY0UFl0BsU4GIpsmibG3yGn2iVudAYSfuMD0p95UkLmfwfjQdfMH8Ht+uCJddUt Jez1MpR3LvO57fW8zT24+R1jXIR7qrdwXApa1CEkQwVXYGmkX/uB53A8m+icBAAe1QEyvv uCgAIiCadrKK2JpfpdK2T8Xwzu8rQtJk10gTLsO+o66GglB969aDfYCHAI4+hw== From: Luca Ceresoli Date: Tue, 21 Oct 2025 23:00:44 +0200 Subject: [PATCH v2 1/5] drm/sti: hda: add bridge before attaching 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: <20251021-b4-drm-bridge-alloc-add-before-attach-v2-1-c17cc1bbff72@bootlin.com> References: <20251021-b4-drm-bridge-alloc-add-before-attach-v2-0-c17cc1bbff72@bootlin.com> In-Reply-To: <20251021-b4-drm-bridge-alloc-add-before-attach-v2-0-c17cc1bbff72@bootlin.com> To: Alain Volmat , Raphael Gallais-Pou , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Raphael Gallais-Pou Cc: Hui Pu , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Luca Ceresoli X-Mailer: b4 0.14.2 X-Last-TLS-Session-Version: TLSv1.3 DRM bridges should be always added to the global bridge list before being attached. Link: https://lore.kernel.org/all/20250709-sophisticated-loon-of-rain-6ccdd= 8@houat/ Acked-by: Raphael Gallais-Pou Signed-off-by: Luca Ceresoli --- drivers/gpu/drm/sti/sti_hda.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c index 2c015f563de96ae58959801493ead870c49f70e5..b7397827889c94d6f8e8c2a48b0= 9f06e29ceeaf7 100644 --- a/drivers/gpu/drm/sti/sti_hda.c +++ b/drivers/gpu/drm/sti/sti_hda.c @@ -779,6 +779,8 @@ static int sti_hda_probe(struct platform_device *pdev) return PTR_ERR(hda->clk_hddac); } =20 + drm_bridge_add(&hda->bridge); + platform_set_drvdata(pdev, hda); =20 return component_add(&pdev->dev, &sti_hda_ops); @@ -786,7 +788,10 @@ static int sti_hda_probe(struct platform_device *pdev) =20 static void sti_hda_remove(struct platform_device *pdev) { + struct sti_hda *hda =3D platform_get_drvdata(pdev); + component_del(&pdev->dev, &sti_hda_ops); + drm_bridge_remove(&hda->bridge); } =20 static const struct of_device_id hda_of_match[] =3D { --=20 2.51.0 From nobody Wed Oct 22 15:53:55 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 A2D2B23B605 for ; Tue, 21 Oct 2025 21:01:24 +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=1761080486; cv=none; b=eGod/bjeOkIxkMl7Tmm/4eBocm0Rt+MW17yY0x8XzcuTv0CNLUQ2QFS4z/EJ5ZhxyHo585hHp32iYF4ggSnyoWyl5RpGP0Aiau0qoLk67yDyMG/kNt7NrsBTQcP6FaPezDzVcvYo5aaV3+WAJFdFkYjUmUdO0WgJwQe+OPl7mqM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761080486; c=relaxed/simple; bh=UuIlOazd3uf3cGtg3bwaIwcV+0x1wtCHNcVGkLQ+BeE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CQqfykCUN9yI5YkGOn2w5iGCSgZkYFAvS3FEtp513i92/0CJIje/YE/mI4c84RA5cWAiUHngX0ElystOZeA62RzDdxDCp2XGEGrxV0PeCtceV5laqfFPRjZLUPkiYD/81Yx/JIlSp8YJ0HGU43rk5dkhEDnOpEX779vc3O3uqtk= 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=jZa+e3kM; 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="jZa+e3kM" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id B6C9A1A15AD; Tue, 21 Oct 2025 21:01:22 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 8CCCB60680; Tue, 21 Oct 2025 21:01:22 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id C890B102F241D; Tue, 21 Oct 2025 23:01:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1761080481; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=v4TlBW0emiT/9iFEv7lk2VA7zMISVgmCM2JQdD8PYmw=; b=jZa+e3kM0LTzew6S/IoqQu28flOPvY8mVvr3sHPERGEA43GJ/Kk2OImASKHY3YWvfWc2kf IFbdjlABfEje/aG9jVLF7+bw8bt/XxVdg4rFL3ZtHBIedEG8QgjpmEQUm0N51Ryni4L6T8 XuRfOi16YNWTiukSGwSo9HX2zXFsSX4dk/xV1PRSLVhTVU+krP2HR8Iprs3/OnErrCghDn 0KGz0b9bualpC2Be6CMGDxUnHy7WX4buSHpZVEXYt7xzw0vrExp/eIlm87a9fTbNaKmZRb XOjkJeTaPxh55GhxGNXgacYju1i6JuCfF/sksvOIn0FODQBW7MTPdIv9EaFWfA== From: Luca Ceresoli Date: Tue, 21 Oct 2025 23:00:45 +0200 Subject: [PATCH v2 2/5] drm/sti: hdmi: add bridge before attaching 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: <20251021-b4-drm-bridge-alloc-add-before-attach-v2-2-c17cc1bbff72@bootlin.com> References: <20251021-b4-drm-bridge-alloc-add-before-attach-v2-0-c17cc1bbff72@bootlin.com> In-Reply-To: <20251021-b4-drm-bridge-alloc-add-before-attach-v2-0-c17cc1bbff72@bootlin.com> To: Alain Volmat , Raphael Gallais-Pou , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Raphael Gallais-Pou Cc: Hui Pu , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Luca Ceresoli X-Mailer: b4 0.14.2 X-Last-TLS-Session-Version: TLSv1.3 DRM bridges should be always added to the global bridge list before being attached. Link: https://lore.kernel.org/all/20250709-sophisticated-loon-of-rain-6ccdd= 8@houat/ Acked-by: Raphael Gallais-Pou Signed-off-by: Luca Ceresoli --- drivers/gpu/drm/sti/sti_hdmi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c index 4e7c3d78b2b971f8083deae96f3967b44a6499cb..f8222e60b1e01afb6d93f816915= f17056c060f22 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.c +++ b/drivers/gpu/drm/sti/sti_hdmi.c @@ -1459,6 +1459,7 @@ static int sti_hdmi_probe(struct platform_device *pde= v) =20 platform_set_drvdata(pdev, hdmi); =20 + drm_bridge_add(&hdmi->bridge); return component_add(&pdev->dev, &sti_hdmi_ops); =20 release_adapter: @@ -1475,6 +1476,7 @@ static void sti_hdmi_remove(struct platform_device *p= dev) if (hdmi->audio_pdev) platform_device_unregister(hdmi->audio_pdev); component_del(&pdev->dev, &sti_hdmi_ops); + drm_bridge_remove(&hdmi->bridge); } =20 struct platform_driver sti_hdmi_driver =3D { --=20 2.51.0 From nobody Wed Oct 22 15:53:55 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 C5DAC280A58 for ; Tue, 21 Oct 2025 21:01:26 +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=1761080488; cv=none; b=g0aCp8+Kqy2fA9iwKWbKN5ofjf/BYoo63/NisYczz32AOz6LOYuJ7tbq8RYavl2xNS0iAYKyGuyRrAdupUkfbi1ewV9+r0yCFKfp5T+AudHQNQc+NrwplX1RmFwLwhTsjAXJzg8XaAdVJxzi7XJAGvY7Cab0K3uzkah58aZ7dlE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761080488; c=relaxed/simple; bh=0DXON5mT7BeW24BxRlTCJMjtuhADOpj9r16JxuuL5rM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=goFSPes1fkr+tr8IEJKAwG39U4Mh6dAf/28HBxHbnu3jkHhzeRRMbZeR+uDPABea1d0+fPLLKtHwDtMirK3gK5gOdFZXN7s7nPKUlubvn68R5TTyK38qrvezCbu0fkvktWk3TlslXWHj8E4j3ulb/moDkGtSg1fCGeomKWWQbTM= 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=Vv/CUjIe; 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="Vv/CUjIe" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 3C3991A15AB; Tue, 21 Oct 2025 21:01:25 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id CA3D860680; Tue, 21 Oct 2025 21:01:24 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 0E508102F2415; Tue, 21 Oct 2025 23:01:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1761080483; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=CO/6DLIe3Dzo5sLr1BlifC8tEkQKj1yPrLzvRzKt3Ik=; b=Vv/CUjIe1vJrZztQ95kwHBlz/iBfIC69LTOrXDSrszA4Rif5S53zDvIZ/saIr2HZvMw40E fdmBI1IKkZMxV8p/eV0XZtrEbLFDZO1/QU1DT9ZAobZCjC5TVjR/5SBPgVEE2Hgc0vcLNW 615SxHdNqBWdL62X7HgSU/4bOIQDV2R+ZdSGOFwwXvrxrvtWAqhrOgGaE5nq076yK8p5dL lMRXF1VENXqoLSiTBQMnAmUfcONWTf3jb+BhbhwXfC06xi7Wscj1OOgz6r3SrNwVTBOTZX BVARI0fA1sHlrjWIuf5399Jz6qhA59opqjnl6+BKROS0H3q7RBGj8twzUqjWjA== From: Luca Ceresoli Date: Tue, 21 Oct 2025 23:00:46 +0200 Subject: [PATCH v2 3/5] drm/bridge: document that adding a bridge is mandatory before attach 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: <20251021-b4-drm-bridge-alloc-add-before-attach-v2-3-c17cc1bbff72@bootlin.com> References: <20251021-b4-drm-bridge-alloc-add-before-attach-v2-0-c17cc1bbff72@bootlin.com> In-Reply-To: <20251021-b4-drm-bridge-alloc-add-before-attach-v2-0-c17cc1bbff72@bootlin.com> To: Alain Volmat , Raphael Gallais-Pou , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Raphael Gallais-Pou Cc: Hui Pu , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Luca Ceresoli X-Mailer: b4 0.14.2 X-Last-TLS-Session-Version: TLSv1.3 At the moment it's not documented that you need to add a bridge before attaching it. Clarify that. Suggested-by: Maxime Ripard Link: https://lore.kernel.org/all/20250709-sophisticated-loon-of-rain-6ccdd= 8@houat/ Reviewed-by: Raphael Gallais-Pou Signed-off-by: Luca Ceresoli --- drivers/gpu/drm/drm_bridge.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index 53e7ece36dd940aabd1c0880f296fce7224a12ac..1246a52f8767b52c5f10139aa89= 7824b3c2f28da 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -422,6 +422,9 @@ static bool drm_bridge_is_atomic(struct drm_bridge *bri= dge) * If non-NULL the previous bridge must be already attached by a call to t= his * function. * + * The bridge to be attached must have been previously added by + * drm_bridge_add(). + * * Note that bridges attached to encoders are auto-detached during encoder * cleanup in drm_encoder_cleanup(), so drm_bridge_attach() should general= ly * *not* be balanced with a drm_bridge_detach() in driver code. --=20 2.51.0 From nobody Wed Oct 22 15:53:55 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 371902874F8 for ; Tue, 21 Oct 2025 21:01:29 +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=1761080491; cv=none; b=bLCD+BA2aKYoJKaIFcf9xz+4SzlWtzB7PNgs9fdJCIyUIgBqhGdG3QUIDprLTPUXJ8WKxhN7srk/QPGWwftgM+w9dqAbM6b2f0+SgRvTLzn7AYiYxs/Yo0aIAIvQa0tJq44oSTugm5BZx/4yNiaU297QXYVKcFauQ+qyqJcy/NM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761080491; c=relaxed/simple; bh=pBjfUdjbqY9Yz36hon7vReamWFx77NrxoFtcL3aa/+w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bqgWK34BjvVUw5ZMMCGPRnKGFes+YPh9yGMMpPsjQkCK9DEV6Qo3JdjAGXGAKhNb5LAjpjxJ/0D6nrvobW/M4RB/RpBe7lNIigzQaE/qT5ODUyf//VumzgmP4a2TKgRs5icUBfWlrpqQucWx0T7XO3Nysu9aiAW/94UEhYR7gGY= 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=UDm4nEbE; 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="UDm4nEbE" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 96A001A15AC; Tue, 21 Oct 2025 21:01:28 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 6D90C60680; Tue, 21 Oct 2025 21:01:28 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 49BDC102F241F; Tue, 21 Oct 2025 23:01:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1761080487; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=p/3IIpo2fKAEaKJeCKwn/2EO3bVCvyymxE4cdcCqCkM=; b=UDm4nEbE2HVXl+I3B42iVs765XRRw5DrLs4OqZ8TN28Zgn1tG1P9TwxzSlsd/FV5QPNwJB 1yiF7otbpl/9zsaTwRRYASbxZ3rhJYmjhCyfVnej+Y7r6JdEm1aYv+Ud4cjhHAj6DQWKXU C0LyDAbZeUmsaJy8jXiPo9pkUUj5fpK4byb4o/v7N0jm9lK2YaM6vGbwKqnTI9oIUSR/6K K1VYcxKgw4VeWiRPwqidIoVDBqdW5ej4l1PwsaImB8PZjvzac9I3suR1kz3RWZguHYfoSx o5xw9jKjUH6sejwG+HBIHl1pMkTFZ95YFyrLsCZffqMuwBUgvPS2CUT6t/AmiQ== From: Luca Ceresoli Date: Tue, 21 Oct 2025 23:00:47 +0200 Subject: [PATCH v2 4/5] drm/bridge: add warning for bridges attached without being added 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: <20251021-b4-drm-bridge-alloc-add-before-attach-v2-4-c17cc1bbff72@bootlin.com> References: <20251021-b4-drm-bridge-alloc-add-before-attach-v2-0-c17cc1bbff72@bootlin.com> In-Reply-To: <20251021-b4-drm-bridge-alloc-add-before-attach-v2-0-c17cc1bbff72@bootlin.com> To: Alain Volmat , Raphael Gallais-Pou , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Raphael Gallais-Pou Cc: Hui Pu , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Luca Ceresoli X-Mailer: b4 0.14.2 X-Last-TLS-Session-Version: TLSv1.3 DRM bridges must be added before they are attached. Add a warning to catch violations. The warning is based on the bridge not being part of any list, so it will trigger if the bridge is being attached without ever having been added. It won't catch cases of bridges attached after having been added and then removed, because in that case the bridge will be in bridge_lingering_list. However such a case is both more demanding to detect and less likely to happen, so it can be left unchecked, at least for now. Link: https://lore.kernel.org/all/20250709-sophisticated-loon-of-rain-6ccdd= 8@houat/ Reviewed-by: Raphael Gallais-Pou Signed-off-by: Luca Ceresoli --- drivers/gpu/drm/drm_bridge.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index 1246a52f8767b52c5f10139aa897824b3c2f28da..6dba601a056bb3cff8b8dd5b1ec= 46299235b2d85 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -441,6 +441,9 @@ int drm_bridge_attach(struct drm_encoder *encoder, stru= ct drm_bridge *bridge, if (!encoder || !bridge) return -EINVAL; =20 + if (list_empty(&bridge->list)) + DRM_WARN("Missing drm_bridge_add() before attach\n"); + drm_bridge_get(bridge); =20 if (previous && (!previous->dev || previous->encoder !=3D encoder)) { --=20 2.51.0 From nobody Wed Oct 22 15:53:55 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 9170B2877FC for ; Tue, 21 Oct 2025 21:01:32 +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=1761080494; cv=none; b=Cym00M56fdF49sl8YNJCrW1viuXCG2H5iS2VVQRHnzFJH7vQ2JdZhxh0ZZwelEN2/ixSRRvLWQ0/3y/8i8sXbKfUW369BOZborNkdBg00CGqwy7aSZETau2CGio/JFyyNptXq4OZwosG1QU6GcqAlFsHuGaeRr9Tb2/byMpTuEQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761080494; c=relaxed/simple; bh=HNNcUjBlE2ezDrpCkSt1TAM29s3v4NT9WLUuWNfS/KY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZDPbzY0oNTVh7W+soXxyS6NYe/aq5oDrtVxQ6E0Nr0bfT6gA4ck18vy4zObv9AKlQ+RitBs/dNMhFqR5QzTO3naMgh/ZGHuRI5d7LPqEeMZrwrbyYS0rodbBRlKjeCiFcFOaMMbkM6JwIX1TfHrZgCmsMsch3Qr9QCclJc1DZSE= 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=NZkWMIH9; 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="NZkWMIH9" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 43692C0B8A3; Tue, 21 Oct 2025 21:01:11 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id ED5AE60680; Tue, 21 Oct 2025 21:01:30 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id E13D6102F2421; Tue, 21 Oct 2025 23:01:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1761080490; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=vdYNl+jUov2A+6UN1VU5gxICmAEu5JVGl0RzN3EysYI=; b=NZkWMIH9WokjHWo6HtkBTaGYYhccTDAOhtx452H2om0J9x7UoSGu6t6YLJdfUFvn+9zPko NNrXwF+f0Bm9EyPzJCwbDDfmiV0dvryD/tdRmNfSGChRv32oEg9YHrwaa/cigmgjoCfece B0JXyM11qY6bQOMG8xEVjmlZhWUlORNEUifmnfxZMoeKp6/zQLyMpYagYOIWg63cRojBBW 4UNfzGeZmDvi3+w58ZsDSrr+cAsm7MMAWxaapfHB93SY6T104iqUSSp9IsVdYnqZmi84Dw 8Cf1+B4oKt7Op/03punHVioymNle3P6U71oQAhKXefwQwSqzbrwr7k58fR1cVg== From: Luca Ceresoli Date: Tue, 21 Oct 2025 23:00:48 +0200 Subject: [PATCH v2 5/5] drm/bridge: add warning for bridges using neither devm_drm_bridge_alloc() nor drm_bridge_add() 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: <20251021-b4-drm-bridge-alloc-add-before-attach-v2-5-c17cc1bbff72@bootlin.com> References: <20251021-b4-drm-bridge-alloc-add-before-attach-v2-0-c17cc1bbff72@bootlin.com> In-Reply-To: <20251021-b4-drm-bridge-alloc-add-before-attach-v2-0-c17cc1bbff72@bootlin.com> To: Alain Volmat , Raphael Gallais-Pou , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Raphael Gallais-Pou Cc: Hui Pu , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Luca Ceresoli X-Mailer: b4 0.14.2 X-Last-TLS-Session-Version: TLSv1.3 The correct sequence for bridge initialization is: 1. devm_drm_bridge_alloc() 2. drm_bridge_add() 3. drm_bridge_attach() For bridges missing either 1 or 2 there are warnings in place already, presenting an explanatory error message. Bridges missing both 1 and 2 would still face a poorly understandable message, as reported in a recent regression report [0]: WARNING: [...] at [...]/lib/refcount.c:25 drm_bridge_attach+0x2c/0x1dc ... Call trace: ... drm_bridge_attach ... Add a new warning to ensure an understandable message is logged in such cases. Use the same message and warning message already in place in drm_bridge_add(). [0] https://lore.kernel.org/all/hlf4wdopapxnh4rekl5s3kvoi6egaga3lrjfbx6r223= ar3txri@3ik53xw5idyh/ Signed-off-by: Luca Ceresoli --- This patch was added in v2 after having received regression report [0]. --- drivers/gpu/drm/drm_bridge.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index 6dba601a056bb3cff8b8dd5b1ec46299235b2d85..8f355df883d8ac8de9d361ec302= f4ccbf3bca0d6 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -441,6 +441,9 @@ int drm_bridge_attach(struct drm_encoder *encoder, stru= ct drm_bridge *bridge, if (!encoder || !bridge) return -EINVAL; =20 + if (!bridge->container) + DRM_WARN("DRM bridge corrupted or not allocated by devm_drm_bridge_alloc= ()\n"); + if (list_empty(&bridge->list)) DRM_WARN("Missing drm_bridge_add() before attach\n"); =20 --=20 2.51.0