From nobody Fri Apr 3 02:58:10 2026 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 BFD8F3E4C9B; Wed, 25 Mar 2026 14:37:50 +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=1774449475; cv=none; b=Cq0vZnK6FSFWJx0MUVZmZbI+R3x3ob9c38macHfPpeqlAg4Yutf013QxLXVYPaK1BfxKtSGQBK+pWPfaJxSvQ82VpePZzcWmb8mAMT0fnBOpP+SVcRa67Ml74rnFB9E+z3pQrLLJPzNRkvBZGh8MT2COp/tLmAwHn5zew8g/y/g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774449475; c=relaxed/simple; bh=9WU6CnPwYf69YjJfs3q6iXeTR9MJC3N/+SMlykGezC0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=T5uJrxhLTiH0hgNLlQg43CkuOhyuJy05Kax2CPmqSlV/uBtaeDL4BppEAS3LR3CHH+BidUYZW5NFaliPinx6EinNZlt2dWfmQmaM3sNXH4/K18V5mQ+aIbkU8am7/I5Oz/nFSIPkrwVqqXEH90AmCEi5xR801fiTF5V9u5dY6us= 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=m62ahB0C; 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="m62ahB0C" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 671344E427EF; Wed, 25 Mar 2026 14:37:49 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 36F74601FA; Wed, 25 Mar 2026 14:37:49 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id AE6F210451416; Wed, 25 Mar 2026 15:37:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1774449465; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=FQEG+gi+2Owsvm5H07y7paCS6UXV8c60jAbpve0hKl8=; b=m62ahB0CVbVSXyRzaj89A96TBTVUsl3QaPdwwSz4hjzQmkXkz5moBnHKLWQ3c5d9uBM2RC s1jU5vtd69pR9AV4zKvymEGToEMVnY1l9kYhR62DwZXGqqPwk06uwzNsCZK1kW3ypmbRCF rmoQVBgfMVdgNyKFWE1Qa5aGIzLVae1Ik50Cf6ihtlYUbrFz+ls6RMH3R6FGoiaX/orx2V wzLs7iRiMz9hudgG/Rw8kDC9/SyNC26JP9GiJakS1Yw+k2WWJvweJRTrpvT4vU85jLq0e8 QPyqwd0wiYgVNPuMQcX36ASXO+BoHi97BRRZkQadmG0Fol8WK+sQ/gjYj6ksoQ== From: Herve Codina To: Andrew Lunn , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Kalle Niemi , Matti Vaittinen , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Frank Li , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Michael Turquette , Stephen Boyd , Andi Shyti , Wolfram Sang , Peter Rosin , Arnd Bergmann , Herve Codina , Saravana Kannan , Bjorn Helgaas , Charles Keepax , Richard Fitzgerald , David Rhodes , Linus Walleij , Ulf Hansson , Mark Brown , Len Brown , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Davidlohr Bueso , Jonathan Cameron , Dave Jiang , Alison Schofield , Vishal Verma , Ira Weiny , Dan Williams , Shawn Guo Cc: Wolfram Sang , linux-kernel@vger.kernel.org, driver-core@lists.linux.dev, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-pci@vger.kernel.org, linux-sound@vger.kernel.org, patches@opensource.cirrus.com, linux-gpio@vger.kernel.org, linux-pm@vger.kernel.org, linux-spi@vger.kernel.org, linux-acpi@vger.kernel.org, linux-cxl@vger.kernel.org, Allan Nielsen , Horatiu Vultur , Steen Hegelund , Luca Ceresoli , Thomas Petazzoni Subject: [PATCH v6 05/27] bus: simple-pm-bus: Populate child nodes at probe Date: Wed, 25 Mar 2026 15:35:32 +0100 Message-ID: <20260325143555.451852-6-herve.codina@bootlin.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260325143555.451852-1-herve.codina@bootlin.com> References: <20260325143555.451852-1-herve.codina@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" The simple-pm-bus driver handles several simple busses. When it is used with busses other than a compatible "simple-pm-bus", it doesn't populate its child devices during its probe. This confuses fw_devlink and results in wrong or missing devlinks. Once a driver is bound to a device and the probe() has been called, device_links_driver_bound() is called. This function performs operation based on the following assumption: If a child firmware node of the bound device is not added as a device, it will never be added. Among operations done on fw_devlinks of those "never be added" devices, device_links_driver_bound() changes their supplier. With devices attached to a simple-bus compatible device, this change leads to wrong devlinks where supplier of devices points to the device parent (i.e. simple-bus compatible device) instead of the device itself (i.e. simple-bus child). When the device attached to the simple-bus is removed, because devlinks are not correct, its consumers are not removed first. In order to have correct devlinks created, make the simple-pm-bus driver compliant with the devlink assumption and create its child devices during its probe. Signed-off-by: Herve Codina --- drivers/bus/simple-pm-bus.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/bus/simple-pm-bus.c b/drivers/bus/simple-pm-bus.c index 9ebd588ea24f..30628958c923 100644 --- a/drivers/bus/simple-pm-bus.c +++ b/drivers/bus/simple-pm-bus.c @@ -42,14 +42,15 @@ static int simple_pm_bus_probe(struct platform_device *= pdev) match =3D of_match_device(dev->driver->of_match_table, dev); /* * These are transparent bus devices (not simple-pm-bus matches) that - * have their child nodes populated automatically. So, don't need to - * do anything more. We only match with the device if this driver is - * the most specific match because we don't want to incorrectly bind to - * a device that has a more specific driver. + * need to have their child nodes populated. So, don't need to do + * anything more except populate child nodes during this probe(). We + * only match with the device if this driver is the most specific match + * because we don't want to incorrectly bind to a device that has a more + * specific driver. */ if (match && match->data) { if (of_property_match_string(np, "compatible", match->compatible) =3D=3D= 0) - return 0; + goto populate; else return -ENODEV; } @@ -64,13 +65,14 @@ static int simple_pm_bus_probe(struct platform_device *= pdev) =20 dev_set_drvdata(&pdev->dev, bus); =20 - dev_dbg(&pdev->dev, "%s\n", __func__); - pm_runtime_enable(&pdev->dev); =20 +populate: if (np) of_platform_populate(np, NULL, lookup, &pdev->dev); =20 + dev_dbg(&pdev->dev, "%s\n", __func__); + return 0; } =20 @@ -78,7 +80,7 @@ static void simple_pm_bus_remove(struct platform_device *= pdev) { const void *data =3D of_device_get_match_data(&pdev->dev); =20 - if (pdev->driver_override || data) + if (pdev->driver_override) return; =20 dev_dbg(&pdev->dev, "%s\n", __func__); @@ -86,7 +88,8 @@ static void simple_pm_bus_remove(struct platform_device *= pdev) if (pdev->dev.of_node) of_platform_depopulate(&pdev->dev); =20 - pm_runtime_disable(&pdev->dev); + if (!data) + pm_runtime_disable(&pdev->dev); } =20 static int simple_pm_bus_runtime_suspend(struct device *dev) --=20 2.53.0