From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 32626EE0213 for ; Wed, 11 Sep 2024 15:37:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=6QsnF80Nnvoo/JnHghxBCTtAMnmOaIQ36MmFNNxPphg=; b=dC87yG5IRPW4/DCfgEYSMfrsIz DKIlCynJn4t/76HsC121KYLuVktDqlX30P8Kof0ej2qOgO9hLToZMIGGf+UeaJptK0pdmrcOki4sF 9W1K3Bf6vmUbQwtaR2icEKDS1TkE0fnz00bhgmZ8+F8UGxJJOlHh2GmbbQYdr8TskwDaqd2m6lVg6 Qw81AaHHvevZ1aZerBKMryL4IJ7FsjVzxrWn98KTJ+/CkZqSgtGuC3kJM20xH/eSfVwWNfwxDQVfB QIfsimAAlulYj6ilJ1IFmAp7mZd6h9j1Iz2ofnH77xu0fduENjsO/qr/kqKS2Nie0Mb2yog1HWc58 FrOdoP7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1soPPA-0000000ABY9-18Lp; Wed, 11 Sep 2024 15:37:16 +0000 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1soP8w-0000000A70j-1kLI for linux-arm-kernel@lists.infradead.org; Wed, 11 Sep 2024 15:20:32 +0000 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-7179802b91fso4424812b3a.3 for ; Wed, 11 Sep 2024 08:20:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726068029; x=1726672829; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=6QsnF80Nnvoo/JnHghxBCTtAMnmOaIQ36MmFNNxPphg=; b=b8qcJMHZ4b9l4MOjq/2h60DUZhzgrdGezUkQ9k5yCOLnt8NMQfZzyiVRxJ0nIGFyv2 Tb++wc3TJ0U7bOdiNQKk9FhMGeOntNSQ2bT9FxmUPMxYNdf9/s/Mn0pp+/oY2P7yes/G M3d9Qw0sU8wjBDW77CqAfX0/ZH86CvafRmLPdy9pST1ojnBa4295q0wkPOwyXmhYo9yk RJireQPUyJIKQWtG+e47gDLurV3Bh2/6Qp7606Ua7F11EkyUcg6jaIqeze3Vys0gkxdv L6YBJsOYLV1nSqKCwq17wkEBfYPOsJ1/AACOBAxh1On4zWMj7VUo5LRvLCao0jYQ5ZUz 04JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726068029; x=1726672829; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=6QsnF80Nnvoo/JnHghxBCTtAMnmOaIQ36MmFNNxPphg=; b=STfKzJXQAWJ3/nJytPZ8OF2hwJ7dwr28COH5mQ8XTJ2dqI2DBWUM5q6QS25P9OnHjG NQhVsbigf2Nyj+l/D8GLnbvf7bzm0DdAiO0W7WdeIUAuAQBy15xA8ys7QK5tdizpkwUW sfuE82vqXZplMIp9qws7tF7xVHLeND7ykumj4FovhLRU33OioHU7lXFlzwdP/2xQ52+P l97Bk4MAcnoyJUwVuEBV4JkXZ6zzPld0tU7p9+GGgyYslOTay20+7iPhRwB6wI0RQcf+ 1SqDhdW5EYBUHJvi6bnNmIXr9KPR2guR49JOwYmFZF8dG+DOpGDD9WCwChJMNnqwEx4z dhUw== X-Forwarded-Encrypted: i=1; AJvYcCW4hWrbf1CHqzd6pkkNj53BOsySh7jiGlQnt/WFD7T7C3nRlxQrh5413UL9PaCifGwiTqJXlsOrTnTsWBJSEFFy@lists.infradead.org X-Gm-Message-State: AOJu0YwjqxxaWOC4FKFdvqFQH6vn6WeDAbkpgtFKIUZUmliPGQyXSqmV ocG0nYVO6b0Iht93Cw4NJ67HKn1ZzG81vWO22BVl8AHoYhbv4JN16kQ/iYzMNK8= X-Google-Smtp-Source: AGHT+IF62OJJay2y+CU+PR4n787g3j2oQeP+yBY3R968kbDmjxolxaxWKCPxr0TAOuJnc1ZT8F6S1Q== X-Received: by 2002:a05:6a00:92a6:b0:706:b10c:548a with SMTP id d2e1a72fcca58-718d5f06a3emr22601898b3a.22.1726068029283; Wed, 11 Sep 2024 08:20:29 -0700 (PDT) Received: from p14s ([2604:3d09:148c:c800:cc9a:9892:2799:3634]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-719090ada75sm3099467b3a.162.2024.09.11.08.20.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:20:28 -0700 (PDT) Date: Wed, 11 Sep 2024 09:20:26 -0600 From: Mathieu Poirier To: Arnaud Pouliquen Cc: Bjorn Andersson , Jens Wiklander , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, op-tee@lists.trustedfirmware.org, devicetree@vger.kernel.org Subject: Re: [PATCH v9 3/7] remoteproc: core: Refactor resource table cleanup into rproc_release_fw Message-ID: References: <20240830095147.3538047-1-arnaud.pouliquen@foss.st.com> <20240830095147.3538047-4-arnaud.pouliquen@foss.st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240830095147.3538047-4-arnaud.pouliquen@foss.st.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240911_082030_484533_27E95C8C X-CRM114-Status: GOOD ( 18.45 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Aug 30, 2024 at 11:51:43AM +0200, Arnaud Pouliquen wrote: > This patch centralizing the cleanup of the resource table into a new > helper function rproc_release_fw(). > Sure, but you did not explain _why_ the change is needed. > Suggested-by: Mathieu Poirier > Signed-off-by: Arnaud Pouliquen > --- > drivers/remoteproc/remoteproc_core.c | 21 ++++++++++----------- > 1 file changed, 10 insertions(+), 11 deletions(-) > > diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c > index ace11ea17097..7694817f25d4 100644 > --- a/drivers/remoteproc/remoteproc_core.c > +++ b/drivers/remoteproc/remoteproc_core.c > @@ -1256,6 +1256,13 @@ static int rproc_alloc_registered_carveouts(struct rproc *rproc) > return 0; > } > > +static void rproc_release_fw(struct rproc *rproc) > +{ > + /* Free the copy of the resource table */ > + kfree(rproc->cached_table); > + rproc->cached_table = NULL; > + rproc->table_ptr = NULL; > +} > > /** > * rproc_resource_cleanup() - clean up and free all acquired resources > @@ -1485,9 +1492,7 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw) > > clean_up_resources: > rproc_resource_cleanup(rproc); > - kfree(rproc->cached_table); > - rproc->cached_table = NULL; > - rproc->table_ptr = NULL; > + rproc_release_fw(rproc); > unprepare_rproc: > /* release HW resources if needed */ > rproc_unprepare_device(rproc); > @@ -2067,10 +2072,7 @@ int rproc_shutdown(struct rproc *rproc) > > rproc_disable_iommu(rproc); > > - /* Free the copy of the resource table */ > - kfree(rproc->cached_table); > - rproc->cached_table = NULL; > - rproc->table_ptr = NULL; > + rproc_release_fw(rproc); > out: > mutex_unlock(&rproc->lock); > return ret; > @@ -2133,10 +2135,7 @@ int rproc_detach(struct rproc *rproc) > > rproc_disable_iommu(rproc); > > - /* Free the copy of the resource table */ > - kfree(rproc->cached_table); > - rproc->cached_table = NULL; > - rproc->table_ptr = NULL; > + rproc_release_fw(rproc); > out: > mutex_unlock(&rproc->lock); > return ret; > -- > 2.25.1 >