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

Commit 7d4b5093 authored by Konstantin Dorfman's avatar Konstantin Dorfman Committed by Gerrit - the friendly Code Review server
Browse files

soc: qcom: spcom: fix poll() for channel connected



Userspace loads SP application and immediately polls for link up on
spcom channel matching the application loaded.

There is a race between rpmsg device arrived and channel state becomes
connected, so poll() called on channel returns 1(link up) to spcomlib.

This change fixes link up logic: instead of checking the channel
completion state, need to check that rpmsg device arrived for the
channel.

Change-Id: I1920a9a55d6ab0cf886996b27e32515df465cc9b
Signed-off-by: default avatarKonstantin Dorfman <kdorfman@codeaurora.org>
parent 6a56d6a5
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
/*
 * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -1611,7 +1611,8 @@ static unsigned int spcom_device_poll(struct file *filp,
			pr_debug("ch [%s] poll CH_CONNECT signaled.\n", name);
		}
		mutex_lock(&ch->lock);
		done = completion_done(&ch->connect);
		done = (ch->rpdev != NULL);
		pr_debug("ch [%s] reported done=%d\n", name, done);
		mutex_unlock(&ch->lock);
		break;
	default: