diff mbox series

[net,13/13] net: dwmac-loongson: Perceive zero IRQ as invalid

Message ID 20230313224237.28757-14-Sergey.Semin@baikalelectronics.ru (mailing list archive)
State Rejected
Delegated to: Netdev Maintainers
Headers show
Series net: stmmac: Fixes bundle #1 | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 18 this patch: 18
netdev/cc_maintainers warning 3 maintainers not CCed: linux-mediatek@lists.infradead.org angelogioacchino.delregno@collabora.com matthias.bgg@gmail.com
netdev/build_clang success Errors and warnings before: 18 this patch: 18
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 18 this patch: 18
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 23 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Serge Semin March 13, 2023, 10:42 p.m. UTC
Linux kernel defines zero IRQ number as invalid in case if IRQ couldn't be
mapped. Fix that for Loongson PCI MAC specific IRQs request procedure.

Fixes: 30bba69d7db4 ("stmmac: pci: Add dwmac support for Loongson")
Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Piotr Raczynski March 14, 2023, 8:20 a.m. UTC | #1
On Tue, Mar 14, 2023 at 01:42:37AM +0300, Serge Semin wrote:
> Linux kernel defines zero IRQ number as invalid in case if IRQ couldn't be
> mapped. Fix that for Loongson PCI MAC specific IRQs request procedure.
> 

Looks a little odd but as I also checked and kernel does seem to treat
zero as mapping failure instead of -WHATEVER.

Fix looks fine.

Reviewed-by: Piotr Raczynski <piotr.raczynski@intel.com>

> Fixes: 30bba69d7db4 ("stmmac: pci: Add dwmac support for Loongson")
> Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
> ---
>  drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> index a25c187d3185..907bdfcc07e9 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> @@ -127,20 +127,20 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id
>  	res.addr = pcim_iomap_table(pdev)[0];
>  
>  	res.irq = of_irq_get_byname(np, "macirq");
> -	if (res.irq < 0) {
> +	if (res.irq <= 0) {
>  		dev_err(&pdev->dev, "IRQ macirq not found\n");
>  		ret = -ENODEV;
>  		goto err_disable_msi;
>  	}
>  
>  	res.wol_irq = of_irq_get_byname(np, "eth_wake_irq");
> -	if (res.wol_irq < 0) {
> +	if (res.wol_irq <= 0) {
>  		dev_info(&pdev->dev, "IRQ eth_wake_irq not found, using macirq\n");
>  		res.wol_irq = res.irq;
>  	}
>  
>  	res.lpi_irq = of_irq_get_byname(np, "eth_lpi");
> -	if (res.lpi_irq < 0) {
> +	if (res.lpi_irq <= 0) {
>  		dev_err(&pdev->dev, "IRQ eth_lpi not found\n");
>  		ret = -ENODEV;
>  		goto err_disable_msi;
> -- 
> 2.39.2
> 
>
Serge Semin March 14, 2023, 11:38 a.m. UTC | #2
On Tue, Mar 14, 2023 at 09:20:42AM +0100, Piotr Raczynski wrote:
> On Tue, Mar 14, 2023 at 01:42:37AM +0300, Serge Semin wrote:
> > Linux kernel defines zero IRQ number as invalid in case if IRQ couldn't be
> > mapped. Fix that for Loongson PCI MAC specific IRQs request procedure.
> > 
> 

> Looks a little odd but as I also checked and kernel does seem to treat
> zero as mapping failure instead of -WHATEVER.

See what Linus originally told about that:
https://lore.kernel.org/lkml/Pine.LNX.4.64.0701250940220.25027@woody.linux-foundation.org/

> 
> Fix looks fine.
> 
> Reviewed-by: Piotr Raczynski <piotr.raczynski@intel.com>

Thanks.

-Serge(y)

> 
> > Fixes: 30bba69d7db4 ("stmmac: pci: Add dwmac support for Loongson")
> > Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
> > ---
> >  drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> > index a25c187d3185..907bdfcc07e9 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> > @@ -127,20 +127,20 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id
> >  	res.addr = pcim_iomap_table(pdev)[0];
> >  
> >  	res.irq = of_irq_get_byname(np, "macirq");
> > -	if (res.irq < 0) {
> > +	if (res.irq <= 0) {
> >  		dev_err(&pdev->dev, "IRQ macirq not found\n");
> >  		ret = -ENODEV;
> >  		goto err_disable_msi;
> >  	}
> >  
> >  	res.wol_irq = of_irq_get_byname(np, "eth_wake_irq");
> > -	if (res.wol_irq < 0) {
> > +	if (res.wol_irq <= 0) {
> >  		dev_info(&pdev->dev, "IRQ eth_wake_irq not found, using macirq\n");
> >  		res.wol_irq = res.irq;
> >  	}
> >  
> >  	res.lpi_irq = of_irq_get_byname(np, "eth_lpi");
> > -	if (res.lpi_irq < 0) {
> > +	if (res.lpi_irq <= 0) {
> >  		dev_err(&pdev->dev, "IRQ eth_lpi not found\n");
> >  		ret = -ENODEV;
> >  		goto err_disable_msi;
> > -- 
> > 2.39.2
> > 
> >
diff mbox series

Patch

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
index a25c187d3185..907bdfcc07e9 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
@@ -127,20 +127,20 @@  static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id
 	res.addr = pcim_iomap_table(pdev)[0];
 
 	res.irq = of_irq_get_byname(np, "macirq");
-	if (res.irq < 0) {
+	if (res.irq <= 0) {
 		dev_err(&pdev->dev, "IRQ macirq not found\n");
 		ret = -ENODEV;
 		goto err_disable_msi;
 	}
 
 	res.wol_irq = of_irq_get_byname(np, "eth_wake_irq");
-	if (res.wol_irq < 0) {
+	if (res.wol_irq <= 0) {
 		dev_info(&pdev->dev, "IRQ eth_wake_irq not found, using macirq\n");
 		res.wol_irq = res.irq;
 	}
 
 	res.lpi_irq = of_irq_get_byname(np, "eth_lpi");
-	if (res.lpi_irq < 0) {
+	if (res.lpi_irq <= 0) {
 		dev_err(&pdev->dev, "IRQ eth_lpi not found\n");
 		ret = -ENODEV;
 		goto err_disable_msi;