Re: [PATCHv3 net-next] net: modernize IRQ resource acquisition
From: Julian Calaby <hidden>
Date: 2024-11-13 09:48:37
Also in:
linux-arm-kernel, linux-can, linux-sunxi, lkml, netdev
Hi Rosen, On Wed, Nov 13, 2024 at 8:14 AM Rosen Penev [off-list ref] wrote:
In probe, np == pdev->dev.of_node. It's easier to pass pdev directly. Replace irq_of_parse_and_map() by platform_get_irq() to do so. Requires removing the error message as well as fixing the return type. Replace of_address_to_resource() with platform_get_resource() for the same reason.
Sorry for the drive-by review, but I have to question the utility of this conversion.
quoted hunk ↗ jump to hunk
diff --git a/drivers/net/can/grcan.c b/drivers/net/can/grcan.c index cdf0ec9fa7f3..48e93c3445e7 100644 --- a/drivers/net/can/grcan.c +++ b/drivers/net/can/grcan.c@@ -1673,9 +1673,8 @@ static int grcan_probe(struct platform_device *ofdev) goto exit_error; } - irq = irq_of_parse_and_map(np, GRCAN_IRQIX_IRQ); - if (!irq) { - dev_err(&ofdev->dev, "no irq found\n"); + irq = platform_get_irq(ofdev, GRCAN_IRQIX_IRQ); + if (irq < 0) {
In this change and a lot of the others, you're not removing the "np" variable, so you're basically replacing one wrapper with another.
quoted hunk ↗ jump to hunk
err = -ENODEV; goto exit_error; }diff --git a/drivers/net/ethernet/freescale/fs_enet/mac-fcc.c b/drivers/net/ethernet/freescale/fs_enet/mac-fcc.c index be63293511d9..9006137e3a55 100644 --- a/drivers/net/ethernet/freescale/fs_enet/mac-fcc.c +++ b/drivers/net/ethernet/freescale/fs_enet/mac-fcc.c@@ -83,8 +83,8 @@ static int do_pd_setup(struct fs_enet_private *fep) struct fs_platform_info *fpi = fep->fpi; int ret = -EINVAL; - fep->interrupt = irq_of_parse_and_map(ofdev->dev.of_node, 0); - if (!fep->interrupt) + fep->interrupt = platform_get_irq(ofdev, 0); + if (fep->interrupt < 0)
This one and others like it are fine: it's much cleaner to use the "platform_irq()" function instead of reaching deep into the structure to grab the "of_node" property. That said, in this case and probably a few others this is a driver for an OF device so I'm still not sure this actually makes sense. Thanks, -- Julian Calaby Email: julian.calaby@gmail.com Profile: http://www.google.com/profiles/julian.calaby/