[1/6] rpmsg: glink: Extract tx kick operation
Commit Message
Refactor out the tx kick operations to its own function, in preparation
for pushing the details to the individual transports.
Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
---
drivers/rpmsg/qcom_glink_native.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
Comments
On 1/9/2023 2:39 PM, Bjorn Andersson wrote:
> Refactor out the tx kick operations to its own function, in preparation
> for pushing the details to the individual transports.
>
> Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
> ---
Reviewed-by: Chris Lew <quic_clew@quicinc.com>
> drivers/rpmsg/qcom_glink_native.c | 17 +++++++++--------
> 1 file changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
> index 115c0a1eddb1..5fd8b70271b7 100644
> --- a/drivers/rpmsg/qcom_glink_native.c
> +++ b/drivers/rpmsg/qcom_glink_native.c
> @@ -303,6 +303,12 @@ 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_tx_kick(struct qcom_glink *glink)
> +{
> + mbox_send_message(glink->mbox_chan, NULL);
> + mbox_client_txdone(glink->mbox_chan, 0);
> +}
> +
> static void qcom_glink_send_read_notify(struct qcom_glink *glink)
> {
> struct glink_msg msg;
> @@ -313,8 +319,7 @@ static void qcom_glink_send_read_notify(struct qcom_glink *glink)
>
> qcom_glink_tx_write(glink, &msg, sizeof(msg), NULL, 0);
>
> - mbox_send_message(glink->mbox_chan, NULL);
> - mbox_client_txdone(glink->mbox_chan, 0);
> + qcom_glink_tx_kick(glink);
> }
>
> static int qcom_glink_tx(struct qcom_glink *glink,
> @@ -355,9 +360,7 @@ static int qcom_glink_tx(struct qcom_glink *glink,
> }
>
> qcom_glink_tx_write(glink, hdr, hlen, data, dlen);
> -
> - mbox_send_message(glink->mbox_chan, NULL);
> - mbox_client_txdone(glink->mbox_chan, 0);
> + qcom_glink_tx_kick(glink);
>
> out:
> spin_unlock_irqrestore(&glink->tx_lock, flags);
> @@ -1046,9 +1049,7 @@ static irqreturn_t qcom_glink_native_intr(int irq, void *data)
> break;
> case RPM_CMD_READ_NOTIF:
> qcom_glink_rx_advance(glink, ALIGN(sizeof(msg), 8));
> -
> - mbox_send_message(glink->mbox_chan, NULL);
> - mbox_client_txdone(glink->mbox_chan, 0);
> + qcom_glink_tx_kick(glink);
> break;
> case RPM_CMD_INTENT:
> qcom_glink_handle_intent(glink, param1, param2, avail);
@@ -303,6 +303,12 @@ 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_tx_kick(struct qcom_glink *glink)
+{
+ mbox_send_message(glink->mbox_chan, NULL);
+ mbox_client_txdone(glink->mbox_chan, 0);
+}
+
static void qcom_glink_send_read_notify(struct qcom_glink *glink)
{
struct glink_msg msg;
@@ -313,8 +319,7 @@ static void qcom_glink_send_read_notify(struct qcom_glink *glink)
qcom_glink_tx_write(glink, &msg, sizeof(msg), NULL, 0);
- mbox_send_message(glink->mbox_chan, NULL);
- mbox_client_txdone(glink->mbox_chan, 0);
+ qcom_glink_tx_kick(glink);
}
static int qcom_glink_tx(struct qcom_glink *glink,
@@ -355,9 +360,7 @@ static int qcom_glink_tx(struct qcom_glink *glink,
}
qcom_glink_tx_write(glink, hdr, hlen, data, dlen);
-
- mbox_send_message(glink->mbox_chan, NULL);
- mbox_client_txdone(glink->mbox_chan, 0);
+ qcom_glink_tx_kick(glink);
out:
spin_unlock_irqrestore(&glink->tx_lock, flags);
@@ -1046,9 +1049,7 @@ static irqreturn_t qcom_glink_native_intr(int irq, void *data)
break;
case RPM_CMD_READ_NOTIF:
qcom_glink_rx_advance(glink, ALIGN(sizeof(msg), 8));
-
- mbox_send_message(glink->mbox_chan, NULL);
- mbox_client_txdone(glink->mbox_chan, 0);
+ qcom_glink_tx_kick(glink);
break;
case RPM_CMD_INTENT:
qcom_glink_handle_intent(glink, param1, param2, avail);