linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] remoteproc: core: Auto select rproc-virtio device id
@ 2022-10-18 13:44 Shengjiu Wang
  2022-10-18 15:18 ` Mathieu Poirier
  0 siblings, 1 reply; 2+ messages in thread
From: Shengjiu Wang @ 2022-10-18 13:44 UTC (permalink / raw)
  To: andersson, mathieu.poirier, arnaud.pouliquen
  Cc: linux-remoteproc, linux-kernel, shengjiu.wang

With multiple remoteproc device, there will below error:

sysfs: cannot create duplicate filename '/bus/platform/devices/rproc-virtio.0'

The rvdev_data.index is duplicate, that cause issue, so
need to use the PLATFORM_DEVID_AUTO instead. After fixing
device name it becomes something like:
/bus/platform/devices/rproc-virtio.2.auto

Fixes: 1d7b61c06dc3 ("remoteproc: virtio: Create platform device for the remoteproc_virtio")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Reviewed-by: Mukesh Ojha <quic_mojha@quicinc.com>
Tested-by: Peng Fan <peng.fan@nxp.com>
---
changes in v3:
- add comment in codec

changes in v2:
- update commit message

 drivers/remoteproc/remoteproc_core.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 8768cb64f560..f9187e35b090 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -509,7 +509,13 @@ static int rproc_handle_vdev(struct rproc *rproc, void *ptr,
 	rvdev_data.rsc_offset = offset;
 	rvdev_data.rsc = rsc;
 
-	pdev = platform_device_register_data(dev, "rproc-virtio", rvdev_data.index, &rvdev_data,
+	/*
+	 * When there is more than one remote processor, rproc->nb_vdev number is
+	 * same for each separate instances of "rproc". If rvdev_data.index is used
+	 * as device id, then we get dupliation in sysfs, so need to use
+	 * PLATFORM_DEVID_AUTO to auto select device id.
+	 */
+	pdev = platform_device_register_data(dev, "rproc-virtio", PLATFORM_DEVID_AUTO, &rvdev_data,
 					     sizeof(rvdev_data));
 	if (IS_ERR(pdev)) {
 		dev_err(dev, "failed to create rproc-virtio device\n");
-- 
2.34.1


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

* Re: [PATCH v3] remoteproc: core: Auto select rproc-virtio device id
  2022-10-18 13:44 [PATCH v3] remoteproc: core: Auto select rproc-virtio device id Shengjiu Wang
@ 2022-10-18 15:18 ` Mathieu Poirier
  0 siblings, 0 replies; 2+ messages in thread
From: Mathieu Poirier @ 2022-10-18 15:18 UTC (permalink / raw)
  To: Shengjiu Wang
  Cc: andersson, arnaud.pouliquen, linux-remoteproc, linux-kernel,
	shengjiu.wang

On Tue, 18 Oct 2022 at 08:04, Shengjiu Wang <shengjiu.wang@nxp.com> wrote:
>
> With multiple remoteproc device, there will below error:
>
> sysfs: cannot create duplicate filename '/bus/platform/devices/rproc-virtio.0'
>
> The rvdev_data.index is duplicate, that cause issue, so
> need to use the PLATFORM_DEVID_AUTO instead. After fixing
> device name it becomes something like:
> /bus/platform/devices/rproc-virtio.2.auto
>
> Fixes: 1d7b61c06dc3 ("remoteproc: virtio: Create platform device for the remoteproc_virtio")
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> Reviewed-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
> Reviewed-by: Mukesh Ojha <quic_mojha@quicinc.com>
> Tested-by: Peng Fan <peng.fan@nxp.com>

I will queue this on Monday when rc2 comes out.

Thanks,
Mathieu

> ---
> changes in v3:
> - add comment in codec
>
> changes in v2:
> - update commit message
>
>  drivers/remoteproc/remoteproc_core.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
> index 8768cb64f560..f9187e35b090 100644
> --- a/drivers/remoteproc/remoteproc_core.c
> +++ b/drivers/remoteproc/remoteproc_core.c
> @@ -509,7 +509,13 @@ static int rproc_handle_vdev(struct rproc *rproc, void *ptr,
>         rvdev_data.rsc_offset = offset;
>         rvdev_data.rsc = rsc;
>
> -       pdev = platform_device_register_data(dev, "rproc-virtio", rvdev_data.index, &rvdev_data,
> +       /*
> +        * When there is more than one remote processor, rproc->nb_vdev number is
> +        * same for each separate instances of "rproc". If rvdev_data.index is used
> +        * as device id, then we get dupliation in sysfs, so need to use
> +        * PLATFORM_DEVID_AUTO to auto select device id.
> +        */
> +       pdev = platform_device_register_data(dev, "rproc-virtio", PLATFORM_DEVID_AUTO, &rvdev_data,
>                                              sizeof(rvdev_data));
>         if (IS_ERR(pdev)) {
>                 dev_err(dev, "failed to create rproc-virtio device\n");
> --
> 2.34.1
>

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

end of thread, other threads:[~2022-10-18 15:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-18 13:44 [PATCH v3] remoteproc: core: Auto select rproc-virtio device id Shengjiu Wang
2022-10-18 15:18 ` Mathieu Poirier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).