Commit b0734b6d authored by Claudiu Manoil's avatar Claudiu Manoil Committed by David S. Miller

gianfar: Enable device wakeup when appropriate

The wol_en flag is 0 by default anyway, and we have the
following inconsistency: a MAGIC packet wol capable eth
interface is registered as a wake-up source but unable
to wake-up the system as wol_en is 0 (wake-on flag set to 'd').
Calling set_wakeup_enable() at netdev open is just redundant
because wol_en is 0 by default.
Let only ethtool call set_wakeup_enable() for now.

The bflock is obviously obsoleted, its utility has been corroded
over time.  The bitfield flags used today in gianfar are accessed
only on the init/ config path, with no real possibility of
concurrency - nothing that would justify smth. like bflock.
Signed-off-by: default avatarClaudiu Manoil <claudiu.manoil@freescale.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 614b4242
...@@ -1360,7 +1360,6 @@ static int gfar_probe(struct platform_device *ofdev) ...@@ -1360,7 +1360,6 @@ static int gfar_probe(struct platform_device *ofdev)
priv->dev = &ofdev->dev; priv->dev = &ofdev->dev;
SET_NETDEV_DEV(dev, &ofdev->dev); SET_NETDEV_DEV(dev, &ofdev->dev);
spin_lock_init(&priv->bflock);
INIT_WORK(&priv->reset_task, gfar_reset_task); INIT_WORK(&priv->reset_task, gfar_reset_task);
platform_set_drvdata(ofdev, priv); platform_set_drvdata(ofdev, priv);
...@@ -1454,8 +1453,7 @@ static int gfar_probe(struct platform_device *ofdev) ...@@ -1454,8 +1453,7 @@ static int gfar_probe(struct platform_device *ofdev)
goto register_fail; goto register_fail;
} }
device_init_wakeup(&dev->dev, device_set_wakeup_capable(&dev->dev, priv->device_flags &
priv->device_flags &
FSL_GIANFAR_DEV_HAS_MAGIC_PACKET); FSL_GIANFAR_DEV_HAS_MAGIC_PACKET);
/* fill out IRQ number and name fields */ /* fill out IRQ number and name fields */
...@@ -2133,8 +2131,6 @@ static int gfar_enet_open(struct net_device *dev) ...@@ -2133,8 +2131,6 @@ static int gfar_enet_open(struct net_device *dev)
if (err) if (err)
return err; return err;
device_set_wakeup_enable(&dev->dev, priv->wol_en);
return err; return err;
} }
......
...@@ -1145,9 +1145,6 @@ struct gfar_private { ...@@ -1145,9 +1145,6 @@ struct gfar_private {
int oldduplex; int oldduplex;
int oldlink; int oldlink;
/* Bitfield update lock */
spinlock_t bflock;
uint32_t msg_enable; uint32_t msg_enable;
struct work_struct reset_task; struct work_struct reset_task;
......
...@@ -653,7 +653,6 @@ static void gfar_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) ...@@ -653,7 +653,6 @@ static void gfar_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
static int gfar_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) static int gfar_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
{ {
struct gfar_private *priv = netdev_priv(dev); struct gfar_private *priv = netdev_priv(dev);
unsigned long flags;
if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_MAGIC_PACKET) && if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_MAGIC_PACKET) &&
wol->wolopts != 0) wol->wolopts != 0)
...@@ -664,9 +663,7 @@ static int gfar_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) ...@@ -664,9 +663,7 @@ static int gfar_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
device_set_wakeup_enable(&dev->dev, wol->wolopts & WAKE_MAGIC); device_set_wakeup_enable(&dev->dev, wol->wolopts & WAKE_MAGIC);
spin_lock_irqsave(&priv->bflock, flags);
priv->wol_en = !!device_may_wakeup(&dev->dev); priv->wol_en = !!device_may_wakeup(&dev->dev);
spin_unlock_irqrestore(&priv->bflock, flags);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment