Skip to content

Commit

Permalink
rpmsg_virtio: move RPMSG_VIRTIO_DEFAULT_CONFIG to private location
Browse files Browse the repository at this point in the history
and define it to NULL when VIRTIO_SLAVE_ONLY is defined to save space

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
  • Loading branch information
xiaoxiang781216 authored and arnopo committed Jan 24, 2022
1 parent a12d03c commit 3531221
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
7 changes: 0 additions & 7 deletions lib/include/openamp/rpmsg_virtio.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@ struct rpmsg_virtio_config {
uint32_t r2h_buf_size;
};

/* Default configuration */
#define RPMSG_VIRTIO_DEFAULT_CONFIG \
((const struct rpmsg_virtio_config) { \
.h2r_buf_size = RPMSG_BUFFER_SIZE, \
.r2h_buf_size = RPMSG_BUFFER_SIZE, \
})

/**
* struct rpmsg_virtio_device - representation of a rpmsg device based on virtio
* @rdev: rpmsg device, first property in the struct
Expand Down
14 changes: 13 additions & 1 deletion lib/rpmsg/rpmsg_virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@
/* Time to wait - In multiple of 1 msecs. */
#define RPMSG_TICKS_PER_INTERVAL 1000


/* Default configuration */
#ifndef VIRTIO_SLAVE_ONLY
#define RPMSG_VIRTIO_DEFAULT_CONFIG \
(&(const struct rpmsg_virtio_config) { \
.h2r_buf_size = RPMSG_BUFFER_SIZE, \
.r2h_buf_size = RPMSG_BUFFER_SIZE, \
})
#else
#define RPMSG_VIRTIO_DEFAULT_CONFIG NULL
#endif

#ifndef VIRTIO_SLAVE_ONLY
metal_weak void *
rpmsg_virtio_shm_pool_get_buffer(struct rpmsg_virtio_shm_pool *shpool,
Expand Down Expand Up @@ -613,7 +625,7 @@ int rpmsg_init_vdev(struct rpmsg_virtio_device *rvdev,
struct rpmsg_virtio_shm_pool *shpool)
{
return rpmsg_init_vdev_with_config(rvdev, vdev, ns_bind_cb, shm_io,
shpool, &RPMSG_VIRTIO_DEFAULT_CONFIG);
shpool, RPMSG_VIRTIO_DEFAULT_CONFIG);
}

int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
Expand Down

0 comments on commit 3531221

Please sign in to comment.