Patch "driver core: fw_devlink: Improve check for fwnode with no device/driver" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    driver core: fw_devlink: Improve check for fwnode with no device/driver

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     driver-core-fw_devlink-improve-check-for-fwnode-with.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit aa99b9d79e36da1b9d5159ec1838450e8c455568
Author: Saravana Kannan <saravanak@xxxxxxxxxx>
Date:   Mon Feb 6 17:41:54 2023 -0800

    driver core: fw_devlink: Improve check for fwnode with no device/driver
    
    [ Upstream commit 411c0d58ca6faa9bc4b9f5382118a31c7bb92a6f ]
    
    fw_devlink shouldn't defer the probe of a device to wait on a supplier
    that'll never have a struct device or will never be probed by a driver.
    We currently check if a supplier falls into this category, but don't
    check its ancestors. We need to check the ancestors too because if the
    ancestor will never probe, then the supplier will never probe either.
    
    Signed-off-by: Saravana Kannan <saravanak@xxxxxxxxxx>
    Tested-by: Colin Foster <colin.foster@xxxxxxxxxxxxxxxx>
    Tested-by: Sudeep Holla <sudeep.holla@xxxxxxx>
    Tested-by: Douglas Anderson <dianders@xxxxxxxxxxxx>
    Tested-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
    Tested-by: Luca Weiss <luca.weiss@xxxxxxxxxxxxx> # qcom/sm7225-fairphone-fp4
    Link: https://lore.kernel.org/r/20230207014207.1678715-3-saravanak@xxxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Stable-dep-of: 3fb16866b51d ("driver core: fw_devlink: Make cycle detection more robust")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/base/core.c b/drivers/base/core.c
index f623ebc131f8d..bf053e351a277 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1907,6 +1907,35 @@ static int fw_devlink_relax_cycle(struct device *con, void *sup)
 	return ret;
 }
 
+static bool fwnode_init_without_drv(struct fwnode_handle *fwnode)
+{
+	struct device *dev;
+	bool ret;
+
+	if (!(fwnode->flags & FWNODE_FLAG_INITIALIZED))
+		return false;
+
+	dev = get_dev_from_fwnode(fwnode);
+	ret = !dev || dev->links.status == DL_DEV_NO_DRIVER;
+	put_device(dev);
+
+	return ret;
+}
+
+static bool fwnode_ancestor_init_without_drv(struct fwnode_handle *fwnode)
+{
+	struct fwnode_handle *parent;
+
+	fwnode_for_each_parent_node(fwnode, parent) {
+		if (fwnode_init_without_drv(parent)) {
+			fwnode_handle_put(parent);
+			return true;
+		}
+	}
+
+	return false;
+}
+
 /**
  * fw_devlink_create_devlink - Create a device link from a consumer to fwnode
  * @con: consumer device for the device link
@@ -1995,9 +2024,16 @@ static int fw_devlink_create_devlink(struct device *con,
 		goto out;
 	}
 
-	/* Supplier that's already initialized without a struct device. */
-	if (sup_handle->flags & FWNODE_FLAG_INITIALIZED)
+	/*
+	 * Supplier or supplier's ancestor already initialized without a struct
+	 * device or being probed by a driver.
+	 */
+	if (fwnode_init_without_drv(sup_handle) ||
+	    fwnode_ancestor_init_without_drv(sup_handle)) {
+		dev_dbg(con, "Not linking %pfwP - Might never probe\n",
+			sup_handle);
 		return -EINVAL;
+	}
 
 	/*
 	 * DL_FLAG_SYNC_STATE_ONLY doesn't block probing and supports



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux