From patchwork Thu Nov 4 21:21:52 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Drake X-Patchwork-Id: 302872 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oA4MEHNP007630 for ; Thu, 4 Nov 2010 22:14:17 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751144Ab0KDWOP (ORCPT ); Thu, 4 Nov 2010 18:14:15 -0400 Received: from queueout02-winn.ispmail.ntl.com ([81.103.221.56]:65193 "EHLO queueout02-winn.ispmail.ntl.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750929Ab0KDWOO (ORCPT ); Thu, 4 Nov 2010 18:14:14 -0400 Received: from aamtaout04-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout01-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20101104212155.MYAH25742.mtaout01-winn.ispmail.ntl.com@aamtaout04-winn.ispmail.ntl.com>; Thu, 4 Nov 2010 21:21:55 +0000 Received: from zog.reactivated.net ([86.14.215.141]) by aamtaout04-winn.ispmail.ntl.com (InterMail vG.3.00.04.00 201-2196-133-20080908) with ESMTP id <20101104212155.BRSJ25656.aamtaout04-winn.ispmail.ntl.com@zog.reactivated.net>; Thu, 4 Nov 2010 21:21:55 +0000 Received: by zog.reactivated.net (Postfix, from userid 1000) id 0F7B59D401B; Thu, 4 Nov 2010 21:21:52 +0000 (GMT) From: Daniel Drake To: linville@tuxdriver.com Cc: linux-wireless@vger.kernel.org Cc: libertas-dev@lists.infradead.org Cc: dcbw@redhat.com Cc: dkiran@marvell.com Cc: hs4233@mail.mn-solutions.de Subject: [PATCH] libertas: terminate scan when stopping interface Message-Id: <20101104212153.0F7B59D401B@zog.reactivated.net> Date: Thu, 4 Nov 2010 21:21:52 +0000 (GMT) X-Cloudmark-Analysis: v=1.1 cv=3ENABmdyEd/Fm7fR7+mZIuMDn6+IErAeEhlfWBImZFk= c=1 sm=0 a=yICU4GJ3VP4A:10 a=Op-mwl0xAAAA:8 a=20KFwNOVAAAA:8 a=nbOPgZx27TyfipKroBkA:9 a=uo3UdEVK9gI-YfdKc2UA:7 a=TsvpQ4W8qXeAK4_bBTf9FgHVbiQA:4 a=d4CUUju0HPYA:10 a=jEp0ucaQiEUA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Thu, 04 Nov 2010 22:14:17 +0000 (UTC) diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c index 5046a00..373930a 100644 --- a/drivers/net/wireless/libertas/cfg.c +++ b/drivers/net/wireless/libertas/cfg.c @@ -700,8 +700,9 @@ static void lbs_scan_worker(struct work_struct *work) if (priv->scan_channel < priv->scan_req->n_channels) { cancel_delayed_work(&priv->scan_work); - queue_delayed_work(priv->work_thread, &priv->scan_work, - msecs_to_jiffies(300)); + if (!priv->stopping) + queue_delayed_work(priv->work_thread, &priv->scan_work, + msecs_to_jiffies(300)); } /* This is the final data we are about to send */ diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index f062ed5..cb14c38 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h @@ -36,6 +36,7 @@ struct lbs_private { /* CFG80211 */ struct wireless_dev *wdev; bool wiphy_registered; + bool stopping; struct cfg80211_scan_request *scan_req; u8 assoc_bss[ETH_ALEN]; u8 disassoc_reason; diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 47ce5a6..46b88b1 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -104,6 +104,7 @@ static int lbs_dev_open(struct net_device *dev) lbs_deb_enter(LBS_DEB_NET); spin_lock_irq(&priv->driver_lock); + priv->stopping = false; if (priv->connect_status == LBS_CONNECTED) netif_carrier_on(dev); @@ -131,10 +132,16 @@ static int lbs_eth_stop(struct net_device *dev) lbs_deb_enter(LBS_DEB_NET); spin_lock_irq(&priv->driver_lock); + priv->stopping = true; netif_stop_queue(dev); spin_unlock_irq(&priv->driver_lock); schedule_work(&priv->mcast_work); + cancel_delayed_work_sync(&priv->scan_work); + if (priv->scan_req) { + cfg80211_scan_done(priv->scan_req, false); + priv->scan_req = NULL; + } lbs_deb_leave(LBS_DEB_NET); return 0;