From patchwork Fri Aug 26 11:52:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud POULIQUEN X-Patchwork-Id: 12955923 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CB51ECAAD4 for ; Fri, 26 Aug 2022 11:53:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243374AbiHZLxg (ORCPT ); Fri, 26 Aug 2022 07:53:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230132AbiHZLxe (ORCPT ); Fri, 26 Aug 2022 07:53:34 -0400 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A25F1D7423; Fri, 26 Aug 2022 04:53:33 -0700 (PDT) Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27QAjJVw027441; Fri, 26 Aug 2022 13:53:25 +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=ZdYz6ibBi/mMFACVTKpF3Ddf3TiBiFkaCG3AddWKmmk=; b=qtzx9PG3XA/oI8HqcNxkTXQnHcTmG3GGzwawaS0uqSQlY8/KH9zSR1gphsEC/8RiOeVv As9HhNteBaakyZ5aWlIehPeR0JXTPG9jS6IwSfHrWjA1J+/Zob2SRXrAMeU/PNpXOs9j AHSpeerIUi6MyvRxlK05BAHCpmUyOj/e2XdgPQz36GCaoA7qMPWQTTLc8WoiUv39VNT6 HxCPpEBS5lghYMJQ97EKahfAuA6YWPH2zMMNlBGIu8OAk1GWHsbMNWg1V2p0F2IVl5e8 k3QSlp/+tbvxM+pFmDkH3Smh/PLk1c5Xv/RX1OhUFZuayPVaKnV25l6hy7NAzwjq0mip xQ== 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 3j6vpq89n4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 26 Aug 2022 13:53:25 +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 BDCC7100034; Fri, 26 Aug 2022 13:53:24 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node2.st.com [10.75.129.70]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id B6A19222CA8; Fri, 26 Aug 2022 13:53:24 +0200 (CEST) Received: from localhost (10.75.127.118) 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.2308.20; Fri, 26 Aug 2022 13:53:24 +0200 From: Arnaud Pouliquen To: Bjorn Andersson , Mathieu Poirier CC: , , , Rob Herring , Christoph Hellwig , Stefano Stabellini , Bruce Ashfield , Subject: [PATCH v8 2/4] remoteproc: core: Introduce rproc_add_rvdev function Date: Fri, 26 Aug 2022 13:52:30 +0200 Message-ID: <20220826115232.2163130-3-arnaud.pouliquen@foss.st.com> X-Mailer: git-send-email 2.24.3 In-Reply-To: <20220826115232.2163130-1-arnaud.pouliquen@foss.st.com> References: <20220826115232.2163130-1-arnaud.pouliquen@foss.st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.118] X-ClientProxiedBy: GPXDAG2NODE4.st.com (10.75.127.68) 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.517,FMLib:17.11.122.1 definitions=2022-08-26_06,2022-08-25_01,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@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 c977e6c0bdb7..756b84811022 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); }