mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-01 22:54:01 +00:00
driver core: fw_devlink: Improve check for fwnode with no device/driver
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@google.com> Tested-by: Colin Foster <colin.foster@in-advantage.com> Tested-by: Sudeep Holla <sudeep.holla@arm.com> Tested-by: Douglas Anderson <dianders@chromium.org> Tested-by: Geert Uytterhoeven <geert+renesas@glider.be> Tested-by: Luca Weiss <luca.weiss@fairphone.com> # qcom/sm7225-fairphone-fp4 Link: https://lore.kernel.org/r/20230207014207.1678715-3-saravanak@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
3a2dbc510c
commit
411c0d58ca
1 changed files with 38 additions and 2 deletions
|
@ -1867,6 +1867,35 @@ static int fw_devlink_relax_cycle(struct device *con, void *sup)
|
||||||
return ret;
|
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
|
* fw_devlink_create_devlink - Create a device link from a consumer to fwnode
|
||||||
* @con: consumer device for the device link
|
* @con: consumer device for the device link
|
||||||
|
@ -1948,9 +1977,16 @@ static int fw_devlink_create_devlink(struct device *con,
|
||||||
goto out;
|
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;
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DL_FLAG_SYNC_STATE_ONLY doesn't block probing and supports
|
* DL_FLAG_SYNC_STATE_ONLY doesn't block probing and supports
|
||||||
|
|
Loading…
Reference in a new issue