From patchwork Wed Feb 22 02:10:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 9586041 X-Patchwork-Delegate: luca@coelho.fi Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A994360431 for ; Wed, 22 Feb 2017 02:11:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E41128696 for ; Wed, 22 Feb 2017 02:11:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 832F82875D; Wed, 22 Feb 2017 02:11:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D8460286F0 for ; Wed, 22 Feb 2017 02:11:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754345AbdBVCKw (ORCPT ); Tue, 21 Feb 2017 21:10:52 -0500 Received: from mail.kernel.org ([198.145.29.136]:55652 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754250AbdBVCKq (ORCPT ); Tue, 21 Feb 2017 21:10:46 -0500 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2B485201C8; Wed, 22 Feb 2017 02:10:45 +0000 (UTC) Received: from garbanzo.do-not-panic.com (c-73-15-241-2.hsd1.ca.comcast.net [73.15.241.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D867A20256; Wed, 22 Feb 2017 02:10:43 +0000 (UTC) From: "Luis R. Rodriguez" To: johannes.berg@intel.com, luciano.coelho@intel.com, emmanuel.grumbach@intel.com Cc: ming.lei@canonical.com, zajec5@gmail.com, linuxwifi@intel.com, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, "Luis R. Rodriguez" Subject: [PATCH v2 2/2] iwlwifi: convert final opmode work into a workqueue Date: Tue, 21 Feb 2017 18:10:39 -0800 Message-Id: <20170222021039.28193-3-mcgrof@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170222021039.28193-1-mcgrof@kernel.org> References: <20170222001822.GE31264@wotan.suse.de> <20170222021039.28193-1-mcgrof@kernel.org> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This lets us offload and share all the final opmode related work necessary for either an opmode driver or new device. This has the most impact for opmode drivers as this now offloads opmode start for each device onto the workqueue. Signed-off-by: Luis R. Rodriguez --- drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c index ea88b5cec869..1db372e9c039 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c @@ -143,6 +143,8 @@ static struct iwlwifi_opmode_table { [DVM_OP_MODE] = { .name = "iwldvm", .ops = NULL }, [MVM_OP_MODE] = { .name = "iwlmvm", .ops = NULL }, }; +static void iwlwifi_opmode_dowork(struct work_struct *work); +static DECLARE_WORK(iwlwifi_opmode_work, iwlwifi_opmode_dowork); #define IWL_DEFAULT_SCAN_CHANNELS 40 @@ -1261,7 +1263,7 @@ static void iwlwifi_opmode_start(struct iwlwifi_opmode_table *op) iwlwifi_opmode_start_drv(op, drv); } -static void iwlwifi_opmode_dowork(void) +static void iwlwifi_opmode_dowork(struct work_struct *unused_work) { unsigned int i; struct iwlwifi_opmode_table *op; @@ -1497,7 +1499,7 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) if (err) goto out_unbind; - iwlwifi_opmode_dowork(); + schedule_work(&iwlwifi_opmode_work); goto free; try_again: @@ -1581,6 +1583,7 @@ struct iwl_drv *iwl_drv_start(struct iwl_trans *trans) void iwl_drv_stop(struct iwl_drv *drv) { wait_for_completion(&drv->request_firmware_complete); + cancel_work_sync(&iwlwifi_opmode_work); _iwl_op_mode_stop(drv); @@ -1634,7 +1637,7 @@ int iwl_opmode_register(const char *name, const struct iwl_op_mode_ops *ops) mutex_unlock(&iwlwifi_opmode_table_mtx); if (!ret) - iwlwifi_opmode_dowork(); + schedule_work(&iwlwifi_opmode_work); return ret; }