diff mbox

[v2,02/17] rpmsg: Name rpmsg devices based on channel id

Message ID 1472768889-3906-3-git-send-email-bjorn.andersson@linaro.org
State Accepted
Headers show

Commit Message

Bjorn Andersson Sept. 1, 2016, 10:27 p.m. UTC
By basing rpmsg device names on channel id we end up with human readable
device names in sysfs and debug logs.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---

Changes since v1:
- None

 drivers/rpmsg/virtio_rpmsg_bus.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

Comments

Sarangdhar Joshi Sept. 8, 2016, 1:46 a.m. UTC | #1
On 2016-09-01 15:27, Bjorn Andersson wrote:
> By basing rpmsg device names on channel id we end up with human 
> readable
> device names in sysfs and debug logs.
> 
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> ---
> 
> Changes since v1:
> - None
> 
>  drivers/rpmsg/virtio_rpmsg_bus.c | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c 
> b/drivers/rpmsg/virtio_rpmsg_bus.c
> index 495fa0a282d3..c4bd89ea7681 100644
> --- a/drivers/rpmsg/virtio_rpmsg_bus.c
> +++ b/drivers/rpmsg/virtio_rpmsg_bus.c
> @@ -136,14 +136,6 @@ rpmsg_show_attr(src, src, "0x%x\n");
>  rpmsg_show_attr(dst, dst, "0x%x\n");
>  rpmsg_show_attr(announce, announce ? "true" : "false", "%s\n");
> 
> -/*
> - * Unique (and free running) index for rpmsg devices.
> - *
> - * Yeah, we're not recycling those numbers (yet?). will be easy
> - * to change if/when we want to.
> - */
> -static unsigned int rpmsg_dev_index;
> -
>  static ssize_t modalias_show(struct device *dev,
>  			     struct device_attribute *attr, char *buf)
>  {
> @@ -531,8 +523,8 @@ static struct rpmsg_channel
> *rpmsg_create_channel(struct virtproc_info *vrp,
> 
>  	strncpy(rpdev->id.name, chinfo->name, RPMSG_NAME_SIZE);
> 
> -	/* very simple device indexing plumbing which is enough for now */
> -	dev_set_name(&rpdev->dev, "rpmsg%d", rpmsg_dev_index++);
> +	dev_set_name(&rpdev->dev, "%s:%s",
> +		     dev_name(dev->parent), rpdev->id.name);
> 
>  	rpdev->dev.parent = &vrp->vdev->dev;
>  	rpdev->dev.bus = &rpmsg_bus;

Reviewed-by: Sarangdhar Joshi <spjoshi@codeaurora.org>

Sarang

--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-remoteproc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c
index 495fa0a282d3..c4bd89ea7681 100644
--- a/drivers/rpmsg/virtio_rpmsg_bus.c
+++ b/drivers/rpmsg/virtio_rpmsg_bus.c
@@ -136,14 +136,6 @@  rpmsg_show_attr(src, src, "0x%x\n");
 rpmsg_show_attr(dst, dst, "0x%x\n");
 rpmsg_show_attr(announce, announce ? "true" : "false", "%s\n");
 
-/*
- * Unique (and free running) index for rpmsg devices.
- *
- * Yeah, we're not recycling those numbers (yet?). will be easy
- * to change if/when we want to.
- */
-static unsigned int rpmsg_dev_index;
-
 static ssize_t modalias_show(struct device *dev,
 			     struct device_attribute *attr, char *buf)
 {
@@ -531,8 +523,8 @@  static struct rpmsg_channel *rpmsg_create_channel(struct virtproc_info *vrp,
 
 	strncpy(rpdev->id.name, chinfo->name, RPMSG_NAME_SIZE);
 
-	/* very simple device indexing plumbing which is enough for now */
-	dev_set_name(&rpdev->dev, "rpmsg%d", rpmsg_dev_index++);
+	dev_set_name(&rpdev->dev, "%s:%s",
+		     dev_name(dev->parent), rpdev->id.name);
 
 	rpdev->dev.parent = &vrp->vdev->dev;
 	rpdev->dev.bus = &rpmsg_bus;