rpmsg: glink: Remove the rpmsg dev in close_ack

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.

CRs-Fixed: 2275152
Change-Id: I5255c8bb55cb3bc35d9813a3a349d8af391d1862
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
This commit is contained in:
Arun Kumar Neelakantam 2018-11-26 15:15:00 +05:30 committed by Chris Lew
parent 74427beff8
commit c0f4d1deef

View file

@ -1387,9 +1387,6 @@ static void qcom_glink_destroy_ept(struct rpmsg_endpoint *ept)
channel->ept.cb = NULL;
spin_unlock_irqrestore(&channel->recv_lock, flags);
/* Decouple the potential rpdev from the channel */
channel->rpdev = NULL;
qcom_glink_send_close_req(glink, channel);
}
@ -1714,6 +1711,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);
@ -1727,6 +1725,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;
@ -1742,6 +1741,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);
}