From d2e7b3425c474300318e1d28b10a93c2401b9255 Mon Sep 17 00:00:00 2001 From: Daniel Drake Date: Mon, 1 Aug 2011 16:43:13 +0100 Subject: libertas: disable functionality when interface is down Modify the driver so that it does not function when the interface is down, in preparation for runtime power management. No commands can be run while the interface is down, so the ndo_dev_stop routine now directly does all necessary work (including asking the device to disconnect from the network and disabling multicast functionality) directly. power_save and power_restore hooks are added meaning that card drivers can take steps to turn the device off when the interface is down. The MAC address can now only be changed when all interfaces are down; the new address will be programmed when an interface gets brought up. This matches mac80211 behaviour. Also, some small cleanups/simplifications were made in the surrounding device handling logic. Signed-off-by: Daniel Drake Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/mesh.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'drivers/net/wireless/libertas/mesh.c') diff --git a/drivers/net/wireless/libertas/mesh.c b/drivers/net/wireless/libertas/mesh.c index 2a635d279ff..138699baf90 100644 --- a/drivers/net/wireless/libertas/mesh.c +++ b/drivers/net/wireless/libertas/mesh.c @@ -924,7 +924,9 @@ static int lbs_mesh_stop(struct net_device *dev) spin_unlock_irq(&priv->driver_lock); - schedule_work(&priv->mcast_work); + lbs_update_mcast(priv); + if (!lbs_iface_active(priv)) + lbs_stop_iface(priv); lbs_deb_leave(LBS_DEB_MESH); return 0; @@ -942,6 +944,11 @@ static int lbs_mesh_dev_open(struct net_device *dev) int ret = 0; lbs_deb_enter(LBS_DEB_NET); + if (!priv->iface_running) { + ret = lbs_start_iface(priv); + if (ret) + goto out; + } spin_lock_irq(&priv->driver_lock); -- cgit v1.2.3-70-g09d2