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

Commit fe194d74 authored by Konstantin Dorfman's avatar Konstantin Dorfman
Browse files

rpmsg: glink: fix destroy channel endpoint logic



When rpmsg client driver destroys last channel endpoint, remove rpmsg
device is triggered. In both cases (destroy endpoint and remove device)
a glink close command sent to the remote peer.

This change, when for removing rpmsg device endpoint already destroyed
will avoid sending second glink close command.

Change-Id: I0135e2626f4ede7a380308944f7c273d18e223bf
Signed-off-by: default avatarKonstantin Dorfman <kdorfman@codeaurora.org>
parent 01e3405d
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2016-2017, Linaro Ltd
 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2018-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
@@ -1388,6 +1388,10 @@ static void qcom_glink_destroy_ept(struct rpmsg_endpoint *ept)
	unsigned long flags;

	spin_lock_irqsave(&channel->recv_lock, flags);
	if (!channel->ept.cb) {
		spin_unlock_irqrestore(&channel->recv_lock, flags);
		return;
	}
	channel->ept.cb = NULL;
	spin_unlock_irqrestore(&channel->recv_lock, flags);