Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6ae7336a authored by Chris Lew's avatar Chris Lew
Browse files

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: default avatarChris Lew <clew@codeaurora.org>
parent edcd9db1
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
// 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;