From patchwork Mon Apr 21 04:53:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gang ZHAO X-Patchwork-Id: 4022331 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 7BC3BBFF02 for ; Mon, 21 Apr 2014 04:55:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A0AAD2021B for ; Mon, 21 Apr 2014 04:55:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B2E6220218 for ; Mon, 21 Apr 2014 04:55:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751634AbaDUEzN (ORCPT ); Mon, 21 Apr 2014 00:55:13 -0400 Received: from mail-pa0-f48.google.com ([209.85.220.48]:34700 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751602AbaDUEzJ (ORCPT ); Mon, 21 Apr 2014 00:55:09 -0400 Received: by mail-pa0-f48.google.com with SMTP id hz1so3337700pad.21 for ; Sun, 20 Apr 2014 21:55:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=zI/oL5WIVoQd5r005N6hDvezomVUgUdlUZ8ycW2rFHc=; b=vN10vg6VqB1xPD4TWGMdeo9L6rFcYuTbg8QnNrh52oxWDrrto0VDzNsEbtenGJFCqX Vylak1wyHRYV/lREFIstkZjlmBlPA/Yov0QziYvCttQo2n9MCkwIpKjIrg+Aeum2X4Dy 5zZMToYIX4Nrr1x72sf26ca+GKg5YMbutmPEjHrRf7ZqnoM7YoyezUJk328e9ui4UKQ9 Jt0qbB3h/OpgBzHvOGw2sG+P89xmtNPoUQ9Sm/XHdSyrPquPMoMJPlZoLc8BQwUaHeBB FcwiNuQHnF4m+MUzX+/UqTj0xt9Uf9L+C67sPjZiMY6MsvWGkoUxmFjXIKBkiJjagksP f8DQ== X-Received: by 10.68.198.36 with SMTP id iz4mr36141293pbc.109.1398056108941; Sun, 20 Apr 2014 21:55:08 -0700 (PDT) Received: from localhost.localdomain ([61.157.126.13]) by mx.google.com with ESMTPSA id gj9sm75124104pbc.7.2014.04.20.21.55.06 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Apr 2014 21:55:08 -0700 (PDT) From: "Zhao, Gang" To: Cc: Johannes Berg Subject: [PATCH 06/12] cfg80211: some workqueue improvements Date: Mon, 21 Apr 2014 12:53:01 +0800 Message-Id: <84aff9f5916be0f5cfaa4f145670d0ee06fcf4bf.1398055854.git.gamerh2o@gmail.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 Works rdev->rfkill_sync and rdev->sched_scan_results_wk are safely stopped when unregistering wiphy. Work reg_regdb_work is safely stopped in regulatory_exit(), if related config option is enabled. Queue work cfg80211_disconnect_work to workqueue cfg80211_wq, since it's a work owned by cfg80211, and so it can be safely stopped in destroy_workqueue(cfg80211_wq) in cfg80211_exit(). Change flush_work() to more robust cancel_work_sync(). Signed-off-by: Zhao, Gang --- net/wireless/core.c | 6 ++++-- net/wireless/reg.c | 4 ++++ net/wireless/sme.c | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/net/wireless/core.c b/net/wireless/core.c index 33d12e2..f7f71d9 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c @@ -711,9 +711,11 @@ void wiphy_unregister(struct wiphy *wiphy) rtnl_unlock(); - flush_work(&rdev->scan_done_wk); + cancel_work_sync(&rdev->rfkill_sync); + cancel_work_sync(&rdev->scan_done_wk); + cancel_work_sync(&rdev->sched_scan_results_wk); cancel_work_sync(&rdev->conn_work); - flush_work(&rdev->event_work); + cancel_work_sync(&rdev->event_work); cancel_delayed_work_sync(&rdev->dfs_update_channels_wk); flush_work(&rdev->destroy_work); diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 9d32633..45b61f0 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -2765,6 +2765,10 @@ void regulatory_exit(void) cancel_work_sync(®_work); cancel_delayed_work_sync(®_timeout); +#ifdef CONFIG_CFG80211_INTERNAL_REGDB + cancel_work_sync(®_regdb_work); +#endif + /* Lock to suppress warnings */ rtnl_lock(); reset_regdomains(true, NULL); diff --git a/net/wireless/sme.c b/net/wireless/sme.c index 998674f..0a96d67 100644 --- a/net/wireless/sme.c +++ b/net/wireless/sme.c @@ -872,7 +872,7 @@ void __cfg80211_disconnected(struct net_device *dev, const u8 *ie, wdev->wext.connect.ssid_len = 0; #endif - schedule_work(&cfg80211_disconnect_work); + queue_work(cfg80211_wq, &cfg80211_disconnect_work); } void cfg80211_disconnected(struct net_device *dev, u16 reason,