From patchwork Thu Jul 28 07:55:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 9250823 X-Patchwork-Delegate: kvalo@adurom.com 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 34DEF60869 for ; Thu, 28 Jul 2016 08:06:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 29F7226253 for ; Thu, 28 Jul 2016 08:06:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E06526D08; Thu, 28 Jul 2016 08:06:01 +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 846C126253 for ; Thu, 28 Jul 2016 08:06:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758505AbcG1IFw (ORCPT ); Thu, 28 Jul 2016 04:05:52 -0400 Received: from hotel311.server4you.de ([85.25.146.15]:52504 "EHLO hotel311.server4you.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754886AbcG1IFd (ORCPT ); Thu, 28 Jul 2016 04:05:33 -0400 Received: from hotel311.server4you.de (localhost [127.0.0.1]) by filter.mynetwork.local (Postfix) with ESMTP id 07D191941AAB; Thu, 28 Jul 2016 09:55:31 +0200 (CEST) Received: from localhost (unknown [212.118.206.70]) by hotel311.server4you.de (Postfix) with ESMTPSA id AE8431941A76; Thu, 28 Jul 2016 09:55:30 +0200 (CEST) From: Daniel Wagner To: Bastien Nocera , Bjorn Andersson , Dmitry Torokhov , Greg Kroah-Hartman , Johannes Berg , Kalle Valo , Ohad Ben-Cohen Cc: linux-input@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Daniel Wagner Subject: [RFC v0 8/8] iwl4965: use firmware_stat instead of completion Date: Thu, 28 Jul 2016 09:55:12 +0200 Message-Id: <1469692512-16863-9-git-send-email-wagi@monom.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1469692512-16863-1-git-send-email-wagi@monom.org> References: <1469692512-16863-1-git-send-email-wagi@monom.org> 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 From: Daniel Wagner Loading firmware is an operation many drivers implement in various ways around the completion API. And most of them do it almost in the same way. Let's reuse the firmware_stat API which is used also by the firmware_class loader. Apart of streamlining the firmware loading states we also document it slightly better. Signed-off-by: Daniel Wagner --- drivers/net/wireless/intel/iwlegacy/4965-mac.c | 8 ++++---- drivers/net/wireless/intel/iwlegacy/common.h | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/intel/iwlegacy/4965-mac.c b/drivers/net/wireless/intel/iwlegacy/4965-mac.c index a91d170..d5e5808 100644 --- a/drivers/net/wireless/intel/iwlegacy/4965-mac.c +++ b/drivers/net/wireless/intel/iwlegacy/4965-mac.c @@ -5005,7 +5005,7 @@ il4965_ucode_callback(const struct firmware *ucode_raw, void *context) /* We have our copies now, allow OS release its copies */ release_firmware(ucode_raw); - complete(&il->_4965.firmware_loading_complete); + fw_loading_done(il->_4965.fw_st); return; try_again: @@ -5019,7 +5019,7 @@ err_pci_alloc: IL_ERR("failed to allocate pci memory\n"); il4965_dealloc_ucode_pci(il); out_unbind: - complete(&il->_4965.firmware_loading_complete); + fw_loading_done(il->_4965.fw_st); device_release_driver(&il->pci_dev->dev); release_firmware(ucode_raw); } @@ -6678,7 +6678,7 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) il_power_initialize(il); - init_completion(&il->_4965.firmware_loading_complete); + firmware_stat_init(&il->_4965.fw_st); err = il4965_request_firmware(il, true); if (err) @@ -6716,7 +6716,7 @@ il4965_pci_remove(struct pci_dev *pdev) if (!il) return; - wait_for_completion(&il->_4965.firmware_loading_complete); + fw_loading_wait(il->_4965.fw_st); D_INFO("*** UNLOAD DRIVER ***\n"); diff --git a/drivers/net/wireless/intel/iwlegacy/common.h b/drivers/net/wireless/intel/iwlegacy/common.h index 726ede3..94af7b7 100644 --- a/drivers/net/wireless/intel/iwlegacy/common.h +++ b/drivers/net/wireless/intel/iwlegacy/common.h @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -1357,7 +1358,7 @@ struct il_priv { bool last_phy_res_valid; u32 ampdu_ref; - struct completion firmware_loading_complete; + struct firmware_stat fw_st; /* * chain noise reset and gain commands are the