Skip to contentSkip to conversation

driver core: fw_devlink: Don't report refused sync_state-only links as errors

PATCH In review Arun Iyengar 2 participants 3 messages Nov 10 – Nov 14

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 driver core: fw_devlink: Don't report refused sync_state-only links as errors

A SYNC_STATE_ONLY device link is refused by device_link_add() once the consumer has already probed, since such a link only orders sync_state() callbacks and would be useless. This legitimately happens when a consumer that probes early (for example the Rockchip power domain provider, whose domains reference a PMIC regulator through domain-supply) is inferred to depend on a supplier device that is added later, and results in boot-time "Failed to create device link (0x180)" errors for a harmless condition.

Log the refusal of a sync_state-only link at debug level and keep the error for links that matter for probe ordering.

---
Tested on an Orange Pi 5 (RK3588S): the three "Failed to create device link (0x180)" lines that the Rockchip power controller logged on every boot (suppliers: the RK806 PMIC on SPI and an RK8602 on I2C, referenced through domain-supply of two of its power domains) are gone, and the regulators are still acquired and held by those domains.

This patch was developed with Claude (Anthropic) as a coding assistant:
it wrote the code and the commit message, and I reviewed and tested it as described above.

---
 drivers/base/core.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/base/core.c +14 -2
index bf97b06337a1..4cdfc156ffbc 100644
@@ -2241,8 +2241,20 @@ static int fw_devlink_create_devlink(struct device *con,
 		}
 
 		if (con != sup_dev && !device_link_add(con, sup_dev, flags)) {
-			dev_err(con, "Failed to create device link (0x%x) with supplier %s for %pfwf\n",
-				flags, dev_name(sup_dev), link->consumer);
+			/*
+			 * A SYNC_STATE_ONLY link only orders sync_state() and
+			 * is refused once the consumer has probed. That is
+			 * expected when a consumer that probes early (e.g. a
+			 * power domain provider referencing a regulator
+			 * supplier that is added later) is linked to a late
+			 * supplier, so don't report it as an error.
+			 */
+			if (device_link_flag_is_sync_state_only(flags))
+				dev_dbg(con, "Not creating sync_state-only device link (0x%x) with supplier %s for %pfwf\n",
+					flags, dev_name(sup_dev), link->consumer);
+			else
+				dev_err(con, "Failed to create device link (0x%x) with supplier %s for %pfwf\n",
+					flags, dev_name(sup_dev), link->consumer);
 			ret = -EINVAL;
 		}
 

---
base-commit: ec1db86e7bb3ec13c90456efac43659a723ac068
change-id: 20261110-fw-devlink-sync-state-f71babbf968b

Best regards,

Signature · 1 line
Arun Iyengar <[email protected]>
#1 lore raw

+Cc Saravana, Sebastian, Ulf, linux-pm.

This message was explained before, and I should have cited it:
https://lore.kernel.org/all/aixze8zFboY3huSf@venus/
Sebastian writes there that it comes from one power-controller device providing all Rockchip power domains, and that it is not harmless: the kernel misses dependency information. So "harmless" in my commit message is wrong; the patch does not fix that, it only lowers the log level. It also lowers it for every other failure to create a sync_state-only link (found by the Sashiko review), which it should not. One such case is being fixed at its cause: on RK3576, Sebastian's "clk: rockchip: rk3576: create proper platform device" removes the lines for power domains with a clock phandle:
https://lore.kernel.org/all/20261112-rk3576-clk-platform-device-v1-1-2f3ac9f09403@collabora.com/

Please drop this patch.

Arun