Some devices are added during its parent's probe and will never get
bound to a driver. In this case, with fw_devlink set to "rpm",
which is the default value, its consumers will be deferred probe
until deferred_probe_timeout when fw_devlink_drivers_done() would
relax the devlinks to the suplier.
Use this function to relax the consumer devlinks, just like what we
do for the unmatched devices in fw_devlink_drivers_done(), so that
the consumer devices would be probed not that later.
Signed-off-by: Wang Wensheng <wangwensheng4@huawei.com>
---
drivers/base/core.c | 22 ++++++++++++++++++++++
include/linux/device.h | 1 +
2 files changed, 23 insertions(+)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index d22d6b23e758..2f7101ad9d11 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1754,6 +1754,28 @@ static void fw_devlink_relax_link(struct device_link *link)
dev_name(link->supplier));
}
+/**
+ * fw_devlink_relax_consumers - Relax the devlinks with all its consumers
+ * @dev: Device whose consumer devlinks will be relaxed
+ *
+ * Some devices are added during its parent's probe and will never get bound
+ * to a driver. In this case its consumers will be deferred probe until
+ * deferred_probe_timeout.
+ *
+ * Use this function to relax the consumer devlinks so that the consumers
+ * device would be probed not that later.
+ */
+void fw_devlink_relax_consumers(struct device *dev)
+{
+ struct device_link *link;
+
+ device_links_write_lock();
+ list_for_each_entry(link, &dev->links.consumers, s_node)
+ fw_devlink_relax_link(link);
+ device_links_write_unlock();
+}
+EXPORT_SYMBOL_GPL(fw_devlink_relax_consumers);
+
static int fw_devlink_no_driver(struct device *dev, void *data)
{
struct device_link *link = to_devlink(dev);
diff --git a/include/linux/device.h b/include/linux/device.h
index 0470d19da7f2..a451c0eb2ffa 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -1201,6 +1201,7 @@ void device_link_remove(void *consumer, struct device *supplier);
void device_links_supplier_sync_state_pause(void);
void device_links_supplier_sync_state_resume(void);
void device_link_wait_removal(void);
+void fw_devlink_relax_consumers(struct device *dev);
static inline bool device_link_test(const struct device_link *link, u32 flags)
{
--
2.22.0
On Thu, Aug 14, 2025 at 07:10:22PM +0800, Wang Wensheng wrote:
> Some devices are added during its parent's probe and will never get
> bound to a driver. In this case, with fw_devlink set to "rpm",
> which is the default value, its consumers will be deferred probe
> until deferred_probe_timeout when fw_devlink_drivers_done() would
> relax the devlinks to the suplier.
>
> Use this function to relax the consumer devlinks, just like what we
> do for the unmatched devices in fw_devlink_drivers_done(), so that
> the consumer devices would be probed not that later.
>
> Signed-off-by: Wang Wensheng <wangwensheng4@huawei.com>
> ---
> drivers/base/core.c | 22 ++++++++++++++++++++++
> include/linux/device.h | 1 +
> 2 files changed, 23 insertions(+)
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index d22d6b23e758..2f7101ad9d11 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -1754,6 +1754,28 @@ static void fw_devlink_relax_link(struct device_link *link)
> dev_name(link->supplier));
> }
>
> +/**
> + * fw_devlink_relax_consumers - Relax the devlinks with all its consumers
> + * @dev: Device whose consumer devlinks will be relaxed
> + *
> + * Some devices are added during its parent's probe and will never get bound
> + * to a driver. In this case its consumers will be deferred probe until
> + * deferred_probe_timeout.
> + *
> + * Use this function to relax the consumer devlinks so that the consumers
> + * device would be probed not that later.
> + */
> +void fw_devlink_relax_consumers(struct device *dev)
> +{
> + struct device_link *link;
> +
> + device_links_write_lock();
> + list_for_each_entry(link, &dev->links.consumers, s_node)
> + fw_devlink_relax_link(link);
> + device_links_write_unlock();
> +}
> +EXPORT_SYMBOL_GPL(fw_devlink_relax_consumers);
We currently do not export any "fw_" functions from the driver core, why
do that now? This feels wrong as this should all be "internal" to the
driver core, no driver should be calling this.
thanks,
greg k-h
On Thu, Aug 14, 2025 at 4:39 AM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Thu, Aug 14, 2025 at 07:10:22PM +0800, Wang Wensheng wrote:
> > Some devices are added during its parent's probe and will never get
> > bound to a driver.
Hi Wang,
I'm guessing you are adding these "will never probe" devices to a bus?
Why are you adding devices to a bus if you'll never probe them? You
should use a "class" if these are devices of a type and don't need to
be probed.
> > In this case, with fw_devlink set to "rpm",
> > which is the default value, its consumers will be deferred probe
> > until deferred_probe_timeout when fw_devlink_drivers_done() would
> > relax the devlinks to the suplier.
> >
> > Use this function to relax the consumer devlinks, just like what we
> > do for the unmatched devices in fw_devlink_drivers_done(), so that
> > the consumer devices would be probed not that later.
This function is not meant for use outside fw_devlink core code.
Write a stub driver or move those devices to a class.
> >
> > Signed-off-by: Wang Wensheng <wangwensheng4@huawei.com>
> > ---
> > drivers/base/core.c | 22 ++++++++++++++++++++++
> > include/linux/device.h | 1 +
> > 2 files changed, 23 insertions(+)
> >
> > diff --git a/drivers/base/core.c b/drivers/base/core.c
> > index d22d6b23e758..2f7101ad9d11 100644
> > --- a/drivers/base/core.c
> > +++ b/drivers/base/core.c
> > @@ -1754,6 +1754,28 @@ static void fw_devlink_relax_link(struct device_link *link)
> > dev_name(link->supplier));
> > }
> >
> > +/**
> > + * fw_devlink_relax_consumers - Relax the devlinks with all its consumers
> > + * @dev: Device whose consumer devlinks will be relaxed
> > + *
> > + * Some devices are added during its parent's probe and will never get bound
> > + * to a driver. In this case its consumers will be deferred probe until
> > + * deferred_probe_timeout.
> > + *
> > + * Use this function to relax the consumer devlinks so that the consumers
> > + * device would be probed not that later.
> > + */
> > +void fw_devlink_relax_consumers(struct device *dev)
> > +{
> > + struct device_link *link;
> > +
> > + device_links_write_lock();
> > + list_for_each_entry(link, &dev->links.consumers, s_node)
> > + fw_devlink_relax_link(link);
> > + device_links_write_unlock();
> > +}
> > +EXPORT_SYMBOL_GPL(fw_devlink_relax_consumers);
>
> We currently do not export any "fw_" functions from the driver core, why
> do that now? This feels wrong as this should all be "internal" to the
> driver core, no driver should be calling this.
Yup, you are right. Definite NACK.
-Saravana
© 2016 - 2026 Red Hat, Inc.