netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ravb: Add missing free_irq() calls to ravb_close()
@ 2016-05-04 13:03 Geert Uytterhoeven
  2016-05-04 13:30 ` Sergei Shtylyov
  0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2016-05-04 13:03 UTC (permalink / raw)
  To: David S. Miller, Sergei Shtylyov
  Cc: Yoshihiro Kaneko, Simon Horman, netdev, linux-renesas-soc,
	Geert Uytterhoeven

When reopening the network device on ra7795/salvator-x, e.g. after a
DHCP timeout:

    IP-Config: Reopening network devices...
    genirq: Flags mismatch irq 139. 00000000 (eth0:ch24:emac) vs. 00000000 (eth0:ch24:emac)
    ravb e6800000.ethernet eth0: cannot request IRQ eth0:ch24:emac
    IP-Config: Failed to open eth0
    IP-Config: No network devices available

The "mismatch" is due to requesting an IRQ that is already in use,
while IRQF_PROBE_SHARED wasn't set.

However, the real cause is that ravb_close() doesn't release any of the
R-Car Gen3-specific secondary IRQs.

Add the missing free_irq() calls to fix this.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/net/ethernet/renesas/ravb_main.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 34066e0649f5c673..867caf6e7a5a65ad 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1667,6 +1667,13 @@ static int ravb_close(struct net_device *ndev)
 		priv->phydev = NULL;
 	}
 
+	if (priv->chip_id != RCAR_GEN2) {
+		free_irq(priv->tx_irqs[RAVB_NC], ndev);
+		free_irq(priv->rx_irqs[RAVB_NC], ndev);
+		free_irq(priv->tx_irqs[RAVB_BE], ndev);
+		free_irq(priv->rx_irqs[RAVB_BE], ndev);
+		free_irq(priv->emac_irq, ndev);
+	}
 	free_irq(ndev->irq, ndev);
 
 	napi_disable(&priv->napi[RAVB_NC]);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ravb: Add missing free_irq() calls to ravb_close()
  2016-05-04 13:03 [PATCH] ravb: Add missing free_irq() calls to ravb_close() Geert Uytterhoeven
@ 2016-05-04 13:30 ` Sergei Shtylyov
  0 siblings, 0 replies; 2+ messages in thread
From: Sergei Shtylyov @ 2016-05-04 13:30 UTC (permalink / raw)
  To: Geert Uytterhoeven, David S. Miller
  Cc: Yoshihiro Kaneko, Simon Horman, netdev, linux-renesas-soc

Hello.

On 05/04/2016 04:03 PM, Geert Uytterhoeven wrote:

> When reopening the network device on ra7795/salvator-x, e.g. after a
> DHCP timeout:
>
>      IP-Config: Reopening network devices...
>      genirq: Flags mismatch irq 139. 00000000 (eth0:ch24:emac) vs. 00000000 (eth0:ch24:emac)
>      ravb e6800000.ethernet eth0: cannot request IRQ eth0:ch24:emac
>      IP-Config: Failed to open eth0
>      IP-Config: No network devices available
>
> The "mismatch" is due to requesting an IRQ that is already in use,
> while IRQF_PROBE_SHARED wasn't set.
>
> However, the real cause is that ravb_close() doesn't release any of the
> R-Car Gen3-specific secondary IRQs.
>
> Add the missing free_irq() calls to fix this.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

    This patch must be against net-next.git but you because the patch that 
this one fixes is only there. You never indicated that. I'd also appreciate if 
you specify the Fixed: tag.

> ---
>   drivers/net/ethernet/renesas/ravb_main.c | 7 +++++++
>   1 file changed, 7 insertions(+)
>
> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> index 34066e0649f5c673..867caf6e7a5a65ad 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -1667,6 +1667,13 @@ static int ravb_close(struct net_device *ndev)
>   		priv->phydev = NULL;
>   	}
>
> +	if (priv->chip_id != RCAR_GEN2) {
> +		free_irq(priv->tx_irqs[RAVB_NC], ndev);
> +		free_irq(priv->rx_irqs[RAVB_NC], ndev);
> +		free_irq(priv->tx_irqs[RAVB_BE], ndev);
> +		free_irq(priv->rx_irqs[RAVB_BE], ndev);

    Shame on me for not noticing this. :-(

> +		free_irq(priv->emac_irq, ndev);

    However, net.git is also affected, it only calls free_irq() on 'ndev->irq'.
Please submit 2 separate fixes against net.git and net-next.git.

> +	}
>   	free_irq(ndev->irq, ndev);
>
>   	napi_disable(&priv->napi[RAVB_NC]);
>

MBR, Sergei

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-05-04 13:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-04 13:03 [PATCH] ravb: Add missing free_irq() calls to ravb_close() Geert Uytterhoeven
2016-05-04 13:30 ` Sergei Shtylyov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).