From: Arnaud POULIQUEN <arnaud.pouliquen@st.com>
To: Mathieu Poirier <mathieu.poirier@linaro.org>,
<bjorn.andersson@linaro.org>, <ohad@wizery.com>
Cc: <s-anna@ti.com>, <xiaoxiang@xiaomi.com>, <t-kristo@ti.com>,
<loic.pallardy@st.com>, <remoteproc@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] rpmsg: core: Add wildcard match for name service
Date: Thu, 13 Feb 2020 14:56:10 +0100 [thread overview]
Message-ID: <034dcb0b-e305-aab9-f52b-5f725856480f@st.com> (raw)
In-Reply-To: <20200212211251.32091-2-mathieu.poirier@linaro.org>
Hi Mathieu,
Simple and elegant :)
I tested it with my rpmsg_tty client which defines several IDs: work fine.
Just a question regarding the comment else
Acked-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
On 2/12/20 10:12 PM, Mathieu Poirier wrote:
> Adding the capability to supplement the base definition published
> by an rpmsg_driver with a postfix description so that it is possible
> for several entity to use the same service.
>
> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> ---
> drivers/rpmsg/rpmsg_core.c | 20 +++++++++++++++++++-
> 1 file changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c
> index e330ec4dfc33..bfd25978fa35 100644
> --- a/drivers/rpmsg/rpmsg_core.c
> +++ b/drivers/rpmsg/rpmsg_core.c
> @@ -399,7 +399,25 @@ ATTRIBUTE_GROUPS(rpmsg_dev);
> static inline int rpmsg_id_match(const struct rpmsg_device *rpdev,
> const struct rpmsg_device_id *id)
> {
> - return strncmp(id->name, rpdev->id.name, RPMSG_NAME_SIZE) == 0;
> + size_t len = min_t(size_t, strlen(id->name), RPMSG_NAME_SIZE);
> +
> + /*
> + * Allow for wildcard matches. For example if rpmsg_driver::id_table
> + * is:
> + *
> + * static struct rpmsg_device_id rpmsg_driver_sample_id_table[] = {
> + * { .name = "rpmsg-client-sample" },
> + * { },
> + * }
> + *
> + * Then it is possible to support "rpmsg-client-sample*", i.e:
> + * rpmsg-client-sample
> + * rpmsg-client-sample_instance0
> + * rpmsg-client-sample_instance1
> + * ...
> + * rpmsg-client-sample_instanceX
> + */
What about adding this as function documentation? i don't know if it makes sense
for a static volatile function...
Regards
Arnaud
> + return strncmp(id->name, rpdev->id.name, len) == 0;
> }
>
> /* match rpmsg channel and rpmsg driver */
>
next prev parent reply other threads:[~2020-02-13 13:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-12 21:12 [PATCH 0/1] " Mathieu Poirier
2020-02-12 21:12 ` [PATCH 1/1] " Mathieu Poirier
2020-02-13 13:56 ` Arnaud POULIQUEN [this message]
2020-02-14 17:22 ` 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=034dcb0b-e305-aab9-f52b-5f725856480f@st.com \
--to=arnaud.pouliquen@st.com \
--cc=bjorn.andersson@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=loic.pallardy@st.com \
--cc=mathieu.poirier@linaro.org \
--cc=ohad@wizery.com \
--cc=remoteproc@vger.kernel.org \
--cc=s-anna@ti.com \
--cc=t-kristo@ti.com \
--cc=xiaoxiang@xiaomi.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome