From patchwork Thu Dec 5 09:21:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eliad Peller X-Patchwork-Id: 3286981 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3C205C0D4A for ; Thu, 5 Dec 2013 09:21:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7EB1F20501 for ; Thu, 5 Dec 2013 09:21:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5BA89203AA for ; Thu, 5 Dec 2013 09:21:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754302Ab3LEJVn (ORCPT ); Thu, 5 Dec 2013 04:21:43 -0500 Received: from mail-ee0-f48.google.com ([74.125.83.48]:64039 "EHLO mail-ee0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752746Ab3LEJVk (ORCPT ); Thu, 5 Dec 2013 04:21:40 -0500 Received: by mail-ee0-f48.google.com with SMTP id e49so3037614eek.7 for ; Thu, 05 Dec 2013 01:21:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mOvo9R6fbjjJNMDaFkYdml2domL/y3J5BqCDbNoZfcw=; b=m+zaol1xC0XpVJvBucbB38Gjhg79k5b9ppL8vxWfjCRpGt4c5cAJBGHRykr/iUhWuF eJfD4/GgCT7rjnD3njAbc4BALk/e3VHsw+p6j3ZK9/9dSpwLpglNF27tJcJkx2zroy/l ot5LagtfcmQfpfFIAYClLkGRElXgbD94zfWSHHIBbx8dVpMA7TNMtjlBxFr+Bhp8wGDz uWxGKk44Vm3f19egmLJMJDEjuUkWXLIwr6xh8sQxsNdQl22p3T06hhnUsiyFcSuTEtHe 9GHVJGnmT6DdcvqdvYwa5d4ToaejWW77wK5SAYO7jx2OZejy2HxqsNaNyR2UPRSuMyA/ UXDA== X-Gm-Message-State: ALoCoQmdH+SGlEhAJLKjQTmQqK2njEu00EOr13bjNLal31262D/PRd/+OknkbTNX8UW7JExoiigf X-Received: by 10.14.212.69 with SMTP id x45mr11424488eeo.69.1386235299357; Thu, 05 Dec 2013 01:21:39 -0800 (PST) Received: from localhost.localdomain (93-173-177-113.bb.netvision.net.il. [93.173.177.113]) by mx.google.com with ESMTPSA id h3sm78610986eem.15.2013.12.05.01.21.37 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 05 Dec 2013 01:21:38 -0800 (PST) From: Eliad Peller To: Johannes Berg Cc: Subject: [PATCH 2/4] mac80211: determine completed scan type by defined ops Date: Thu, 5 Dec 2013 11:21:27 +0200 Message-Id: <1386235289-27278-2-git-send-email-eliad@wizery.com> X-Mailer: git-send-email 1.8.5.rc1 In-Reply-To: <1386235289-27278-1-git-send-email-eliad@wizery.com> References: <1386235289-27278-1-git-send-email-eliad@wizery.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In some cases, determining the completed scan type was done by testing the SCAN_HW_SCANNING flag. However, this doesn't take care for the case in which the hw scan was requested, but hasn't started yet (e.g. due to active remain_on_channel). Replace this test by checking whether ops->hw_scan is defined. This solves the following warning: WARNING: CPU: 0 PID: 3552 at net/mac80211/offchannel.c:156 __ieee80211_scan_completed+0x1b4/0x2dc [mac80211]() [] (unwind_backtrace+0x0/0xf0) [] (show_stack+0x10/0x14) [] (dump_stack+0x78/0x94) [] (warn_slowpath_common+0x68/0x8c) [] (warn_slowpath_null+0x1c/0x24) [] (__ieee80211_scan_completed+0x1b4/0x2dc [mac80211]) [] (ieee80211_scan_cancel+0xe8/0x190 [mac80211]) [] (ieee80211_do_stop+0x63c/0x79c [mac80211]) [] (ieee80211_stop+0x10/0x18 [mac80211]) [] (__dev_close_many+0x84/0xcc) [] (__dev_close+0x28/0x3c) [] (__dev_change_flags+0x78/0x144) [] (dev_change_flags+0x10/0x48) [] (devinet_ioctl+0x614/0x6d0) [] (sock_ioctl+0x5c/0x2a4) [] (do_vfs_ioctl+0x7c/0x5d8) [] (SyS_ioctl+0x6c/0x7c) Signed-off-by: Eliad Peller --- net/mac80211/scan.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index 618267b..e4baa53 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c @@ -271,10 +271,10 @@ static bool ieee80211_prep_hw_scan(struct ieee80211_local *local) return true; } -static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted, - bool was_hw_scan) +static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted) { struct ieee80211_local *local = hw_to_local(hw); + bool hw_scan = local->ops->hw_scan; lockdep_assert_held(&local->mtx); @@ -290,7 +290,7 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted, if (WARN_ON(!local->scan_req)) return; - if (was_hw_scan && !aborted && ieee80211_prep_hw_scan(local)) { + if (hw_scan && !aborted && ieee80211_prep_hw_scan(local)) { int rc; rc = drv_hw_scan(local, @@ -316,7 +316,7 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted, /* Set power back to normal operating levels. */ ieee80211_hw_config(local, 0); - if (!was_hw_scan) { + if (!hw_scan) { ieee80211_configure_filter(local); drv_sw_scan_complete(local); ieee80211_offchannel_return(local); @@ -751,7 +751,7 @@ void ieee80211_scan_work(struct work_struct *work) container_of(work, struct ieee80211_local, scan_work.work); struct ieee80211_sub_if_data *sdata; unsigned long next_delay = 0; - bool aborted, hw_scan; + bool aborted; mutex_lock(&local->mtx); @@ -838,8 +838,7 @@ void ieee80211_scan_work(struct work_struct *work) goto out; out_complete: - hw_scan = test_bit(SCAN_HW_SCANNING, &local->scanning); - __ieee80211_scan_completed(&local->hw, aborted, hw_scan); + __ieee80211_scan_completed(&local->hw, aborted); out: mutex_unlock(&local->mtx); } @@ -977,7 +976,7 @@ void ieee80211_scan_cancel(struct ieee80211_local *local) */ cancel_delayed_work(&local->scan_work); /* and clean up */ - __ieee80211_scan_completed(&local->hw, true, false); + __ieee80211_scan_completed(&local->hw, true); out: mutex_unlock(&local->mtx); }