mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 04:24:31 +01:00
PCI: controller: Use dev_fwnode() instead of of_fwnode_handle()
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.
In the case of altera, this also removes an unused 'node' variable that is
only used when CONFIG_OF is enabled:
drivers/pci/controller/pcie-altera.c: In function 'altera_pcie_init_irq_domain':
drivers/pci/controller/pcie-altera.c:855:29: error: unused variable 'node' [-Werror=unused-variable]
855 | struct device_node *node = dev->of_node;
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de> # altera
[bhelgaas: squash together, rebase to precede msi-parent]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://patch.msgid.link/20250521163329.2137973-1-arnd@kernel.org
Link: https://patch.msgid.link/20250611104348.192092-16-jirislaby@kernel.org
Link: https://patch.msgid.link/20250723065907.1841758-1-jirislaby@kernel.org
This commit is contained in:
parent
19272b37aa
commit
a103d2dede
9 changed files with 11 additions and 14 deletions
|
|
@ -227,7 +227,7 @@ 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 fwnode_handle *fwnode = dev_fwnode(pci->dev);
|
||||
|
||||
pp->irq_domain = irq_domain_create_linear(fwnode, pp->num_vectors,
|
||||
&dw_pcie_msi_domain_ops, pp);
|
||||
|
|
|
|||
|
|
@ -435,7 +435,7 @@ 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 fwnode_handle *fwnode = dev_fwnode(dev);
|
||||
struct mobiveil_msi *msi = &pcie->rp.msi;
|
||||
|
||||
mutex_init(&msi->lock);
|
||||
|
|
@ -464,9 +464,8 @@ static int mobiveil_pcie_init_irq_domain(struct mobiveil_pcie *pcie)
|
|||
struct mobiveil_root_port *rp = &pcie->rp;
|
||||
|
||||
/* setup INTx */
|
||||
rp->intx_domain = irq_domain_create_linear(of_fwnode_handle(dev->of_node), PCI_NUM_INTX,
|
||||
&intx_domain_ops, pcie);
|
||||
|
||||
rp->intx_domain = irq_domain_create_linear(dev_fwnode(dev), PCI_NUM_INTX, &intx_domain_ops,
|
||||
pcie);
|
||||
if (!rp->intx_domain) {
|
||||
dev_err(dev, "Failed to get a INTx IRQ domain\n");
|
||||
return -ENOMEM;
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ 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 fwnode_handle *fwnode = dev_fwnode(&msi->pdev->dev);
|
||||
|
||||
msi->inner_domain = irq_domain_create_linear(NULL, msi->num_of_vectors,
|
||||
&msi_domain_ops, msi);
|
||||
|
|
|
|||
|
|
@ -852,10 +852,9 @@ static void aglx_isr(struct irq_desc *desc)
|
|||
static int altera_pcie_init_irq_domain(struct altera_pcie *pcie)
|
||||
{
|
||||
struct device *dev = &pcie->pdev->dev;
|
||||
struct device_node *node = dev->of_node;
|
||||
|
||||
/* Setup INTx */
|
||||
pcie->irq_domain = irq_domain_create_linear(of_fwnode_handle(node), PCI_NUM_INTX,
|
||||
pcie->irq_domain = irq_domain_create_linear(dev_fwnode(dev), PCI_NUM_INTX,
|
||||
&intx_domain_ops, pcie);
|
||||
if (!pcie->irq_domain) {
|
||||
dev_err(dev, "Failed to get a INTx IRQ domain\n");
|
||||
|
|
|
|||
|
|
@ -756,8 +756,7 @@ static int mtk_pcie_init_irq_domains(struct mtk_gen3_pcie *pcie)
|
|||
/* Setup MSI */
|
||||
mutex_init(&pcie->lock);
|
||||
|
||||
pcie->msi_bottom_domain = irq_domain_create_linear(of_fwnode_handle(node),
|
||||
PCIE_MSI_IRQS_NUM,
|
||||
pcie->msi_bottom_domain = irq_domain_create_linear(dev_fwnode(dev), PCIE_MSI_IRQS_NUM,
|
||||
&mtk_msi_bottom_domain_ops, pcie);
|
||||
if (!pcie->msi_bottom_domain) {
|
||||
dev_err(dev, "failed to create MSI bottom domain\n");
|
||||
|
|
|
|||
|
|
@ -485,7 +485,7 @@ static struct msi_domain_info mtk_msi_domain_info = {
|
|||
|
||||
static int mtk_pcie_allocate_msi_domains(struct mtk_pcie_port *port)
|
||||
{
|
||||
struct fwnode_handle *fwnode = of_fwnode_handle(port->pcie->dev->of_node);
|
||||
struct fwnode_handle *fwnode = dev_fwnode(port->pcie->dev);
|
||||
|
||||
mutex_init(&port->lock);
|
||||
|
||||
|
|
|
|||
|
|
@ -470,7 +470,7 @@ 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 fwnode_handle *fwnode = dev_fwnode(port->dev);
|
||||
|
||||
msi->dev_domain = irq_domain_create_linear(NULL, XILINX_NUM_MSI_IRQS,
|
||||
&dev_msi_domain_ops, port);
|
||||
|
|
|
|||
|
|
@ -495,7 +495,7 @@ 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 fwnode_handle *fwnode = dev_fwnode(dev);
|
||||
struct nwl_msi *msi = &pcie->msi;
|
||||
|
||||
msi->dev_domain = irq_domain_create_linear(NULL, INT_PCI_MSI_NR, &dev_msi_domain_ops, pcie);
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ static struct msi_domain_info plda_msi_domain_info = {
|
|||
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 fwnode_handle *fwnode = dev_fwnode(dev);
|
||||
struct plda_msi *msi = &port->msi;
|
||||
|
||||
mutex_init(&port->msi.lock);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue