From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>,
Ohad Ben-Cohen <ohad@wizery.com>,
linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com
Subject: Re: [PATCH 2/9] rpmsg: core: add channel creation internal API
Date: Mon, 24 Aug 2020 16:44:46 -0600 [thread overview]
Message-ID: <20200824224446.GC3938186@xps15> (raw)
In-Reply-To: <20200731114732.12815-3-arnaud.pouliquen@st.com>
Hi Arnaud,
On Fri, Jul 31, 2020 at 01:47:25PM +0200, Arnaud Pouliquen wrote:
> Add the channel creation API as a first step to be able to define the
> name service announcement as a rpmsg driver independent from the RPMsg
> virtio bus.
>
> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
> ---
> drivers/rpmsg/rpmsg_core.c | 37 ++++++++++++++++++++++++++++++++++
> drivers/rpmsg/rpmsg_internal.h | 12 +++++++++++
> 2 files changed, 49 insertions(+)
>
> diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c
> index a6361cad608b..ae7da4a2e528 100644
> --- a/drivers/rpmsg/rpmsg_core.c
> +++ b/drivers/rpmsg/rpmsg_core.c
> @@ -20,6 +20,43 @@
>
> #include "rpmsg_internal.h"
>
> +/**
> + * rpmsg_create_channel() - create a new rpmsg channel
> + * using its name and address info.
> + * @rpdev: rpmsg driver
> + * @chinfo: channel_info to bind
> + *
> + * Returns a pointer to the new rpmsg device on success, or NULL on error.
> + */
> +struct rpmsg_device *
> + rpmsg_create_channel(struct rpmsg_device *rpdev,
> + struct rpmsg_channel_info *chinfo)
> +{
> + if (WARN_ON(!rpdev) || !rpdev->ops->create_channel)
> + return NULL;
Ok for the WARN_ON(). In another if(), I would check for ops and
ops->create_channel(). Same for the release() operation.
> +
> + return rpdev->ops->create_channel(rpdev, chinfo);
> +}
> +EXPORT_SYMBOL(rpmsg_create_channel);
> +
> +/**
> + * rpmsg_release_channel() - release a rpmsg channel
> + * using its name and address info.
> + * @rpdev: rpmsg driver
> + * @chinfo: channel_info to bind
> + *
> + * Returns a pointer to the new rpmsg device on success, or NULL on error.
> + */
> +int rpmsg_release_channel(struct rpmsg_device *rpdev,
> + struct rpmsg_channel_info *chinfo)
> +{
> + if (WARN_ON(!rpdev) || !rpdev->ops->release_channel)
> + return 0;
> +
> + return rpdev->ops->release_channel(rpdev, chinfo);
> +}
> +EXPORT_SYMBOL(rpmsg_release_channel);
> +
> /**
> * rpmsg_create_ept() - create a new rpmsg_endpoint
> * @rpdev: rpmsg channel device
> diff --git a/drivers/rpmsg/rpmsg_internal.h b/drivers/rpmsg/rpmsg_internal.h
> index 3fc83cd50e98..d5ab286d0e5e 100644
> --- a/drivers/rpmsg/rpmsg_internal.h
> +++ b/drivers/rpmsg/rpmsg_internal.h
> @@ -20,6 +20,8 @@
>
> /**
> * struct rpmsg_device_ops - indirection table for the rpmsg_device operations
> + * @create_channel: create backend-specific channel, optional
> + * @release_channel: release backend-specific channel, optional
> * @create_ept: create backend-specific endpoint, required
> * @announce_create: announce presence of new channel, optional
> * @announce_destroy: announce destruction of channel, optional
> @@ -29,6 +31,11 @@
> * advertise new channels implicitly by creating the endpoints.
> */
> struct rpmsg_device_ops {
> + struct rpmsg_device *(*create_channel)(struct rpmsg_device *rpdev,
> + struct rpmsg_channel_info *chinfo);
> + int (*release_channel)(struct rpmsg_device *rpdev,
> + struct rpmsg_channel_info *chinfo);
> +
> struct rpmsg_endpoint *(*create_ept)(struct rpmsg_device *rpdev,
> rpmsg_rx_cb_t cb, void *priv,
> struct rpmsg_channel_info chinfo);
> @@ -75,6 +82,11 @@ int rpmsg_unregister_device(struct device *parent,
> struct device *rpmsg_find_device(struct device *parent,
> struct rpmsg_channel_info *chinfo);
>
> +struct rpmsg_device *
> + rpmsg_create_channel(struct rpmsg_device *rpdev,
> + struct rpmsg_channel_info *chinfo);
> +int rpmsg_release_channel(struct rpmsg_device *rpdev,
> + struct rpmsg_channel_info *chinfo);
> /**
> * rpmsg_chrdev_register_device() - register chrdev device based on rpdev
> * @rpdev: prepared rpdev to be used for creating endpoints
> --
> 2.17.1
>
next prev parent reply other threads:[~2020-08-24 22:44 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-31 11:47 [PATCH 0/9] introduce name service announcement rpmsg driver Arnaud Pouliquen
2020-07-31 11:47 ` [PATCH 1/9] rpmsg: virtio: rename rpmsg_create_channel Arnaud Pouliquen
2020-07-31 11:47 ` [PATCH 2/9] rpmsg: core: add channel creation internal API Arnaud Pouliquen
2020-08-24 22:44 ` Mathieu Poirier [this message]
2020-07-31 11:47 ` [PATCH 3/9] rpmsg: virtio: add rpmsg channel device ops Arnaud Pouliquen
2020-07-31 11:47 ` [PATCH 4/9] rpmsg: define the name service announcement as reserved address Arnaud Pouliquen
2020-07-31 11:47 ` [PATCH 5/9] rpmsg: introduce reserved rpmsg driver for ns announcement Arnaud Pouliquen
2020-08-05 9:05 ` kernel test robot
2020-08-05 9:05 ` kernel test robot
2020-08-24 22:47 ` Mathieu Poirier
2020-08-25 11:57 ` Arnaud POULIQUEN
2020-08-25 14:36 ` Mathieu Poirier
2020-07-31 11:47 ` [PATCH 6/9] rpmsg: virtio: use rpmsg ns device for the " Arnaud Pouliquen
2020-08-24 22:48 ` Mathieu Poirier
2020-08-25 12:02 ` Arnaud POULIQUEN
2020-07-31 11:47 ` [PATCH 7/9] rpmsg: ns: add name service announcement service Arnaud Pouliquen
2020-07-31 11:47 ` [PATCH 8/9] rpmsg: virtio: use rpmsg_ns driver to manage ns announcement Arnaud Pouliquen
2020-08-25 16:54 ` Mathieu Poirier
2020-08-26 7:42 ` Arnaud POULIQUEN
2020-08-26 22:10 ` Mathieu Poirier
2020-08-27 7:03 ` Arnaud POULIQUEN
2020-07-31 11:47 ` [PATCH 9/9] rpmsg: ns: name service announcement endianness Arnaud Pouliquen
2020-08-24 23:04 ` Mathieu Poirier
2020-08-20 22:32 ` [PATCH 0/9] introduce name service announcement rpmsg driver Mathieu Poirier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200824224446.GC3938186@xps15 \
--to=mathieu.poirier@linaro.org \
--cc=arnaud.pouliquen@st.com \
--cc=bjorn.andersson@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=ohad@wizery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.