All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Loic Pallardy <loic.pallardy@st.com>
Cc: ohad@wizery.com, lee.jones@linaro.org,
	linux-remoteproc@vger.kernel.org, kernel@stlinux.com
Subject: Re: [PATCH 1/1] rpmsg: virtio_rpmsg_bus: fix channel creation
Date: Fri, 2 Dec 2016 15:19:44 -0800	[thread overview]
Message-ID: <20161202231944.GF9322@tuxbot> (raw)
In-Reply-To: <1480096493-7142-1-git-send-email-loic.pallardy@st.com>

On Fri 25 Nov 09:54 PST 2016, Loic Pallardy wrote:

> Since virtio backend creation, it is no more possible for a firmware to
> register twice a service (on different endpoints). rpmsg_register_device
> function is failing when calling device_add for the second time as second
> device has the same name as first one already register.
> It is because name is based only on service name.
> 

Afaict rpmsg_create_channel() first looks for any existing devices with
the same src, dst and name and if such device is found we fail early and
this logic is found before all those changes as well.

> This patch adds destination endpoint to service name to create an
> unique device name.

As the code didn't look to support multiple services with the same name
I have not considered this scenario. Can you describe your use case for
this?

> 
> Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
> ---
>  drivers/rpmsg/virtio_rpmsg_bus.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c
> index 3090b0d..dce880f 100644
> --- a/drivers/rpmsg/virtio_rpmsg_bus.c
> +++ b/drivers/rpmsg/virtio_rpmsg_bus.c
> @@ -405,7 +405,8 @@ static struct rpmsg_device *rpmsg_create_channel(struct virtproc_info *vrp,
>  	 */
>  	rpdev->announce = rpdev->src != RPMSG_ADDR_ANY;
>  
> -	strncpy(rpdev->id.name, chinfo->name, RPMSG_NAME_SIZE);
> +	snprintf(rpdev->id.name, RPMSG_NAME_SIZE, "%s-%d", chinfo->name,
> +		 chinfo->dst);
>  

But in rpmsg_id_match() we match rpdev->id.name against the id_table of
the registered drivers to find out which driver to probe, please help me
understand what I'm missing here.

Regards,
Bjorn

  parent reply	other threads:[~2016-12-02 23:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-25 17:54 [PATCH 1/1] rpmsg: virtio_rpmsg_bus: fix channel creation Loic Pallardy
2016-11-29  9:20 ` Lee Jones
2016-12-02 23:19 ` Bjorn Andersson [this message]
2016-12-05  8:32   ` loic pallardy
2016-12-06 17:40     ` Bjorn Andersson
2016-12-07  8:42       ` loic pallardy
2016-12-09  6:00         ` Bjorn Andersson
2016-12-11 20:24           ` loic pallardy

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=20161202231944.GF9322@tuxbot \
    --to=bjorn.andersson@linaro.org \
    --cc=kernel@stlinux.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=loic.pallardy@st.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.