mailbox: msm_qmp: Wait for link up in mbox_startup

There is a chance a client probe can start before the link is
established with the remote processor. Add a wait for link up in the
mailbox startup to prevent extra probe deferrrals for clients.

Change-Id: Idd53349cd91e810126be62bcf27adc53a98417ec
Signed-off-by: Chris Lew <clew@codeaurora.org>
This commit is contained in:
Chris Lew 2019-01-11 16:31:28 -08:00
parent edcd9db1db
commit 6ae7336a4e

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
*/
#include <linux/io.h>
@ -337,12 +337,12 @@ static int qmp_startup(struct mbox_chan *chan)
if (!mbox)
return -EINVAL;
mutex_lock(&mbox->state_lock);
if (!completion_done(&mbox->link_complete)) {
mutex_unlock(&mbox->state_lock);
ret = wait_for_completion_timeout(&mbox->link_complete,
msecs_to_jiffies(QMP_TOUT_MS));
if (!ret)
return -EAGAIN;
}
mutex_lock(&mbox->state_lock);
if (mbox->local_state == LINK_CONNECTED) {
set_mcore_ch(mbox, QMP_MBOX_CH_CONNECTED);
mbox->local_state = LOCAL_CONNECTING;