Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp6028545rwi; Tue, 18 Oct 2022 07:16:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM79rTFuYmpQFr6XkSzHBSvDs707AQcr8/DW4wfRsCZral6iKFRhOvZHZjV+n0c6OdX2JlLL X-Received: by 2002:a17:902:a713:b0:183:e2a9:6409 with SMTP id w19-20020a170902a71300b00183e2a96409mr3337628plq.149.1666102612213; Tue, 18 Oct 2022 07:16:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666102612; cv=none; d=google.com; s=arc-20160816; b=VB8Fxox/p09UFi8WKt6d6O5lrnh9wIdzSCWu2aoyAcO31XsbqJ5qLRSNQu0CY3c/8q nqo6hGOCG0nYyNkgQ3040s6EnItXpQphY5Bib6tE1GopASJg9CzqLCeV8PT8CWNWuE8K OOBd1DVtR5Kb2xbnBEp+jB71JCLjInb13ABDDDHjjW9iYtXmFhjb+xjoe232rDab08O2 trn1jGfDWFCESdSFnfK0eg5jntnkpHh8/dE4870c4XwJt0jd7HoXpY+3b7HeC0PpHRyR 1TS385i7VVNT2/sc6lNERfCfwyI2S5VrKXgv6ZDKCtgBGj23BEZ7bcfHHO3R3XF1aMY9 tk7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=uHRRQ5HLziQ8B03jr/6eG1lT4OqBOoWzGEiOn/lVnAQ=; b=f6PwDLgyVDIoCF4SKtmIV6iAumsn3s1gWIFK9Bg1hLB6YHBefhY+XXLkD/w2cyw75o 9SE2cIxZbXHo/H5NtWrRhvren9UZ5iQFpBERztquPL9gL3qcAxvgzkV/dN9KP1xtxBEJ TI670SbAYw9tWjjDSK0whnotzdTL5RrnOEAav0jKpfqLzi8XnWsgeyy3afeZqef/ltEr rTKwcJYPht8ke8ZW2GPosYiE9KvVyS/YpZ5iCrN+r6ITqMDkq8KncjZW1H/lyCe4TiXZ 0h6OwF3jvghmGU8h2x0AnGtXXn7O9tmUXP2nq0V3X9+S7YZiIrCnClXqC0rT0tqGqdPT PTHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z10-20020a170902ccca00b00177ff4019d5si14265496ple.179.2022.10.18.07.16.11; Tue, 18 Oct 2022 07:16:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230171AbiJROEl (ORCPT + 99 others); Tue, 18 Oct 2022 10:04:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230381AbiJROEO (ORCPT ); Tue, 18 Oct 2022 10:04:14 -0400 Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5ED10D03A9; Tue, 18 Oct 2022 07:04:12 -0700 (PDT) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id B14902139A8; Tue, 18 Oct 2022 16:04:10 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 7B6B621399A; Tue, 18 Oct 2022 16:04:10 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 5A671180226C; Tue, 18 Oct 2022 22:04:09 +0800 (+08) From: Shengjiu Wang To: andersson@kernel.org, mathieu.poirier@linaro.org, arnaud.pouliquen@foss.st.com Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, shengjiu.wang@gmail.com Subject: [PATCH v3] remoteproc: core: Auto select rproc-virtio device id Date: Tue, 18 Oct 2022 21:44:04 +0800 Message-Id: <1666100644-27010-1-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-by: Arnaud Pouliquen Reviewed-by: Mukesh Ojha Tested-by: Peng Fan --- 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