]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
gianfar: Implement proper, per netdevice wakeup management
authorAnton Vorontsov <avorontsov@ru.mvista.com>
Sun, 1 Feb 2009 08:52:34 +0000 (00:52 -0800)
committerDavid S. Miller <davem@davemloft.net>
Sun, 1 Feb 2009 08:52:34 +0000 (00:52 -0800)
This patch implements wakeup management for the gianfar driver.

The driver should set wakeup enable if WOL is enabled, so that
phylib won't power off an attached PHY.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/gianfar.c
drivers/net/gianfar_ethtool.c

index f5e6068f9b07006235168a1759ce9453cf3b5e30..4d2ca490d76cf86eb21c14a5c34f0ce6e8d1cb81 100644 (file)
@@ -463,6 +463,9 @@ static int gfar_probe(struct of_device *ofdev,
                goto register_fail;
        }
 
+       device_init_wakeup(&dev->dev,
+               priv->device_flags & FSL_GIANFAR_DEV_HAS_MAGIC_PACKET);
+
        /* fill out IRQ number and name fields */
        len_devname = strlen(dev->name);
        strncpy(&priv->int_name_tx[0], dev->name, len_devname);
@@ -1200,6 +1203,8 @@ static int gfar_enet_open(struct net_device *dev)
 
        netif_start_queue(dev);
 
+       device_set_wakeup_enable(&dev->dev, priv->wol_en);
+
        return err;
 }
 
index 59b3b5d98efe5bcc746e687b766301e5c6b52720..dbf06e9313cc27750362aa59ab6bb779051f81b8 100644 (file)
@@ -600,6 +600,7 @@ static int gfar_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
 
        spin_lock_irqsave(&priv->bflock, flags);
        priv->wol_en = wol->wolopts & WAKE_MAGIC ? 1 : 0;
+       device_set_wakeup_enable(&dev->dev, priv->wol_en);
        spin_unlock_irqrestore(&priv->bflock, flags);
 
        return 0;