From patchwork Fri Feb 17 02:09:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 9578617 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 3D1256049F for ; Fri, 17 Feb 2017 02:10:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F0D5285FF for ; Fri, 17 Feb 2017 02:10:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2402428683; Fri, 17 Feb 2017 02:10:17 +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=unavailable 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 D5516285FF for ; Fri, 17 Feb 2017 02:10:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932218AbdBQCJh (ORCPT ); Thu, 16 Feb 2017 21:09:37 -0500 Received: from mail.kernel.org ([198.145.29.136]:48428 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932145AbdBQCJf (ORCPT ); Thu, 16 Feb 2017 21:09:35 -0500 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2EBF0201F2; Fri, 17 Feb 2017 02:09:34 +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 C4E3020211; Fri, 17 Feb 2017 02:09:32 +0000 (UTC) From: "Luis R. Rodriguez" To: johannes.berg@intel.com, luciano.coelho@intel.com, emmanuel.grumbach@intel.com, tj@kernel.org, arjan@linux.intel.com, ming.lei@canonical.com, zajec5@gmail.com Cc: jeyu@redhat.com, rusty@rustcorp.com.au, pmladek@suse.com, gregkh@linuxfoundation.org, linuxwifi@intel.com, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, "Luis R. Rodriguez" Subject: [RFC 5/5] iwlwifi: convert final opmode work into a workqueue Date: Thu, 16 Feb 2017 18:09:03 -0800 Message-Id: <20170217020903.6370-6-mcgrof@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170217020903.6370-1-mcgrof@kernel.org> References: <20170217020903.6370-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 6cfbc3c6e0d6..d39a5c73afdc 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c @@ -145,6 +145,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 @@ -1291,7 +1293,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; @@ -1530,7 +1532,7 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) mutex_unlock(&iwlwifi_opmode_table_mtx); - iwlwifi_opmode_dowork(); + schedule_work(&iwlwifi_opmode_work); goto free; try_again: @@ -1614,6 +1616,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); @@ -1667,7 +1670,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; }