* [PATCH] PCI: apple: use fwnode_irq_get() for port IRQ lookup
@ 2026-07-22 23:12 Rosen Penev
2026-07-23 7:43 ` Marc Zyngier
0 siblings, 1 reply; 2+ messages in thread
From: Rosen Penev @ 2026-07-22 23:12 UTC (permalink / raw)
To: linux-pci
Cc: Marc Zyngier, Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas,
Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
open list,
open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b
Replace irq_of_parse_and_map() with fwnode_irq_get() on the PCIe
controller device's fwnode, indexed by port->idx. This is equivalent
for an OF-backed fwnode but uses the generic firmware-node API.
Unlike irq_of_parse_and_map(), fwnode_irq_get() returns a positive IRQ
or a negative errno and never 0 (it rewrites 0 to -EINVAL). So store
the result in an int and check for irq < 0, propagating the error
(including -EPROBE_DEFER) instead of the previous unsigned int with an
`if (!irq)` check that could never catch a negative failure.
Built for arm64 (defconfig + CONFIG_PCIE_APPLE) with LLVM=1;
drivers/pci/controller/pcie-apple.o compiles cleanly.
Assisted-by: opencode:hy3-free
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/pci/controller/pcie-apple.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/pci/controller/pcie-apple.c b/drivers/pci/controller/pcie-apple.c
index c2cffc0659f4..535acf274b78 100644
--- a/drivers/pci/controller/pcie-apple.c
+++ b/drivers/pci/controller/pcie-apple.c
@@ -400,14 +400,13 @@ static int apple_pcie_port_setup_irq(struct apple_pcie_port *port)
{
struct fwnode_handle *fwnode = &port->np->fwnode;
struct apple_pcie *pcie = port->pcie;
- unsigned int irq;
+ int irq;
u32 val = 0;
/* FIXME: consider moving each interrupt under each port */
- irq = irq_of_parse_and_map(to_of_node(dev_fwnode(port->pcie->dev)),
- port->idx);
- if (!irq)
- return -ENXIO;
+ irq = fwnode_irq_get(dev_fwnode(pcie->dev), port->idx);
+ if (irq < 0)
+ return irq;
port->domain = irq_domain_create_linear(fwnode, 32,
&apple_port_irq_domain_ops,
--
2.55.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] PCI: apple: use fwnode_irq_get() for port IRQ lookup
2026-07-22 23:12 [PATCH] PCI: apple: use fwnode_irq_get() for port IRQ lookup Rosen Penev
@ 2026-07-23 7:43 ` Marc Zyngier
0 siblings, 0 replies; 2+ messages in thread
From: Marc Zyngier @ 2026-07-23 7:43 UTC (permalink / raw)
To: Rosen Penev
Cc: linux-pci, Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas,
Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
open list,
open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b
On Thu, 23 Jul 2026 00:12:14 +0100,
Rosen Penev <rosenp@gmail.com> wrote:
>
> Replace irq_of_parse_and_map() with fwnode_irq_get() on the PCIe
> controller device's fwnode, indexed by port->idx. This is equivalent
> for an OF-backed fwnode but uses the generic firmware-node API.
>
> Unlike irq_of_parse_and_map(), fwnode_irq_get() returns a positive IRQ
> or a negative errno and never 0 (it rewrites 0 to -EINVAL). So store
> the result in an int and check for irq < 0, propagating the error
> (including -EPROBE_DEFER) instead of the previous unsigned int with an
> `if (!irq)` check that could never catch a negative failure.
>
> Built for arm64 (defconfig + CONFIG_PCIE_APPLE) with LLVM=1;
> drivers/pci/controller/pcie-apple.o compiles cleanly.
But what is the point of this change? This driver is strongly OF-only,
and there is no parallel universe where it would support ACPI.
But more importantly: -EPROBE_DEFER would make things worse, because
there is nothing in the driver that actually deals with a state
rollback on probe failure. Today, we rely on failing hard.
As it stands, I don't think this change is worse the hassle it has the
potential to generate.
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-23 7:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-22 23:12 [PATCH] PCI: apple: use fwnode_irq_get() for port IRQ lookup Rosen Penev
2026-07-23 7:43 ` Marc Zyngier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox