linux-remoteproc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Deepak Kumar Singh <deesin@codeaurora.org>
To: bjorn.andersson@linaro.org, clew@codeaurora.org
Cc: mathieu.poirier@linaro.org, linux-arm-msm@vger.kernel.org,
	linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Arun Kumar Neelakantam <aneela@codeaurora.org>,
	Deepak Kumar Singh <deesin@codeaurora.org>
Subject: [PATCH V1 4/6] rpmsg: glink: Remove the rpmsg dev in close_ack
Date: Thu, 30 Jul 2020 10:48:14 +0530	[thread overview]
Message-ID: <1596086296-28529-5-git-send-email-deesin@codeaurora.org> (raw)
In-Reply-To: <1596086296-28529-1-git-send-email-deesin@codeaurora.org>

From: Arun Kumar Neelakantam <aneela@codeaurora.org>

Un-register and register of rpmsg driver is sending invalid open_ack
on closed channel.

To avoid sending invalid open_ack case unregister the rpmsg device
after receiving the local_close_ack from remote side.

Signed-off-by: Deepak Kumar Singh <deesin@codeaurora.org>
signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
---
 drivers/rpmsg/qcom_glink_native.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
index ac179b1..031bc1d 100644
--- a/drivers/rpmsg/qcom_glink_native.c
+++ b/drivers/rpmsg/qcom_glink_native.c
@@ -1526,6 +1526,7 @@ static void qcom_glink_rx_close(struct qcom_glink *glink, unsigned int rcid)
 
 		rpmsg_unregister_device(glink->dev, &chinfo);
 	}
+	channel->rpdev = NULL;
 
 	qcom_glink_send_close_ack(glink, channel->rcid);
 
@@ -1539,6 +1540,7 @@ static void qcom_glink_rx_close(struct qcom_glink *glink, unsigned int rcid)
 
 static void qcom_glink_rx_close_ack(struct qcom_glink *glink, unsigned int lcid)
 {
+	struct rpmsg_channel_info chinfo;
 	struct glink_channel *channel;
 	unsigned long flags;
 
@@ -1553,6 +1555,16 @@ static void qcom_glink_rx_close_ack(struct qcom_glink *glink, unsigned int lcid)
 	channel->lcid = 0;
 	spin_unlock_irqrestore(&glink->idr_lock, flags);
 
+	/* Decouple the potential rpdev from the channel */
+	if (channel->rpdev) {
+		strlcpy(chinfo.name, channel->name, sizeof(chinfo.name));
+		chinfo.src = RPMSG_ADDR_ANY;
+		chinfo.dst = RPMSG_ADDR_ANY;
+
+		rpmsg_unregister_device(glink->dev, &chinfo);
+	}
+	channel->rpdev = NULL;
+
 	kref_put(&channel->refcount, qcom_glink_channel_release);
 }
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


  parent reply	other threads:[~2020-07-30  5:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-30  5:18 [PATCH V1 0/6] Glink native fixes upstreaming Deepak Kumar Singh
2020-07-30  5:18 ` [PATCH V1 1/6] rpmsg: glink: fix destroy channel endpoint logic Deepak Kumar Singh
2021-10-15 14:47   ` Bjorn Andersson
2020-07-30  5:18 ` [PATCH V1 2/6] rpmsg: glink: Deny intent request if reusable intent fits Deepak Kumar Singh
2021-10-15 15:14   ` Bjorn Andersson
2020-07-30  5:18 ` [PATCH V1 3/6] rpmsg: glink: Add TX_DATA_CONT command while sending Deepak Kumar Singh
2021-10-15 17:22   ` (subset) " Bjorn Andersson
2020-07-30  5:18 ` Deepak Kumar Singh [this message]
2021-10-15 17:22   ` (subset) [PATCH V1 4/6] rpmsg: glink: Remove the rpmsg dev in close_ack Bjorn Andersson
2020-07-30  5:18 ` [PATCH V1 5/6] rpmsg: glink: Remove channel decouple from rpdev release Deepak Kumar Singh
2021-10-15 17:22   ` (subset) " Bjorn Andersson
2020-07-30  5:18 ` [PATCH V1 6/6] rpmsg: glink: Send READ_NOTIFY command in FIFO full case Deepak Kumar Singh
2021-10-15 17:22   ` (subset) " Bjorn Andersson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1596086296-28529-5-git-send-email-deesin@codeaurora.org \
    --to=deesin@codeaurora.org \
    --cc=aneela@codeaurora.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=clew@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).