Message ID | 20221025031236.1031330-1-yangyingliang@huawei.com (mailing list archive) |
---|---|
State | Rejected |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next,1/2] net: natsemi: xtsonic: switch to use platform_get_irq() | expand |
On Tue, 25 Oct 2022 11:12:35 +0800 Yang Yingliang wrote: > Switch to use platform_get_irq() which supports more cases. More cases of what? You need to explain what you're trying to achieve and why you're touching this old driver. > diff --git a/drivers/net/ethernet/natsemi/xtsonic.c b/drivers/net/ethernet/natsemi/xtsonic.c > index 52fef34d43f9..ffb3814c54cb 100644 > --- a/drivers/net/ethernet/natsemi/xtsonic.c > +++ b/drivers/net/ethernet/natsemi/xtsonic.c > @@ -201,14 +201,17 @@ int xtsonic_probe(struct platform_device *pdev) > { > struct net_device *dev; > struct sonic_local *lp; > - struct resource *resmem, *resirq; > + struct resource *resmem; > + int irq; > int err = 0; The variable declaration lines should be sorted longest to shortest. > if ((resmem = platform_get_resource(pdev, IORESOURCE_MEM, 0)) == NULL) > return -ENODEV; > > - if ((resirq = platform_get_resource(pdev, IORESOURCE_IRQ, 0)) == NULL) > - return -ENODEV; > + irq = platform_get_irq(pdev, 0); > + if (irq < 0) > + return irq; > + > extra new line
On 2022/10/25 12:11, Jakub Kicinski wrote: > On Tue, 25 Oct 2022 11:12:35 +0800 Yang Yingliang wrote: >> Switch to use platform_get_irq() which supports more cases. > More cases of what? You need to explain what you're trying to achieve > and why you're touching this old driver. platform_get_irq() is a common API which calls of_irq_get(), platform_get_resource() or acpi_dev_gpio_irq_get() to get irq, and it returns exactly error code. Thanks, Yang > >> diff --git a/drivers/net/ethernet/natsemi/xtsonic.c b/drivers/net/ethernet/natsemi/xtsonic.c >> index 52fef34d43f9..ffb3814c54cb 100644 >> --- a/drivers/net/ethernet/natsemi/xtsonic.c >> +++ b/drivers/net/ethernet/natsemi/xtsonic.c >> @@ -201,14 +201,17 @@ int xtsonic_probe(struct platform_device *pdev) >> { >> struct net_device *dev; >> struct sonic_local *lp; >> - struct resource *resmem, *resirq; >> + struct resource *resmem; >> + int irq; >> int err = 0; > The variable declaration lines should be sorted longest to shortest. > >> if ((resmem = platform_get_resource(pdev, IORESOURCE_MEM, 0)) == NULL) >> return -ENODEV; >> >> - if ((resirq = platform_get_resource(pdev, IORESOURCE_IRQ, 0)) == NULL) >> - return -ENODEV; >> + irq = platform_get_irq(pdev, 0); >> + if (irq < 0) >> + return irq; >> + >> > extra new line > .
diff --git a/drivers/net/ethernet/natsemi/xtsonic.c b/drivers/net/ethernet/natsemi/xtsonic.c index 52fef34d43f9..ffb3814c54cb 100644 --- a/drivers/net/ethernet/natsemi/xtsonic.c +++ b/drivers/net/ethernet/natsemi/xtsonic.c @@ -201,14 +201,17 @@ int xtsonic_probe(struct platform_device *pdev) { struct net_device *dev; struct sonic_local *lp; - struct resource *resmem, *resirq; + struct resource *resmem; + int irq; int err = 0; if ((resmem = platform_get_resource(pdev, IORESOURCE_MEM, 0)) == NULL) return -ENODEV; - if ((resirq = platform_get_resource(pdev, IORESOURCE_IRQ, 0)) == NULL) - return -ENODEV; + irq = platform_get_irq(pdev, 0); + if (irq < 0) + return irq; + if ((dev = alloc_etherdev(sizeof(struct sonic_local))) == NULL) return -ENOMEM; @@ -219,7 +222,7 @@ int xtsonic_probe(struct platform_device *pdev) SET_NETDEV_DEV(dev, &pdev->dev); dev->base_addr = resmem->start; - dev->irq = resirq->start; + dev->irq = irq; if ((err = sonic_probe1(dev))) goto out;
Switch to use platform_get_irq() which supports more cases. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> --- drivers/net/ethernet/natsemi/xtsonic.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)