Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp5371892rwb; Wed, 21 Sep 2022 07:02:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6SpPIfRUA2/2CmN0GO4OAnH9QESl7f41dv7Ho8xEqTz8ux+KGfAo78Ruz9hJ76ekYeoAcI X-Received: by 2002:a17:902:e84c:b0:178:2a08:501c with SMTP id t12-20020a170902e84c00b001782a08501cmr4999295plg.110.1663768921743; Wed, 21 Sep 2022 07:02:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663768921; cv=none; d=google.com; s=arc-20160816; b=JFH3IVv93ieVVBL9N09VArazamfrjkJ5el39EJEGcgoUS3Eh49bjzXYVB5jSkxmDmj EhnjBXewLEq7/CpM8iep1mMWEAZzA7Y4w75SU65QCSIzG3yuPKvhBTRcD3vBAQfTes21 5cOF8+mHxJ0VAvt9UkvdpEgqAt/EuvYnNvkIxdjr0rnT4EFGO+JRGOdFKd7X9lM9rZ51 IN/ZPWBHxq3saoThDdfJRXIeAt9bKusg1msPEYH6ehHT06MuD+/VqfBclGlmYOCILOth 5LgkBTMjHivr/JtnOpQkR+kXL3gCbIK/YrsSAnJVIqtKOnH0iYI2dOO8PD4u4gJrfE5+ YtZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=eu2yIA1UqTuAAiOsxkk+SbvHvNtoWU2+G99q+3saE1M=; b=b9KXNy3sx92kLpZcD98Eqh2YaMUNnmDdhTN4vdJI44EvxtAqU5Y6K4eqoLgmtEmanz zXtFoZaDTi0CfbuEy6r61iTN9WVqd0NN9f6ML12V0vzdElfaEY/5rQtUMdXIG6db5ghh KpHyjj32R8NR1fiN77mLBXxbcT/I3zsUzujFayI5XP5U3Uwf/sedgn+jmaI91tjG7vyG yN21+3NtoJCVV83/R2BZwUe7xBl7XJFLKeikSa5LznAx4Em7aXdmfYGMlsFUOkNNZvOy ekjQRbDEUZgeqNkPZb5MduDxgDt9asjUpoe7oA5Sq0X2tTT0yTvYnveon7UxwdqSJCVW bfpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=NPvfvax4; 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=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mi1-20020a17090b4b4100b002006f9dc2e1si3418794pjb.3.2022.09.21.07.01.35; Wed, 21 Sep 2022 07:02:01 -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; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=NPvfvax4; 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=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230205AbiIUNvG (ORCPT + 99 others); Wed, 21 Sep 2022 09:51:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229544AbiIUNvD (ORCPT ); Wed, 21 Sep 2022 09:51:03 -0400 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B12977EFD4; Wed, 21 Sep 2022 06:50:59 -0700 (PDT) Received: from pps.filterd (m0288072.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28LDdTFb029128; Wed, 21 Sep 2022 15:50:50 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=selector1; bh=eu2yIA1UqTuAAiOsxkk+SbvHvNtoWU2+G99q+3saE1M=; b=NPvfvax4gMOfCNTu977y7gHXHkes4UYk8qxxPbsXUFOpVDba6fluU618vNYyGDGxhzbr zpNV8smjglcnYTACT2WilMhAnjc5XHehkt4DC971GPy+kN1urLUjkyVHhHJ3Mrd4M6Xo JFcov/KyPDpIWh3wD2zZ+jNduZVek1ejtJQchsIHDuNvLEkM9acPNyKrxUQUuKp+9l/C bPde9B+yL+aPhvBHXjsOGlz+vt1j8576MzDJweUgCgb3BqeZKgUZSYC2FD7E8tLPhIZv fgVUgWzQZs+m3lls1viXmy7KD9QvTHccr+qXRn1tfJTEOM6KXvyvkGEPraq3c6gO3Oun QA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3jn6au0x96-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 21 Sep 2022 15:50:50 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 6E6BB100038; Wed, 21 Sep 2022 15:50:49 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node2.st.com [10.75.129.70]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 6A5C62278AF; Wed, 21 Sep 2022 15:50:49 +0200 (CEST) Received: from localhost (10.75.127.45) by SHFDAG1NODE2.st.com (10.75.129.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2375.31; Wed, 21 Sep 2022 15:50:48 +0200 From: Arnaud Pouliquen To: Bjorn Andersson , Mathieu Poirier CC: , , , Rob Herring , Christoph Hellwig , Stefano Stabellini , Bruce Ashfield , Subject: [PATCH v9 2/4] remoteproc: core: Introduce rproc_add_rvdev function Date: Wed, 21 Sep 2022 15:50:42 +0200 Message-ID: <20220921135044.917140-3-arnaud.pouliquen@foss.st.com> X-Mailer: git-send-email 2.24.3 In-Reply-To: <20220921135044.917140-1-arnaud.pouliquen@foss.st.com> References: <20220921135044.917140-1-arnaud.pouliquen@foss.st.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.75.127.45] X-ClientProxiedBy: SFHDAG2NODE3.st.com (10.75.127.6) To SHFDAG1NODE2.st.com (10.75.129.70) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-21_08,2022-09-20_02,2022-06-22_01 X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW,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 The rproc structure contains a list of registered rproc_vdev structure. To be able to move the management of the rproc_vdev structure in remoteproc_virtio.c (i.e rproc_rvdev_add_device function), introduce the rproc_add_rvdev and rproc_remove_rvdev functions. Signed-off-by: Arnaud Pouliquen Reviewed-by: Mathieu Poirier --- drivers/remoteproc/remoteproc_core.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index f8dd8c526299..ddf2c716d7d8 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -486,6 +486,18 @@ static int copy_dma_range_map(struct device *to, struct device *from) return 0; } +static void rproc_add_rvdev(struct rproc *rproc, struct rproc_vdev *rvdev) +{ + if (rvdev && rproc) + list_add_tail(&rvdev->node, &rproc->rvdevs); +} + +static void rproc_remove_rvdev(struct rproc_vdev *rvdev) +{ + if (rvdev) + list_del(&rvdev->node); +} + static struct rproc_vdev * rproc_rvdev_add_device(struct rproc *rproc, struct rproc_vdev_data *rvdev_data) { @@ -549,7 +561,7 @@ rproc_rvdev_add_device(struct rproc *rproc, struct rproc_vdev_data *rvdev_data) goto unwind_vring_allocations; } - list_add_tail(&rvdev->node, &rproc->rvdevs); + rproc_add_rvdev(rproc, rvdev); rvdev->subdev.start = rproc_vdev_do_start; rvdev->subdev.stop = rproc_vdev_do_stop; @@ -579,7 +591,7 @@ void rproc_vdev_release(struct kref *ref) } rproc_remove_subdev(rproc, &rvdev->subdev); - list_del(&rvdev->node); + rproc_remove_rvdev(rvdev); device_unregister(&rvdev->dev); } -- 2.24.3