Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpmsg: Replace rvdev->vdev with vdev in rpmsg_init_vdev_with_config #621

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions lib/rpmsg/rpmsg_virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
rdev->ops.get_rx_buffer_size = rpmsg_virtio_get_rx_buffer_size;
rdev->ops.get_tx_buffer_size = rpmsg_virtio_get_tx_buffer_size;

if (VIRTIO_ROLE_IS_DRIVER(rvdev->vdev)) {
if (VIRTIO_ROLE_IS_DRIVER(vdev)) {
/*
* The virtio configuration contains only options applicable to
* a virtio driver, implying rpmsg host role.
Expand All @@ -817,19 +817,19 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
rvdev->config = *config;
}

if (VIRTIO_ROLE_IS_DEVICE(rvdev->vdev)) {
if (VIRTIO_ROLE_IS_DEVICE(vdev)) {
/* wait synchro with the host */
status = rpmsg_virtio_wait_remote_ready(rvdev);
if (status)
return status;
}

status = virtio_get_features(rvdev->vdev, &features);
status = virtio_get_features(vdev, &features);
if (status)
return status;
rdev->support_ns = !!(features & (1 << VIRTIO_RPMSG_F_NS));

if (VIRTIO_ROLE_IS_DRIVER(rvdev->vdev)) {
if (VIRTIO_ROLE_IS_DRIVER(vdev)) {
/*
* Since device is RPMSG Remote so we need to manage the
* shared buffers. Create shared memory pool to handle buffers.
Expand All @@ -846,7 +846,7 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
callback[1] = rpmsg_virtio_tx_callback;
}

if (VIRTIO_ROLE_IS_DEVICE(rvdev->vdev)) {
if (VIRTIO_ROLE_IS_DEVICE(vdev)) {
vq_names[0] = "tx_vq";
vq_names[1] = "rx_vq";
callback[0] = rpmsg_virtio_tx_callback;
Expand All @@ -857,18 +857,18 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
metal_list_init(&rvdev->reclaimer);

/* Create virtqueues for remote device */
status = virtio_create_virtqueues(rvdev->vdev, 0, RPMSG_NUM_VRINGS,
status = virtio_create_virtqueues(vdev, 0, RPMSG_NUM_VRINGS,
vq_names, callback, NULL);
if (status != RPMSG_SUCCESS)
return status;

/* Create virtqueue success, assign back the virtqueue */
if (VIRTIO_ROLE_IS_DRIVER(rvdev->vdev)) {
if (VIRTIO_ROLE_IS_DRIVER(vdev)) {
rvdev->rvq = vdev->vrings_info[0].vq;
rvdev->svq = vdev->vrings_info[1].vq;
}

if (VIRTIO_ROLE_IS_DEVICE(rvdev->vdev)) {
if (VIRTIO_ROLE_IS_DEVICE(vdev)) {
rvdev->rvq = vdev->vrings_info[1].vq;
rvdev->svq = vdev->vrings_info[0].vq;
}
Expand All @@ -887,7 +887,7 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
vq->shm_io = shm_io;
}

if (VIRTIO_ROLE_IS_DRIVER(rvdev->vdev)) {
if (VIRTIO_ROLE_IS_DRIVER(vdev)) {
struct virtqueue_buf vqbuf;
unsigned int idx;
void *buffer;
Expand Down Expand Up @@ -932,16 +932,16 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
rpmsg_virtio_ns_callback, NULL, rvdev);
}

if (VIRTIO_ROLE_IS_DRIVER(rvdev->vdev)) {
status = virtio_set_status(rvdev->vdev, VIRTIO_CONFIG_STATUS_DRIVER_OK);
if (VIRTIO_ROLE_IS_DRIVER(vdev)) {
status = virtio_set_status(vdev, VIRTIO_CONFIG_STATUS_DRIVER_OK);
if (status)
goto err;
}

return RPMSG_SUCCESS;

err:
virtio_delete_virtqueues(rvdev->vdev);
virtio_delete_virtqueues(vdev);
return status;
}

Expand Down
Loading