Received: by 2002:a05:7208:70d5:b0:7f:5597:fa5c with SMTP id q21csp1278816rba; Fri, 22 Mar 2024 09:09:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUoQHUClEkIHX5nCFrAUSGEpDbhAMt16+A/rgV6FAIu7YOhRnF4V78vKyPksqp2yKfFfF8x49VGZOtxqYEdmrLCTnuvWGkbdU6n+AO/ZQ== X-Google-Smtp-Source: AGHT+IEYuCWL6O5SJyxkVwXdcLLFXkOwQhiBQfSnqj9yCq0V5EOHyraYYyZffCDzcIV//tqOSWbV X-Received: by 2002:ac8:7c56:0:b0:431:1de1:e5f8 with SMTP id o22-20020ac87c56000000b004311de1e5f8mr2679591qtv.7.1711123781499; Fri, 22 Mar 2024 09:09:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711123781; cv=pass; d=google.com; s=arc-20160816; b=rw8+Xbq3JbAs2pr7S3EOuz36U00I5v6+/mUTEuxcFY0yhJUZuVIr+/jj3CU5mR8kLQ VxKuYJr61b+ykzuIZZ8C22GVF4uI/aSum2y2S8jFryaK7zSwzLfITH7ZRFxV+APU2/uu Om8gzPcHEyXn0ybY2KDxvRh75mgFK2EDDOX9rt/xhiSoDKB+o+d/DeHi1grFcIRsQk4b LVy6g3EqweSMi4R7bEHw5klFIsWmOYS4k3nC+NmWRuzKTOggpbtf50Ku+ML70Sj1El4A aV4eOC6e3teFCCZZV426xxB1pMZJiSrjpelqW2rMQJhu2nt+Q4y9O/TZOkGl+2QM8vOS mMgw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=PmJHIEaZgMB+nvvQxqCSasszVUuU84moTVpFS5p1+Gg=; fh=0tIhEViLo7PUpyJI/8YvAfn7aU9qwVOIrJ6jkc06K5o=; b=DW/GnPZJBKJRrxyHlZ2sttKucIqZ9qcXPbNF4o5YqRRlfH1qGgMLzjej9KB3z/CVB7 NQR3SisiCso4Fa3vB+uoo3wIhfjo51jKNMoi63zZz2O/J5MCucKTtnBnz6762fIW6Tn9 6GdJ9kRx4bifE+/EeS4/m9lQ6OYGJaPoECxZ3aCVQumVzNz+IqJ5kZ2asPBUWyoR93uw DDU64/5flNh4efPqMiM+z+PfHTRd20LEsBPzR+IGgfc/ddCmj9bFP8VxIDlHWwnn+GnT 8m3WIWKwdYkQ1ZsQVsUdUDl1p4AI9BrC42YYAmo3MjbevqD6E7w4oiSuTeOXIJse3043 r0Zg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fa2YsZns; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-111753-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111753-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id s11-20020a05622a1a8b00b004313af79b2fsi213359qtc.213.2024.03.22.09.09.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 09:09:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-111753-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fa2YsZns; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-111753-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111753-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 40EDB1C2293B for ; Fri, 22 Mar 2024 16:09:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CCEB159B57; Fri, 22 Mar 2024 16:09:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fa2YsZns" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1BC659B43; Fri, 22 Mar 2024 16:09:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711123750; cv=none; b=h8fZsUv7xquatgRpTBF3agAPEl8J0Cn40e1+IEQYesRrNuvgeGMoN6wnfHS4oTqqHNGorVDadi0snryXRPSOMy/L35zlcYrXm5abUR9lcIOry9HbZ8i0CEFCSpU3OphlQmcdoS5o+q5HO/Fa1+JWA+u0H0PMzkqYUMPNyPqcDh0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711123750; c=relaxed/simple; bh=F/sqXNXuusfoq5nFRK9dwEPOFu1E0B/ZZnfUgH0lVkw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kha5ISIzY+IbnSmNEWf4EgwdUKDM0zlnBjU/xB+pj841MUzq4Sf08Ceu0nRndExqsFMNLNF6IZ4s5wjyWo0VJc1ukQfx/8Pgml9Uj9RWPQ+CWb2uZC+b70nRzXv7G2KvqOmA5pbqdr8FORYGqEfOYkULHqSKh2EZHsJtqDg7oNA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fa2YsZns; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 322B1C433A6; Fri, 22 Mar 2024 16:09:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711123749; bh=F/sqXNXuusfoq5nFRK9dwEPOFu1E0B/ZZnfUgH0lVkw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fa2YsZnsQGWbd6LtSs6H5aNN6QH0eiSf5N2umA5sLvBVzoec42e9efUOyM3pmJnvR ssAgWezniuSPisV1K1HOUN3AvZOXO2dnolNNQkZ1zaOSM6eif9E0LhQIp2C4eaXhb1 igZl1eWSpvJu/RRYas0uzHQrpdDAlTC7nv1siruOlVOcW/G/z2aG72m+uzXHieQLqs hfw7qPfKXkUbD+ZcPGyDqpjDwZm4YhHC5jJ8XY8IDjxIZLDK5gh1ac+FwiGHBY2RIH ijXweKZh5c08Vtrn1/lrOZrbmtcpRSEPDzlkn7jDpXPL76OG6SbdGZiqoO/n292aRW Br36xScrOoeDg== Date: Fri, 22 Mar 2024 17:09:03 +0100 From: Niklas Cassel To: Manivannan Sadhasivam Cc: Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Kishon Vijay Abraham I , Thierry Reding , Jonathan Hunter , Jingoo Han , Gustavo Pimentel , linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, mhi@lists.linux.dev, linux-tegra@vger.kernel.org Subject: Re: [PATCH 04/11] PCI: epf-test: Refactor pci_epf_test_unbind() function Message-ID: References: <20240314-pci-epf-rework-v1-0-6134e6c1d491@linaro.org> <20240314-pci-epf-rework-v1-4-6134e6c1d491@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240314-pci-epf-rework-v1-4-6134e6c1d491@linaro.org> On Thu, Mar 14, 2024 at 08:53:43PM +0530, Manivannan Sadhasivam wrote: > Move the pci_epc_clear_bar() and pci_epf_free_space() code to respective > helper functions. This allows reusing the helpers in future commits. > > This also requires moving the pci_epf_test_unbind() definition below > pci_epf_test_bind() to avoid forward declaration of the above helpers. > > No functional change. > > Signed-off-by: Manivannan Sadhasivam > --- > drivers/pci/endpoint/functions/pci-epf-test.c | 63 ++++++++++++++++++--------- > 1 file changed, 42 insertions(+), 21 deletions(-) > > diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c > index 1dae0fce8fc4..2fac36553633 100644 > --- a/drivers/pci/endpoint/functions/pci-epf-test.c > +++ b/drivers/pci/endpoint/functions/pci-epf-test.c > @@ -686,27 +686,6 @@ static void pci_epf_test_cmd_handler(struct work_struct *work) > msecs_to_jiffies(1)); > } > > -static void pci_epf_test_unbind(struct pci_epf *epf) > -{ > - struct pci_epf_test *epf_test = epf_get_drvdata(epf); > - struct pci_epc *epc = epf->epc; > - struct pci_epf_bar *epf_bar; > - int bar; > - > - cancel_delayed_work(&epf_test->cmd_handler); > - pci_epf_test_clean_dma_chan(epf_test); > - for (bar = 0; bar < PCI_STD_NUM_BARS; bar++) { > - epf_bar = &epf->bar[bar]; > - > - if (epf_test->reg[bar]) { > - pci_epc_clear_bar(epc, epf->func_no, epf->vfunc_no, > - epf_bar); > - pci_epf_free_space(epf, epf_test->reg[bar], bar, > - PRIMARY_INTERFACE); > - } > - } > -} > - > static int pci_epf_test_set_bar(struct pci_epf *epf) > { > int bar, add; > @@ -746,6 +725,22 @@ static int pci_epf_test_set_bar(struct pci_epf *epf) > return 0; > } > > +static void pci_epf_test_clear_bar(struct pci_epf *epf) > +{ > + struct pci_epf_test *epf_test = epf_get_drvdata(epf); > + struct pci_epc *epc = epf->epc; > + struct pci_epf_bar *epf_bar; > + int bar; > + > + for (bar = 0; bar < PCI_STD_NUM_BARS; bar++) { > + epf_bar = &epf->bar[bar]; > + > + if (epf_test->reg[bar]) > + pci_epc_clear_bar(epc, epf->func_no, epf->vfunc_no, > + epf_bar); > + } > +} > + > static int pci_epf_test_epc_init(struct pci_epf *epf) > { > struct pci_epf_test *epf_test = epf_get_drvdata(epf); > @@ -885,6 +880,22 @@ static int pci_epf_test_alloc_space(struct pci_epf *epf) > return 0; > } > > +static void pci_epf_test_free_space(struct pci_epf *epf) > +{ > + struct pci_epf_test *epf_test = epf_get_drvdata(epf); > + struct pci_epf_bar *epf_bar; > + int bar; > + > + for (bar = 0; bar < PCI_STD_NUM_BARS; bar++) { > + epf_bar = &epf->bar[bar]; > + > + if (epf_test->reg[bar]) { > + pci_epf_free_space(epf, epf_test->reg[bar], bar, > + PRIMARY_INTERFACE); > + } Nit: No need for braces here. (Just like you don't have braces in pci_epf_test_clear_bar()). Like you said in the other thread, this commit clashes with changes done in my series. However, except for the small nit, the commit looks good: Reviewed-by: Niklas Cassel > + } > +} > + > static void pci_epf_configure_bar(struct pci_epf *epf, > const struct pci_epc_features *epc_features) > { > @@ -940,6 +951,16 @@ static int pci_epf_test_bind(struct pci_epf *epf) > return 0; > } > > +static void pci_epf_test_unbind(struct pci_epf *epf) > +{ > + struct pci_epf_test *epf_test = epf_get_drvdata(epf); > + > + cancel_delayed_work(&epf_test->cmd_handler); > + pci_epf_test_clean_dma_chan(epf_test); > + pci_epf_test_clear_bar(epf); > + pci_epf_test_free_space(epf); > +} > + > static const struct pci_epf_device_id pci_epf_test_ids[] = { > { > .name = "pci_epf_test", > > -- > 2.25.1 >