mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-09 15:24:32 +08:00
driver core: Fix device link deferred probe
A device probe deferred because of a device link is never probed again because it is not added to the deferred_probe_pending_list. Add it, taking care of the race with driver_deferred_probe_trigger(). Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
2b2d8788dd
commit
0ff26c662d
@ -350,6 +350,15 @@ EXPORT_SYMBOL_GPL(device_bind_driver);
|
|||||||
static atomic_t probe_count = ATOMIC_INIT(0);
|
static atomic_t probe_count = ATOMIC_INIT(0);
|
||||||
static DECLARE_WAIT_QUEUE_HEAD(probe_waitqueue);
|
static DECLARE_WAIT_QUEUE_HEAD(probe_waitqueue);
|
||||||
|
|
||||||
|
static void driver_deferred_probe_add_trigger(struct device *dev,
|
||||||
|
int local_trigger_count)
|
||||||
|
{
|
||||||
|
driver_deferred_probe_add(dev);
|
||||||
|
/* Did a trigger occur while probing? Need to re-trigger if yes */
|
||||||
|
if (local_trigger_count != atomic_read(&deferred_trigger_count))
|
||||||
|
driver_deferred_probe_trigger();
|
||||||
|
}
|
||||||
|
|
||||||
static int really_probe(struct device *dev, struct device_driver *drv)
|
static int really_probe(struct device *dev, struct device_driver *drv)
|
||||||
{
|
{
|
||||||
int ret = -EPROBE_DEFER;
|
int ret = -EPROBE_DEFER;
|
||||||
@ -369,6 +378,8 @@ static int really_probe(struct device *dev, struct device_driver *drv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = device_links_check_suppliers(dev);
|
ret = device_links_check_suppliers(dev);
|
||||||
|
if (ret == -EPROBE_DEFER)
|
||||||
|
driver_deferred_probe_add_trigger(dev, local_trigger_count);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
@ -469,10 +480,7 @@ pinctrl_bind_failed:
|
|||||||
case -EPROBE_DEFER:
|
case -EPROBE_DEFER:
|
||||||
/* Driver requested deferred probing */
|
/* Driver requested deferred probing */
|
||||||
dev_dbg(dev, "Driver %s requests probe deferral\n", drv->name);
|
dev_dbg(dev, "Driver %s requests probe deferral\n", drv->name);
|
||||||
driver_deferred_probe_add(dev);
|
driver_deferred_probe_add_trigger(dev, local_trigger_count);
|
||||||
/* Did a trigger occur while probing? Need to re-trigger if yes */
|
|
||||||
if (local_trigger_count != atomic_read(&deferred_trigger_count))
|
|
||||||
driver_deferred_probe_trigger();
|
|
||||||
break;
|
break;
|
||||||
case -ENODEV:
|
case -ENODEV:
|
||||||
case -ENXIO:
|
case -ENXIO:
|
||||||
|
Loading…
Reference in New Issue
Block a user