Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1110935pxb; Wed, 6 Apr 2022 08:59:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw14hZzDE/DDG3lcSe2YGbqYOdswtfrHvThMcJyWGeZ77nQeavGwpTdjvWVVMGRR5llZ9l1 X-Received: by 2002:a17:90a:d3d4:b0:1ca:c492:9a92 with SMTP id d20-20020a17090ad3d400b001cac4929a92mr10561676pjw.115.1649260797909; Wed, 06 Apr 2022 08:59:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649260797; cv=none; d=google.com; s=arc-20160816; b=GEp4e8fIvsgnBo7HN0c2buFTb9a+mACsfYAnbeR1DpM2yBUXY/oUeYYt9I4/XH3d/s DtSuZS2rwMQGVHrN34pJ+nosUA3IwmzAPS7FsMqc2AxJfk13yKfhxbp++TQAaLWnj3ma 5BGL0RmHIFO0VFN9EL2JhMoZvLDKGbmPao0ySvdTl0cpgG5XW9no//AejrZLFsTxACF7 NrO0u5pFSUQ6k7q5kQd26Otht5ITFzfCCJJsMogsv7VWIgkfzkA7d5f0AAmkApxTuk5k WDev6EB4QeNlQ3pVifgFdXRuhFAuLwFhQzCva7xxXf999nC3qpYNAEAqkWTHyIEHz47M yeGQ== 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=dK4+cXbxny0t1pj5PstgT/p8V7GGZbAPXnZTGdQw1v0=; b=YZk4KloYcyrFavL1EMl8D651KdyW4s4MVRD1oUqHbDIU92gvNymmE0XcKubs5cPeaN eoEcrNSjU5dEtcIe6mFuwbfTRqzNreWHh1BtnDzAGXq8h977xiKADgEichW/yP2ijgHG JA/7jEbux8bUJM1KEHPa+pDTo4n8EOzAvt+XdIS6SwMFuWxdcJznQsjbmXHXPTFg2wPf wJUtiQhynU2GnbNfhNvmWt5y/mfdDnGB7+0FScTpYSh1IjyYXP3Pc17ecLSPBT5S/FTm 6E/3+6DizRyOx1FeeGpZvUJLhYkof/ICV1RImBI5UxcPOziD53JrvbMelNsNVTy0WaJP Rtxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=dYpIDry0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id l7-20020a170903120700b00153b2d165c6si18213272plh.462.2022.04.06.08.59.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 08:59:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=dYpIDry0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B08563DBB13; Wed, 6 Apr 2022 07:23:45 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234939AbiDFOZh (ORCPT + 99 others); Wed, 6 Apr 2022 10:25:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234828AbiDFOZ0 (ORCPT ); Wed, 6 Apr 2022 10:25:26 -0400 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1667444A6AF; Wed, 6 Apr 2022 03:35:53 -0700 (PDT) Received: from pps.filterd (m0288072.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 2369Y1vC030563; Wed, 6 Apr 2022 11:55: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=dK4+cXbxny0t1pj5PstgT/p8V7GGZbAPXnZTGdQw1v0=; b=dYpIDry0Imfaf/YU/NJ23gQOciFtNxBna/vqeOHojb7CPXuTsjVeBwZm/NpKdx+80Za+ rY5bI9VbYzYaLIQh8ZGaKEItaLVJTGIuus8BW3puwIoUsmcd0ygs/A6hE0YdAevODznT hS18lG+X9LVFRv09sZdqYuDGf9io3eZhMJLeOjGiiMRxRhjT+FJ2sOKUtoIzXa7ANRqt ubCC7s6zk0Gh4g6GidEU8DXMeTHv5dmvh+Yl1BScn1odSSaa68aAXrRtdHVXlKe0E8H3 4a3OeITJKqpefYfZSn54KuASN3ZizF7r1Vay27jChA+c/rib9ZGEI8X7RWQmgDacC24L Pw== 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 3f6bwk54qh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 06 Apr 2022 11:55: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 6F93A100039; Wed, 6 Apr 2022 11:55:25 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag2node2.st.com [10.75.127.5]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 683FC20F2A4; Wed, 6 Apr 2022 11:55:25 +0200 (CEST) Received: from localhost (10.75.127.46) by SFHDAG2NODE2.st.com (10.75.127.5) with Microsoft SMTP Server (TLS) id 15.0.1497.26; Wed, 6 Apr 2022 11:55:24 +0200 From: Arnaud Pouliquen To: Bjorn Andersson , Mathieu Poirier CC: , , , Rob Herring , Christoph Hellwig , Stefano Stabellini , Bruce Ashfield , Subject: [RFC PATCH v5 2/4] remoteproc: core: Introduce rproc_register_rvdev function Date: Wed, 6 Apr 2022 11:54:44 +0200 Message-ID: <20220406095446.1187968-3-arnaud.pouliquen@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220406095446.1187968-1-arnaud.pouliquen@foss.st.com> References: <20220406095446.1187968-1-arnaud.pouliquen@foss.st.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.75.127.46] X-ClientProxiedBy: SFHDAG2NODE2.st.com (10.75.127.5) To SFHDAG2NODE2.st.com (10.75.127.5) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.850,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-04-06_03,2022-04-05_01,2022-02-23_01 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 and rproc_rvdev_remove_device functions), introduce the rproc_register_rvdev and rproc_unregister_rvdev functions. Signed-off-by: Arnaud Pouliquen --- 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 3a469220ac73..081bea39daf4 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -484,6 +484,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) { @@ -547,7 +559,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; @@ -576,7 +588,7 @@ static void rproc_rvdev_remove_device(struct rproc_vdev *rvdev) } rproc_remove_subdev(rproc, &rvdev->subdev); - list_del(&rvdev->node); + rproc_remove_rvdev(rvdev); device_unregister(&rvdev->dev); } -- 2.25.1