mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-26 02:20:53 +07:00
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: Claudiu Manoil <claudiu.manoil@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
614b42426c
commit
b0734b6dc8
@ -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,9 +1453,8 @@ 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 */
|
||||||
for (i = 0; i < priv->num_grps; i++) {
|
for (i = 0; i < priv->num_grps; i++) {
|
||||||
@ -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 {
|
|||||||
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)
|
|||||||
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)
|
|||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user