From nobody Wed Dec 17 17:40:03 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 B3DD5303CAE for ; Tue, 28 Oct 2025 10:16:36 +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=1761646598; cv=none; b=hTY4+F2gC8HOTB47+FTWxH0QtXbixbD8e7agCaH3hL4yoL6hj+9J3DH10RGPxPBorKMCgnvM0ESM5/EPPsupiTDHQwNduFRTPBdzm/9tmMmM1gqEB+AiA0pevD9qf+2BRLeGdokFfiI0M+B7Ab2z+3WlkMvZvAIatASa0KMrgd0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761646598; c=relaxed/simple; bh=ifpbaagJL38iTiuI3uDxN7hJcYYCS9921ruXzBZxg3k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CrmBh41ew2kqqEeAvmP8dmRGhnZI8wc6pstGbxeeb6ipAIpZz6NY2aJH8oph3P/1sjQ72d8vtbUP//XtFJhBatzE7sL2wHZzIfbBVUtahCHpcVI8XP459WzpchT6sTrY+n9BdBKaXvW/Fw5noCnLZtQkApdJ8FWGus5CajKwXaM= 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=qlkb9E7A; 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="qlkb9E7A" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 312E64E41393; Tue, 28 Oct 2025 10:16:35 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 035AF606AB; Tue, 28 Oct 2025 10:16:35 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 45C501179B13D; Tue, 28 Oct 2025 11:16:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1761646593; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=ZOj8mdyqTqYuMWt3nIGEDkwJWbIYd1bOEoaEedTj9EI=; b=qlkb9E7A1FupSg1i57BwyhsJlnIdnBXZnKxfuA8I7Vn78dvhaZl39Sri5UKfuOSZVEMGlU jbmedUXrZcBNlGaprupYW0M2EzjMrxXHRk8c4Pxg4G17+rGhjtI183kT6GY6JCYDhvj7t1 /IdYgmIX/otRpUKkGEneM6bhu9MBh+cHWVteYvopKf4nnXG7cbZaqrcLECmGevWQ4vHB9r HNBhRPq0Q1v+0e8st87tlFECFP/YxHfi/awbQPbTwFimsuCSqxkZzKpnDu0CfLqfTzGsfY 5dmJL04tuMXRcCziK02ndhE3vlwXHDm1NaE1XhBZUkmMzzASOL2vrgkmovGxqQ== From: Luca Ceresoli Date: Tue, 28 Oct 2025 11:15:42 +0100 Subject: [PATCH v3 1/6] 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: <20251028-b4-drm-bridge-alloc-add-before-attach-v3-1-bb8611acbbfb@bootlin.com> References: <20251028-b4-drm-bridge-alloc-add-before-attach-v3-0-bb8611acbbfb@bootlin.com> In-Reply-To: <20251028-b4-drm-bridge-alloc-add-before-attach-v3-0-bb8611acbbfb@bootlin.com> To: Alain Volmat , 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 , Andy Yan 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. Acked-by: Raphael Gallais-Pou Acked-by: Alain Volmat Signed-off-by: Luca Ceresoli --- Changes in v3: - removed misplaced 'Link:' tag --- 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 Dec 17 17:40:03 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 AFD2E303A03 for ; Tue, 28 Oct 2025 10:16:38 +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=1761646600; cv=none; b=k7aSTkMY151/VsxYYGZf/dlJZahFM/Uyd72W+JvxSd7dbRXFY5ltAMBCquU8C14rA84Gd6a4+8b7wBTnxiNoayaOxrpJ+3ZsggJTF6akPVmPnTVMHldjqk9mp7Bc4KUsWOMEsI6gc3z3X3qU1ZPO4/6fELJ8Sh6gUDfW9p60x3A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761646600; c=relaxed/simple; bh=m0jhAQW6Nuy2F/RFwu4GuGJ6hb/4pWU9YS4dkgmp8U8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MsmBjrNJwnFXi3CD52WFMBqSARNrlNwX49FyMejD1gdIumIy47rWR2EJEAETzp8U8WonZ8XDvULQHHw/tPpQ/f+L2zuN0/VE51v9ABg2ADXC/jFCyrVf2BZR8j9mUVZ3moeALZuAyJiEmNdsuPfXehU7D+B11U0BPk0GU7l6kNk= 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=ZQoiuq/g; 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="ZQoiuq/g" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id EB379C0C408; Tue, 28 Oct 2025 10:16:16 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 351D8606AB; Tue, 28 Oct 2025 10:16:37 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 3E9361179B14C; Tue, 28 Oct 2025 11:16:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1761646596; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=Pbf/CGcLpewLgLdKRQhA80Qa7Mx65sj1bmKZQ1GINdc=; b=ZQoiuq/gQMnwBUKeeos5Z27KdRZdCIgcUFjRSL8JdEeuh/NkS1gI3yIt7XheNTYpQJYbot ALgs6yDieHKQJ1pXFXUomXKsVOSCOnhTCwvrDILiD+ZUpHFjOAJZjlMhDBJAQ9+Vvt1gL+ gYTRTndraZXJdjk/f2Q3pOUoiuMhuG36dpeJXtLT/w9WLXuWAml46KOl+/73+s3R8sbSTn ZODKyl1InDUYffGe7M5guuHme/NKG+25cMqOxXf5rRRb88gNcylLhsf1oOkqTTJc7qL+rH TtUR94xFcJ5htSmf/Wh62f8lKMu3nn2GEbVdwVtAsLD9CKZMcvWtWNZatV6Fxw== From: Luca Ceresoli Date: Tue, 28 Oct 2025 11:15:43 +0100 Subject: [PATCH v3 2/6] 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: <20251028-b4-drm-bridge-alloc-add-before-attach-v3-2-bb8611acbbfb@bootlin.com> References: <20251028-b4-drm-bridge-alloc-add-before-attach-v3-0-bb8611acbbfb@bootlin.com> In-Reply-To: <20251028-b4-drm-bridge-alloc-add-before-attach-v3-0-bb8611acbbfb@bootlin.com> To: Alain Volmat , 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 , Andy Yan 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. Acked-by: Raphael Gallais-Pou Acked-by: Alain Volmat Signed-off-by: Luca Ceresoli --- Changes in v3: - removed misplaced 'Link:' tag --- 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 Dec 17 17:40:03 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 C42143054F9 for ; Tue, 28 Oct 2025 10:16:41 +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=1761646603; cv=none; b=NFiYrDWP6+tZ/bMBhLflbhs4PkfZeFABXuyiMUiqOVrdpDLhNlpkRfH9ujzulN+zCnAwbpQpg3Ugp6Pib88RJBieabCpLSq6gvmQHUcMf1FfxeWQr67ybKniZFH9jboEyfMYvaCr9ydeYGJ/v+a0RyaCgrb6WXLnNQ7kzxjXcKw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761646603; c=relaxed/simple; bh=0DXON5mT7BeW24BxRlTCJMjtuhADOpj9r16JxuuL5rM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BGVN6bpLqG+LSyA4xi9yKsKyzWA5RBvEOxqfQ4wptLCzh7w2NIhYYQG77BzRRDfHhwSBO9h6TzVg1ecKQk2QyD4rwtK6AnXY0aLVBUUQ2bc0kM0kD6+N9+G/QzbZ057p8/J6AV/5q41qHaJuaysnO75u9wP2BWQj5HV8QEtEd5s= 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=YbyV++KO; 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="YbyV++KO" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 29E3C4E41393; Tue, 28 Oct 2025 10:16:40 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id F2594606AB; Tue, 28 Oct 2025 10:16:39 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 90C931179B15C; Tue, 28 Oct 2025 11:16:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1761646599; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=CO/6DLIe3Dzo5sLr1BlifC8tEkQKj1yPrLzvRzKt3Ik=; b=YbyV++KO4+DwHAdTVhCxcflDWiuRKIdQt5d1HcQr6CNNpdcOlgaoa2TIVAlQweaH7UjzYU f8BUKzoVhX14m8VrKcl3Zzqy2KhCzw7wloKeODQcEUOryY0v4E5iedzB/DIR2uB7ExIlrb g7tk/YO1v6Fve3kkx6wKEgz61HjNq6DLBSfRx3HyFTBaPyn7ZzFMZKlAGmGBXYzXq4J5ne +BJXEoUYjx/jvlCvfW6hRIIH0VTy1jm6F4yV2lS5dUMmmY8PYiU8zWTLN4hosQhWdIeI2u UGpX/FS++4VqeG1nz79rGspLn2FICI9GW08WU4uMoZELB8GEvz1cJpAyhSYBWA== From: Luca Ceresoli Date: Tue, 28 Oct 2025 11:15:44 +0100 Subject: [PATCH v3 3/6] 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: <20251028-b4-drm-bridge-alloc-add-before-attach-v3-3-bb8611acbbfb@bootlin.com> References: <20251028-b4-drm-bridge-alloc-add-before-attach-v3-0-bb8611acbbfb@bootlin.com> In-Reply-To: <20251028-b4-drm-bridge-alloc-add-before-attach-v3-0-bb8611acbbfb@bootlin.com> To: Alain Volmat , 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 , Andy Yan 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 Reviewed-by: Maxime Ripard --- 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 Dec 17 17:40:03 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 3EA47305E2D for ; Tue, 28 Oct 2025 10:16:46 +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=1761646608; cv=none; b=ss4wBP2HwDfS7P3maJOA0FoWVnqcTNDRlowSSNPugioK2n8yqwuVTmbg0DFk86E0sdTdavxLTTUm2/iNkwLL+IcrY/XN6R54JHI2uhKFsHFIysogUi8n33VEP17GAv7nJABLyY0rydCRsvm9BhtKW4Zo8C3/NvxqNUxbjk8v4cA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761646608; c=relaxed/simple; bh=IAND4q8BblOAeS5tfwL9gK+8ZJzaFqeI8sc1eST0XHA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Z9VvzLhOEEIoL6pRMFCcW880woGFnS7W1IEwn4h/zgWqZe4oM6RsQMHX6DHhq9unoMGruPck+cuSZzPmlVhRTR6epuqjz08dD2IzRm6xF/aB+HCLk/IZ6aUL3qt+SF9VPVcV6h1ePWQKA/AP5gz1NQMHOMd3FxcDbkLTJgIAHgI= 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=VUKNk8bO; 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="VUKNk8bO" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 84D42C0C408; Tue, 28 Oct 2025 10:16:24 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id BDB38606AB; Tue, 28 Oct 2025 10:16:44 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 67CE91179B16F; Tue, 28 Oct 2025 11:16:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1761646603; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=Aqs+sfSmiPEHQh8G/sn7Sqo6VRtZAC2XPw+ZTvejj+4=; b=VUKNk8bOKU9dg6anXLvRhKDRhB6uty6Eg/UxHEma4KiWOpJGR2lg44OvHVfRRZrP2RYFa4 eFxE1qC9b7edsKUAh5rN4bJo+rDYqBllggWSWcJzprbp0Pw+d+VoiB+RL6UcIzvNSPDwwD ZRll/uWUjDYDDK8Dvtvr9rlJ43422ae3JXq339d/v8emcPN0G5lVwbKkcrMGe/rIDRqmva JGQfqkG6Cz+JnlHKc/ahmJBD5aeIWohTjVy/qYHLkUJSkWjmGaCJs3wBMfb1fH3tBmDQmK JugyOW5FZzwNgDLwezbWKWTCxe8RXmLlKJcOJpBnk/JLTZeHS9+BN7BV6GsYww== From: Luca Ceresoli Date: Tue, 28 Oct 2025 11:15:45 +0100 Subject: [PATCH v3 4/6] 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: <20251028-b4-drm-bridge-alloc-add-before-attach-v3-4-bb8611acbbfb@bootlin.com> References: <20251028-b4-drm-bridge-alloc-add-before-attach-v3-0-bb8611acbbfb@bootlin.com> In-Reply-To: <20251028-b4-drm-bridge-alloc-add-before-attach-v3-0-bb8611acbbfb@bootlin.com> To: Alain Volmat , 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 , Andy Yan 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. 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 Reviewed-by: Maxime Ripard --- Changes in v3: - added 'Suggested-by: Maxime Ripard' which was missing in v1 and v2 by mistake --- 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 Dec 17 17:40:03 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 23D322D4813 for ; Tue, 28 Oct 2025 10:16:48 +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=1761646612; cv=none; b=StphUVpMbLUhWukn9qmtWb1eJEk728Dsc+KmXEPppBtauNRge8RL7TSHTQtiKLjr97KcpmT8/DVOIjHw7IyV6am8Q91HTXzFVdbYwK20OFNxR7lwVum70hcsZiaPId70nJfXDBmf51KzbaSpjaOFLImKOcVhXBjNSvZ8orr7Yg4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761646612; c=relaxed/simple; bh=HNNcUjBlE2ezDrpCkSt1TAM29s3v4NT9WLUuWNfS/KY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=S+f+Ih1X0dPdicwolHxhgtY3ultR05V9fC2pPR5IwN9YVIPydSA5CuviW7/Bf/ZcC3SRLALY2s3RHwdMPzFUkCoWMkrBGyGH7cEfJCNGMBSehudxNgAOpNWb/PK8gz02DQDmOfyMCYyuv5Oe2+1Wp13SAQBZ8AUYpxJVpqH10po= 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=pWDCE+fn; 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="pWDCE+fn" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 64568C0BE9C; Tue, 28 Oct 2025 10:16:27 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id A16BC606AB; Tue, 28 Oct 2025 10:16:47 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 126151179B191; Tue, 28 Oct 2025 11:16:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1761646606; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=vdYNl+jUov2A+6UN1VU5gxICmAEu5JVGl0RzN3EysYI=; b=pWDCE+fnq8i9VUHvOlzUK8F0XX42hsC0TBdhfPAc52Yq0huRzaEVKhDRn849CHnXrxmYl6 nyow7QVbg+7gID4HfgcCAZChnRystZb9Jyn9GE3xyOgLzH4kDHKnnMsImZXTOAeSx97US+ VE+L3tB48aVLcFz96hOWoreKCYkN05t8k0WG420X8vHVKWSOBHJnwgwc0zWpOZ9cerIcZz IpbdZ5Skw7bSZftXLEoZm3JWMTf+SHoCnk2SBmPyrv8hUAc1Hx5N+pqhi5ceWJqwlYkBmB aGDwdiybj15TolwWmRF/3myX5YPvOtInsnUnCkV9hzCRK3Bd7UEJaCBv3aibJw== From: Luca Ceresoli Date: Tue, 28 Oct 2025 11:15:46 +0100 Subject: [PATCH v3 5/6] 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: <20251028-b4-drm-bridge-alloc-add-before-attach-v3-5-bb8611acbbfb@bootlin.com> References: <20251028-b4-drm-bridge-alloc-add-before-attach-v3-0-bb8611acbbfb@bootlin.com> In-Reply-To: <20251028-b4-drm-bridge-alloc-add-before-attach-v3-0-bb8611acbbfb@bootlin.com> To: Alain Volmat , 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 , Andy Yan 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 Reviewed-by: Maxime Ripard --- 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 From nobody Wed Dec 17 17:40:03 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 3F1BE307AF2 for ; Tue, 28 Oct 2025 10:16:51 +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=1761646615; cv=none; b=qysNyG11N6IIgd26Gq4aXM6bNWj/cA3rQ5DMhiE6BVxq+UiUxBglu4w6ww9KVMxPJtFEV2hJ6qq5U26mZIQIUA3y1CWA1ql8Xl1A4GkGQ9BVqWwaFkB8TBSqGSwB6ddtN9N6wWuk+3dgwiphuAQn7XqIfs5Ay5W5IO6Q8kngIug= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761646615; c=relaxed/simple; bh=azBQ3OWrgMDeqzBKXjWG/3P66Ru0UGjGqS7Tm81ePBI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YcoWReoHNKxzEXNdmMFd4fnM1b/0BQIpiAkMFB1lX8o2vfFuK5n4JpisQIQ5CjBioFG2HXmYeC6yfNSBqm2udhkfJmAHB0gIGyXkLKemmFAKuoucy0y2/DcawuVZWq+xV4XK/jGD6TcTuVDL9YaDh+nVdFWHx6WnSuMoWxvYr4Y= 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=NJsb70WG; 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="NJsb70WG" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 9453A4E41393; Tue, 28 Oct 2025 10:16:50 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 61E8F606AB; Tue, 28 Oct 2025 10:16:50 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 2A1731179B1A0; Tue, 28 Oct 2025 11:16:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1761646609; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=+OuXZMnaZ4fecFxPcq14M2NVMZIWpSpSGN4BrirylB4=; b=NJsb70WGj3gzFkkHQ9peasIqc9ipmU2eFTBxN8RViZloU3PbUejLbAfegZxMQrRJ9pbQeA jFEtjUGrbDob/mQD3Pc8W8/iktEPQ+7opkZCyPE6OrxgODiOudGzeZMFVZfWRj4nyDHyDq v/FAH0o7JLITPliZLxdofG/N0asK7GVTO8pP+qxcama1CZNYkw9X7QTb2vAIp9ZLogx2hY M8m9GdiXvnn9W+Fh2UxnDZ5E2x71+rkREBoFLqNJPnHhOxLGGlWNNYJtvAzqn+8iAKd7Xx gqP2Aq49d4l5YmAFKBcsw377SOb1j6jfIuzhTTYy36W1As6negm8txob1Y3F2g== From: Luca Ceresoli Date: Tue, 28 Oct 2025 11:15:47 +0100 Subject: [PATCH v3 6/6] drm/bridge: synopsys: dw-dp: 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: <20251028-b4-drm-bridge-alloc-add-before-attach-v3-6-bb8611acbbfb@bootlin.com> References: <20251028-b4-drm-bridge-alloc-add-before-attach-v3-0-bb8611acbbfb@bootlin.com> In-Reply-To: <20251028-b4-drm-bridge-alloc-add-before-attach-v3-0-bb8611acbbfb@bootlin.com> To: Alain Volmat , 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 , Andy Yan 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. Signed-off-by: Luca Ceresoli Reviewed-by: Raphael Gallais-Pou --- This patch was added in v3 after searching for any remaining bridges not using drm_bridge_add(). --- drivers/gpu/drm/bridge/synopsys/dw-dp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-dp.c b/drivers/gpu/drm/brid= ge/synopsys/dw-dp.c index 9bbfe8da3de0264acbf8725d54f2f9627662e595..82aaf74e1bc070603bdda0be3a1= c6dc631ff00da 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-dp.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-dp.c @@ -2049,6 +2049,8 @@ struct dw_dp *dw_dp_bind(struct device *dev, struct d= rm_encoder *encoder, bridge->type =3D DRM_MODE_CONNECTOR_DisplayPort; bridge->ycbcr_420_allowed =3D true; =20 + devm_drm_bridge_add(dev, bridge); + dp->aux.dev =3D dev; dp->aux.drm_dev =3D encoder->dev; dp->aux.name =3D dev_name(dev); --=20 2.51.0