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

Commit 089d3228 authored by Konstantin Dorfman's avatar Konstantin Dorfman Committed by Gerrit - the friendly Code Review server
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 654fadad
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (c) 2016-2017, Linaro Ltd
 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
 */

#include <linux/idr.h>
@@ -1354,6 +1355,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);