mirror of
https://github.com/OpenAMP/open-amp.git
synced 2026-02-06 02:54:32 +08:00
rpmsg_virtio: Move returned buffer kick to common location
After returning a buffer we kick the other side. This is done after both call sites of the function that returns the buffer. Move this kick call into that function to reduce code duplication and prevent it from not being done after returning the buffer. Signed-off-by: Andrew Davis <afd@ti.com>
This commit is contained in:
committed by
Arnaud Pouliquen
parent
7257deaab3
commit
40820be223
@@ -326,6 +326,8 @@ static bool rpmsg_virtio_release_rx_buffer_nolock(struct rpmsg_virtio_device *rv
|
||||
/* Return buffer on virtqueue. */
|
||||
len = virtqueue_get_buffer_length(rvdev->rvq, idx);
|
||||
rpmsg_virtio_return_buffer(rvdev, rp_hdr, len, idx);
|
||||
/* Tell peer we returned an rx buffer */
|
||||
virtqueue_kick(rvdev->rvq);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -340,11 +342,8 @@ static void rpmsg_virtio_release_rx_buffer(struct rpmsg_device *rdev,
|
||||
rp_hdr = RPMSG_LOCATE_HDR(rxbuf);
|
||||
|
||||
metal_mutex_acquire(&rdev->lock);
|
||||
if (rpmsg_virtio_buf_held_dec_test(rp_hdr)) {
|
||||
if (rpmsg_virtio_buf_held_dec_test(rp_hdr))
|
||||
rpmsg_virtio_release_rx_buffer_nolock(rvdev, rp_hdr);
|
||||
/* Tell peer we return some rx buffers */
|
||||
virtqueue_kick(rvdev->rvq);
|
||||
}
|
||||
metal_mutex_release(&rdev->lock);
|
||||
}
|
||||
|
||||
@@ -608,10 +607,6 @@ static void rpmsg_virtio_rx_callback(struct virtqueue *vq)
|
||||
rpmsg_virtio_release_rx_buffer_nolock(rvdev, rp_hdr);
|
||||
|
||||
rp_hdr = rpmsg_virtio_get_rx_buffer(rvdev, &len, &idx);
|
||||
if (!rp_hdr) {
|
||||
/* tell peer we return some rx buffer */
|
||||
virtqueue_kick(rvdev->rvq);
|
||||
}
|
||||
metal_mutex_release(&rdev->lock);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user