Merge tag 'driver-core-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[muen/linux.git] / drivers / base / dd.c
index 45575e134696280b4b2de4635b9631f1737b0f58..2c964f56dafe2a98706ca9cd5520e50bacf551f6 100644 (file)
@@ -350,6 +350,15 @@ EXPORT_SYMBOL_GPL(device_bind_driver);
 static atomic_t probe_count = ATOMIC_INIT(0);
 static DECLARE_WAIT_QUEUE_HEAD(probe_waitqueue);
 
 static atomic_t probe_count = ATOMIC_INIT(0);
 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)
 {
        int ret = -EPROBE_DEFER;
 static int really_probe(struct device *dev, struct device_driver *drv)
 {
        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)
                return ret;
 
        if (ret)
                return ret;
 
@@ -470,10 +481,7 @@ pinctrl_bind_failed:
        case -EPROBE_DEFER:
                /* Driver requested deferred probing */
                dev_dbg(dev, "Driver %s requests probe deferral\n", drv->name);
        case -EPROBE_DEFER:
                /* Driver requested deferred probing */
                dev_dbg(dev, "Driver %s requests probe deferral\n", drv->name);
-               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();
+               driver_deferred_probe_add_trigger(dev, local_trigger_count);
                break;
        case -ENODEV:
        case -ENXIO:
                break;
        case -ENODEV:
        case -ENXIO: