mirror of
https://github.com/OpenAMP/open-amp.git
synced 2026-10-02 18:23:21 +08:00
rpmsg: Replace rvdev->vdev with vdev in rpmsg_init_vdev_with_config
vdev is passed by argument, so we don't need accees it indirectly Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
committed by
Arnaud Pouliquen
parent
c468328487
commit
e7e7593ca3
+12
-12
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
@@ -932,8 +932,8 @@ 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;
|
||||
}
|
||||
@@ -941,7 +941,7 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
|
||||
return RPMSG_SUCCESS;
|
||||
|
||||
err:
|
||||
virtio_delete_virtqueues(rvdev->vdev);
|
||||
virtio_delete_virtqueues(vdev);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user