s390/ap: Fix bind complete udev event sent after each AP bus scan
[linux-2.6-block.git] / drivers / s390 / crypto / ap_bus.c
index 8b7703f7da760ca0986df480134ff551fa45c5c1..898865be0dad91ea2d15276a0ecb31771ea16628 100644 (file)
@@ -732,9 +732,9 @@ static void ap_check_bindings_complete(void)
                if (bound == apqns) {
                        if (!completion_done(&ap_apqn_bindings_complete)) {
                                complete_all(&ap_apqn_bindings_complete);
+                               ap_send_bindings_complete_uevent();
                                pr_debug("%s all apqn bindings complete\n", __func__);
                        }
-                       ap_send_bindings_complete_uevent();
                }
        }
 }
@@ -894,6 +894,12 @@ static int ap_device_probe(struct device *dev)
                        goto out;
        }
 
+       /*
+        * Rearm the bindings complete completion to trigger
+        * bindings complete when all devices are bound again
+        */
+       reinit_completion(&ap_apqn_bindings_complete);
+
        /* Add queue/card to list of active queues/cards */
        spin_lock_bh(&ap_queues_lock);
        if (is_queue_dev(dev))