The open_req and open_ack completion variables are the state variables
to represet a remote channel as open. Use complete_all so there are no
races with waiters and using completion_done.
Signed-off-by: Chris Lew <clew@codeaurora.org>
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Deepak Kumar Singh <deesin@codeaurora.org>
Link: https://lore.kernel.org/r/1593017121-7953-2-git-send-email-deesin@codeaurora.org
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
                return -EINVAL;
        }
 
-       complete(&channel->open_ack);
+       complete_all(&channel->open_ack);
 
        return 0;
 }
        __be32 *val = defaults;
        int size;
 
-       if (glink->intentless)
+       if (glink->intentless || !completion_done(&channel->open_ack))
                return 0;
 
        prop = of_find_property(np, "qcom,intents", NULL);
        channel->rcid = ret;
        spin_unlock_irqrestore(&glink->idr_lock, flags);
 
-       complete(&channel->open_req);
+       complete_all(&channel->open_req);
 
        if (create_device) {
                rpdev = kzalloc(sizeof(*rpdev), GFP_KERNEL);