All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] rpmsg: virtio_rpmsg_bus: fix channel creation
@ 2016-11-25 17:54 Loic Pallardy
  2016-11-29  9:20 ` Lee Jones
  2016-12-02 23:19 ` Bjorn Andersson
  0 siblings, 2 replies; 8+ messages in thread
From: Loic Pallardy @ 2016-11-25 17:54 UTC (permalink / raw)
  To: bjorn.andersson, ohad, lee.jones; +Cc: loic.pallardy, linux-remoteproc, kernel

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.

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

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);
 
 	rpdev->dev.parent = &vrp->vdev->dev;
 	ret = rpmsg_register_device(rpdev);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-12-11 20:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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.