rpmsg: glink: Add pipe reset functionality

Some remote procs do not initialize the pipe when they are started
and assume the data in the pipe descriptors is valid. Add an optional
handler to clear the pipe descriptors and call this during removal
of the glink device to ensure a clean restart of glink.

Change-Id: I62871cc5d6fd052e234843645299fdc87a71185f
Signed-off-by: Chris Lew <clew@codeaurora.org>
This commit is contained in:
Chris Lew 2018-04-17 18:05:22 -07:00 committed by Chris Lew
parent 1b8b9571dd
commit a2420135bd
2 changed files with 13 additions and 0 deletions

View File

@ -326,6 +326,15 @@ static void qcom_glink_tx_write(struct qcom_glink *glink,
glink->tx_pipe->write(glink->tx_pipe, hdr, hlen, data, dlen);
}
static void qcom_glink_pipe_reset(struct qcom_glink *glink)
{
if (glink->tx_pipe->reset)
glink->tx_pipe->reset(glink->tx_pipe);
if (glink->rx_pipe->reset)
glink->rx_pipe->reset(glink->rx_pipe);
}
static void qcom_glink_send_read_notify(struct qcom_glink *glink)
{
struct glink_msg msg;
@ -1982,6 +1991,8 @@ void qcom_glink_native_remove(struct qcom_glink *glink)
idr_destroy(&glink->lcids);
idr_destroy(&glink->rcids);
qcom_glink_pipe_reset(glink);
mbox_free_channel(glink->mbox_chan);
}
EXPORT_SYMBOL_GPL(qcom_glink_native_remove);

View File

@ -22,6 +22,8 @@ struct qcom_glink_pipe {
void (*write)(struct qcom_glink_pipe *glink_pipe,
const void *hdr, size_t hlen,
const void *data, size_t dlen);
void (*reset)(struct qcom_glink_pipe *glink_pipe);
};
struct qcom_glink;