Skip to content

Commit

Permalink
rpmsg_virtio: Do not use rpmsg_virtio_{get,set} helpers
Browse files Browse the repository at this point in the history
These functions are deprecated, use their replacements.

Signed-off-by: Andrew Davis <afd@ti.com>
  • Loading branch information
glneo committed Mar 14, 2024
1 parent a51982e commit 7940c53
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/rpmsg/rpmsg_virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,10 @@ static int rpmsg_virtio_wait_remote_ready(struct rpmsg_virtio_device *rvdev)
uint8_t status;

while (1) {
status = rpmsg_virtio_get_status(rvdev);
virtio_get_status(rvdev->vdev, &status);
/* Busy wait until the remote is ready */
if (status & VIRTIO_CONFIG_STATUS_NEEDS_RESET) {
rpmsg_virtio_set_status(rvdev, 0);
virtio_set_status(rvdev->vdev, 0);
/* TODO notify remote processor */
} else if (status & VIRTIO_CONFIG_STATUS_DRIVER_OK) {
return true;
Expand Down Expand Up @@ -371,6 +371,7 @@ static void *rpmsg_virtio_get_tx_payload_buffer(struct rpmsg_device *rdev,
{
struct rpmsg_virtio_device *rvdev;
struct rpmsg_hdr *rp_hdr;
uint8_t virtio_status;
uint16_t idx;
int tick_count;
int status;
Expand All @@ -379,8 +380,8 @@ static void *rpmsg_virtio_get_tx_payload_buffer(struct rpmsg_device *rdev,
rvdev = metal_container_of(rdev, struct rpmsg_virtio_device, rdev);

/* Validate device state */
status = rpmsg_virtio_get_status(rvdev);
if (!(status & VIRTIO_CONFIG_STATUS_DRIVER_OK))
virtio_get_status(rvdev->vdev, &virtio_status);
if (!(virtio_status & VIRTIO_CONFIG_STATUS_DRIVER_OK))
return NULL;

if (wait)
Expand Down Expand Up @@ -808,6 +809,7 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
struct rpmsg_device *rdev;
const char *vq_names[RPMSG_NUM_VRINGS];
vq_callback callback[RPMSG_NUM_VRINGS];
uint32_t features;
int status;
unsigned int i, role;

Expand Down Expand Up @@ -851,8 +853,8 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
rpmsg_virtio_wait_remote_ready(rvdev);
}
#endif /*!VIRTIO_DRIVER_ONLY*/
vdev->features = rpmsg_virtio_get_features(rvdev);
rdev->support_ns = !!(vdev->features & (1 << VIRTIO_RPMSG_F_NS));
virtio_get_features(rvdev->vdev, &features);
rdev->support_ns = !!(features & (1 << VIRTIO_RPMSG_F_NS));

#ifndef VIRTIO_DEVICE_ONLY
if (role == RPMSG_HOST) {
Expand Down Expand Up @@ -969,7 +971,7 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,

#ifndef VIRTIO_DEVICE_ONLY
if (role == RPMSG_HOST)
rpmsg_virtio_set_status(rvdev, VIRTIO_CONFIG_STATUS_DRIVER_OK);
virtio_set_status(rvdev->vdev, VIRTIO_CONFIG_STATUS_DRIVER_OK);
#endif /*!VIRTIO_DEVICE_ONLY*/

return RPMSG_SUCCESS;
Expand Down

0 comments on commit 7940c53

Please sign in to comment.