Skip to content

Commit

Permalink
rpmsg: virtio_rpmsg_bus: fix channel creation
Browse files Browse the repository at this point in the history
Since commit 4dffed5 ("rpmsg: Name rpmsg devices based on
channel id"), 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 and so is not more
unique. Previously name was unique thanks to the use of rpmsg_dev_index.

This patch adds destination and source endpoint numbers device name to
create an unique identifier.

Fixes: 4dffed5 ("rpmsg: Name rpmsg devices based on channel id")
Acked-by: Peter Griffin <[email protected]>
Signed-off-by: Loic Pallardy <[email protected]>
[bjorn: flipped name and address in device name]
Signed-off-by: Bjorn Andersson <[email protected]>
  • Loading branch information
ydrallap authored and andersson committed Dec 30, 2016
1 parent 7ce7d89 commit 6344764
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/rpmsg/rpmsg_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,8 @@ int rpmsg_register_device(struct rpmsg_device *rpdev)
struct device *dev = &rpdev->dev;
int ret;

dev_set_name(&rpdev->dev, "%s:%s",
dev_name(dev->parent), rpdev->id.name);
dev_set_name(&rpdev->dev, "%s.%s.%d.%d", dev_name(dev->parent),
rpdev->id.name, rpdev->src, rpdev->dst);

rpdev->dev.bus = &rpmsg_bus;
rpdev->dev.release = rpmsg_release_device;
Expand Down

0 comments on commit 6344764

Please sign in to comment.