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 44510C83F26 for ; Thu, 24 Jul 2025 23:47:48 +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-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References:List-Owner; bh=Ox1ZdBKdE1+7cWyX+ZvTW2cCqppnnWI0+MrgMX4qxOQ=; b=i7hCWhcDaUUIZWUCg6efrnWUAd 2Vob72S0WQi4nOlUlBuFHIbLzxlGhikgjW9OdbLxepTRIzh0nLLhF4LQq0t9hfVkSxDtMGnzMD8bM m/y0IA1QrzSH1JK8zvaaQvXXtwwLn7JyFiW4aeo1iBUWgiISZ7AvLpAbPTybSejPgobkFiI8EGQdr anyttP943MXmTh/E3WvDEFfI/tYO3IG3bXXUz+el4G775cYAc4pFay37E06XsgAWIS+sUVNrhUCgC /o5UAIwWLrRb+6ZM1vfhQQDpF5hU0ESmHf+OYJtLQHMhWiQdK0myt9mbhiCYc6gp6BLd642hGX25m AyuqfZOw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uf5ez-00000008i96-3aPg; Thu, 24 Jul 2025 23:47:37 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uf55I-00000008euU-0tQx; Thu, 24 Jul 2025 23:10:45 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 146BCA55FD2; Thu, 24 Jul 2025 23:10:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 991B9C4CEED; Thu, 24 Jul 2025 23:10:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753398642; bh=ctpeYJqI/YS0Fz29wSZX7bb68pB9rc2aEqPRsFb/1KE=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=lSLVJCpjYwUU6EPqgYYzdE0EdZ8oDFYV/0lJmwugU9tGIjO60nUjs09D8lBXA2yD2 Fg+poR+eB1EfvBNYE2i3RVYyZPST5UK5sfIj0LypqPXmp1bLQmkPURstpTK+B6NMSp /Sfgh0pY4nlMuB4/0ij4qBxIT6xYfSu0rWD5a5iWx9teYnuxBtAVIOpRb4pEi2dvr6 /+sNmOe5f5CmDySNo8eMIeR8BaeiOIXW+stkdtE+1inF9pSsOOSVuhZ3wj5IbR5BCb L9VNWckESPamfiqs1XMgM9OgC7CiGY92IF4J3JD1+WqxMkRUfrloP9aTViDrQ2cT2n UDut2GywlmQhg== Date: Thu, 24 Jul 2025 18:10:41 -0500 From: Bjorn Helgaas To: "Jiri Slaby (SUSE)" Cc: bhelgaas@google.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Karthikeyan Mitran , Hou Zhiqiang , Joyce Ooi , Ryder Lee , Jianjun Wang , Michal Simek , Daire McNamara , linux-pci@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Arnd Bergmann , Nam Cao Subject: Re: [PATCH] PCI: controller: use dev_fwnode() Message-ID: <20250724231041.GA3079592@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20250723065907.1841758-1-jirislaby@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250724_161044_388069_08C43CD2 X-CRM114-Status: GOOD ( 18.64 ) 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 [+cc Arnd, Nam] On Wed, Jul 23, 2025 at 08:59:07AM +0200, Jiri Slaby (SUSE) wrote: > All irq_domain functions now accept fwnode instead of of_node. But many > PCI controllers still extract dev to of_node and then of_node to fwnode. > > Instead, clean this up and simply use the dev_fwnode() helper to extract > fwnode directly from dev. Internally, it still does dev => of_node => > fwnode steps, but it's now hidden from the users. > > Signed-off-by: Jiri Slaby (SUSE) > Link: https://lore.kernel.org/all/4ee9c7c0-4a3f-4afa-ae5a-7fd8a750c92b@kernel.org/ > Link: https://lore.kernel.org/all/4bc0e1ca-a523-424a-8759-59e353317fba@kernel.org/ Thanks, Jiri, I applied this on pci/controller/msi-parent for v6.17; it's at https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git/log/?h=controller/msi-parent The dev_fwnode() conversions touched the same places as Nam's changes to use msi_create_parent_irq_domain(). The previous dev_fwnode() conversions were *before* Nam's changes and these are *after*, and it all ended up looking more complicated than I wanted, so I squashed all the dev_fwnode() conversions together in https://git.kernel.org/cgit/linux/kernel/git/pci/pci.git/commit/?id=a103d2dede56 ("PCI: controller: Use dev_fwnode() instead of of_fwnode_handle()") and then added Nam's msi_create_parent_irq_domain() patches on top. So a103d2dede56 ("PCI: controller: Use dev_fwnode() instead of of_fwnode_handle()") ends up *looking* different from the patch below, but I think having them all together makes it more obvious that they're all making the same conversion, and I think the end result is identical. Bjorn > Cc: Jingoo Han > Cc: Manivannan Sadhasivam > Cc: Lorenzo Pieralisi > Cc: "Krzysztof WilczyƄski" > Cc: Rob Herring > Cc: Bjorn Helgaas > Cc: Karthikeyan Mitran > Cc: Hou Zhiqiang > Cc: Joyce Ooi > Cc: Ryder Lee > Cc: Jianjun Wang > Cc: Michal Simek > Cc: Daire McNamara > --- > Cc: linux-pci@vger.kernel.org > Cc: linux-mediatek@lists.infradead.org > Cc: linux-arm-kernel@lists.infradead.org > --- > drivers/pci/controller/dwc/pcie-designware-host.c | 3 +-- > drivers/pci/controller/mobiveil/pcie-mobiveil-host.c | 3 +-- > drivers/pci/controller/pcie-altera-msi.c | 3 +-- > drivers/pci/controller/pcie-mediatek.c | 4 +--- > drivers/pci/controller/pcie-xilinx-dma-pl.c | 3 +-- > drivers/pci/controller/pcie-xilinx-nwl.c | 3 +-- > drivers/pci/controller/plda/pcie-plda-host.c | 3 +-- > 7 files changed, 7 insertions(+), 15 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c > index 4af7da14b350..952f8594b501 100644 > --- a/drivers/pci/controller/dwc/pcie-designware-host.c > +++ b/drivers/pci/controller/dwc/pcie-designware-host.c > @@ -214,9 +214,8 @@ static const struct irq_domain_ops dw_pcie_msi_domain_ops = { > int dw_pcie_allocate_domains(struct dw_pcie_rp *pp) > { > struct dw_pcie *pci = to_dw_pcie_from_pp(pp); > - struct fwnode_handle *fwnode = of_fwnode_handle(pci->dev->of_node); > struct irq_domain_info info = { > - .fwnode = fwnode, > + .fwnode = dev_fwnode(pci->dev), > .ops = &dw_pcie_msi_domain_ops, > .size = pp->num_vectors, > .host_data = pp, > diff --git a/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c b/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c > index d17e887b6b61..dbc72c73fd0a 100644 > --- a/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c > +++ b/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c > @@ -439,13 +439,12 @@ static const struct irq_domain_ops msi_domain_ops = { > static int mobiveil_allocate_msi_domains(struct mobiveil_pcie *pcie) > { > struct device *dev = &pcie->pdev->dev; > - struct fwnode_handle *fwnode = of_fwnode_handle(dev->of_node); > struct mobiveil_msi *msi = &pcie->rp.msi; > > mutex_init(&msi->lock); > > struct irq_domain_info info = { > - .fwnode = fwnode, > + .fwnode = dev_fwnode(dev), > .ops = &msi_domain_ops, > .host_data = pcie, > .size = msi->num_of_vectors, > diff --git a/drivers/pci/controller/pcie-altera-msi.c b/drivers/pci/controller/pcie-altera-msi.c > index 2e48acd632c5..ea2ca2e70f20 100644 > --- a/drivers/pci/controller/pcie-altera-msi.c > +++ b/drivers/pci/controller/pcie-altera-msi.c > @@ -166,9 +166,8 @@ static const struct irq_domain_ops msi_domain_ops = { > > static int altera_allocate_domains(struct altera_msi *msi) > { > - struct fwnode_handle *fwnode = of_fwnode_handle(msi->pdev->dev.of_node); > struct irq_domain_info info = { > - .fwnode = fwnode, > + .fwnode = dev_fwnode(&msi->pdev->dev), > .ops = &msi_domain_ops, > .host_data = msi, > .size = msi->num_of_vectors, > diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controller/pcie-mediatek.c > index 3ac5d14dd543..24cc30a2ab6c 100644 > --- a/drivers/pci/controller/pcie-mediatek.c > +++ b/drivers/pci/controller/pcie-mediatek.c > @@ -487,12 +487,10 @@ static const struct msi_parent_ops mtk_msi_parent_ops = { > > static int mtk_pcie_allocate_msi_domains(struct mtk_pcie_port *port) > { > - struct fwnode_handle *fwnode = of_fwnode_handle(port->pcie->dev->of_node); > - > mutex_init(&port->lock); > > struct irq_domain_info info = { > - .fwnode = fwnode, > + .fwnode = dev_fwnode(port->pcie->dev), > .ops = &msi_domain_ops, > .host_data = port, > .size = MTK_MSI_IRQS_NUM, > diff --git a/drivers/pci/controller/pcie-xilinx-dma-pl.c b/drivers/pci/controller/pcie-xilinx-dma-pl.c > index fbc379fd118b..b037c8f315e4 100644 > --- a/drivers/pci/controller/pcie-xilinx-dma-pl.c > +++ b/drivers/pci/controller/pcie-xilinx-dma-pl.c > @@ -465,9 +465,8 @@ static int xilinx_pl_dma_pcie_init_msi_irq_domain(struct pl_dma_pcie *port) > struct device *dev = port->dev; > struct xilinx_msi *msi = &port->msi; > int size = BITS_TO_LONGS(XILINX_NUM_MSI_IRQS) * sizeof(long); > - struct fwnode_handle *fwnode = of_fwnode_handle(port->dev->of_node); > struct irq_domain_info info = { > - .fwnode = fwnode, > + .fwnode = dev_fwnode(port->dev), > .ops = &dev_msi_domain_ops, > .host_data = port, > .size = XILINX_NUM_MSI_IRQS, > diff --git a/drivers/pci/controller/pcie-xilinx-nwl.c b/drivers/pci/controller/pcie-xilinx-nwl.c > index de76c836915f..05b8c205493c 100644 > --- a/drivers/pci/controller/pcie-xilinx-nwl.c > +++ b/drivers/pci/controller/pcie-xilinx-nwl.c > @@ -498,10 +498,9 @@ static int nwl_pcie_init_msi_irq_domain(struct nwl_pcie *pcie) > { > #ifdef CONFIG_PCI_MSI > struct device *dev = pcie->dev; > - struct fwnode_handle *fwnode = of_fwnode_handle(dev->of_node); > struct nwl_msi *msi = &pcie->msi; > struct irq_domain_info info = { > - .fwnode = fwnode, > + .fwnode = dev_fwnode(dev), > .ops = &dev_msi_domain_ops, > .host_data = pcie, > .size = INT_PCI_MSI_NR, > diff --git a/drivers/pci/controller/plda/pcie-plda-host.c b/drivers/pci/controller/plda/pcie-plda-host.c > index 92866840875e..8e2db2e5b64b 100644 > --- a/drivers/pci/controller/plda/pcie-plda-host.c > +++ b/drivers/pci/controller/plda/pcie-plda-host.c > @@ -153,13 +153,12 @@ static const struct msi_parent_ops plda_msi_parent_ops = { > static int plda_allocate_msi_domains(struct plda_pcie_rp *port) > { > struct device *dev = port->dev; > - struct fwnode_handle *fwnode = of_fwnode_handle(dev->of_node); > struct plda_msi *msi = &port->msi; > > mutex_init(&port->msi.lock); > > struct irq_domain_info info = { > - .fwnode = fwnode, > + .fwnode = dev_fwnode(dev), > .ops = &msi_domain_ops, > .host_data = port, > .size = msi->num_vectors, > -- > 2.50.1 >