Re: [PATCH v2 1/9] rpmsg: Move rpmsg_endpoint_ops to rpmsg.h

From: Arnaud POULIQUEN
Date: Thu Oct 15 2020 - 04:48:45 EST


On 10/14/20 1:25 AM, Mathieu Poirier wrote:
> Move structure rpmsg_endpoint_ops to header rpmsg.h so that it can
> be used by other entities.
>
> Signed-off-by: Mathieu Poirier <mathieu.poirier@xxxxxxxxxx>
> ---
> drivers/rpmsg/rpmsg_internal.h | 19 -------------------
> include/linux/rpmsg.h | 24 +++++++++++++++++++++---
> 2 files changed, 21 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/rpmsg/rpmsg_internal.h b/drivers/rpmsg/rpmsg_internal.h
> index 3fc83cd50e98..094cf968d2d3 100644
> --- a/drivers/rpmsg/rpmsg_internal.h
> +++ b/drivers/rpmsg/rpmsg_internal.h
> @@ -18,25 +18,6 @@
> #define to_rpmsg_device(d) container_of(d, struct rpmsg_device, dev)
> #define to_rpmsg_driver(d) container_of(d, struct rpmsg_driver, drv)
>
> -/**
> - * struct rpmsg_device_ops - indirection table for the rpmsg_device operations
> - * @create_ept: create backend-specific endpoint, required
> - * @announce_create: announce presence of new channel, optional
> - * @announce_destroy: announce destruction of channel, optional
> - *
> - * Indirection table for the operations that a rpmsg backend should implement.
> - * @announce_create and @announce_destroy are optional as the backend might
> - * advertise new channels implicitly by creating the endpoints.
> - */
> -struct rpmsg_device_ops {
> - struct rpmsg_endpoint *(*create_ept)(struct rpmsg_device *rpdev,
> - rpmsg_rx_cb_t cb, void *priv,
> - struct rpmsg_channel_info chinfo);
> -
> - int (*announce_create)(struct rpmsg_device *ept);
> - int (*announce_destroy)(struct rpmsg_device *ept);
> -};
> -
> /**
> * struct rpmsg_endpoint_ops - indirection table for rpmsg_endpoint operations
> * @destroy_ept: see @rpmsg_destroy_ept(), required
> diff --git a/include/linux/rpmsg.h b/include/linux/rpmsg.h
> index 9fe156d1c018..9fe1c54ae995 100644
> --- a/include/linux/rpmsg.h
> +++ b/include/linux/rpmsg.h
> @@ -22,7 +22,6 @@
>
> struct rpmsg_device;
> struct rpmsg_endpoint;
> -struct rpmsg_device_ops;
> struct rpmsg_endpoint_ops;
>
> /**
> @@ -37,6 +36,27 @@ struct rpmsg_channel_info {
> u32 dst;
> };
>
> +typedef int (*rpmsg_rx_cb_t)(struct rpmsg_device *, void *, int, void *, u32);
> +
> +/**
> + * struct rpmsg_device_ops - indirection table for the rpmsg_device operations
> + * @create_ept: create backend-specific endpoint, required
> + * @announce_create: announce presence of new channel, optional
> + * @announce_destroy: announce destruction of channel, optional
> + *
> + * Indirection table for the operations that a rpmsg backend should implement.
> + * @announce_create and @announce_destroy are optional as the backend might
> + * advertise new channels implicitly by creating the endpoints.
> + */
> +struct rpmsg_device_ops {
> + struct rpmsg_endpoint *(*create_ept)(struct rpmsg_device *rpdev,
> + rpmsg_rx_cb_t cb, void *priv,
> + struct rpmsg_channel_info chinfo);
> +
> + int (*announce_create)(struct rpmsg_device *ept);
> + int (*announce_destroy)(struct rpmsg_device *ept);
> +};
> +
> /**
> * rpmsg_device - device that belong to the rpmsg bus
> * @dev: the device struct
> @@ -59,8 +79,6 @@ struct rpmsg_device {
> const struct rpmsg_device_ops *ops;
> };
>
> -typedef int (*rpmsg_rx_cb_t)(struct rpmsg_device *, void *, int, void *, u32);
> -
> /**
> * struct rpmsg_endpoint - binds a local rpmsg address to its user
> * @rpdev: rpmsg channel device
>

Reviewed-by: Arnaud Pouliquen <arnaud.pouliquen@xxxxxx>

Thanks,
Arnaud