sh_eth: fix wakeup event reporting from MagicPacket
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Wed, 1 Feb 2017 14:41:55 +0000 (15:41 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 1 Feb 2017 17:53:59 +0000 (12:53 -0500)
If a link change interrupt happens along side the MagicPacket interrupt
and the link change interrupt is ignored the interrupt handler will
return and the wakeup event is not registered. Fix this by moving the
MagicPacket check before the link change check.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reported-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Acked-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/renesas/sh_eth.c

index f9134c818ac6ef533710b438d933a636d98bf9fa..54248775f227b062addf85044f486ad4512039f5 100644 (file)
@@ -1605,6 +1605,8 @@ static void sh_eth_emac_interrupt(struct net_device *ndev)
        sh_eth_write(ndev, felic_stat, ECSR);   /* clear int */
        if (felic_stat & ECSR_ICD)
                ndev->stats.tx_carrier_errors++;
+       if (felic_stat & ECSR_MPD)
+               pm_wakeup_event(&mdp->pdev->dev, 0);
        if (felic_stat & ECSR_LCHNG) {
                /* Link Changed */
                if (mdp->cd->no_psr || mdp->no_ether_link)
@@ -1624,8 +1626,6 @@ static void sh_eth_emac_interrupt(struct net_device *ndev)
                        sh_eth_rcv_snd_enable(ndev);
                }
        }
-       if (felic_stat & ECSR_MPD)
-               pm_wakeup_event(&mdp->pdev->dev, 0);
 }
 
 /* error control function */