From patchwork Wed Feb 12 19:04:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugene Krasnikov X-Patchwork-Id: 3640041 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2F5ED9F35F for ; Wed, 12 Feb 2014 19:05:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 53BD120203 for ; Wed, 12 Feb 2014 19:05:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6BDB820165 for ; Wed, 12 Feb 2014 19:05:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753352AbaBLTFG (ORCPT ); Wed, 12 Feb 2014 14:05:06 -0500 Received: from mail-we0-f174.google.com ([74.125.82.174]:59387 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752904AbaBLTFE (ORCPT ); Wed, 12 Feb 2014 14:05:04 -0500 Received: by mail-we0-f174.google.com with SMTP id w61so722106wes.5 for ; Wed, 12 Feb 2014 11:05:03 -0800 (PST) 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; bh=gK7cIjhyh0Zr4Iq8D6X33F7TLav8mN2f6X1MPxu+ytg=; b=XLJD8Lt+d6BpcxnUhg2fJlGRKzokgAcwwVovoVGHTF/IdHNBBp+3CejzpIWGKDsovA dSKtgsJ/AxlHmpFF4Xx9u7YTgKwOXwuDZ1jaoX2q8SRFhvb9pQfrHhmhfQEH3PmKPRBH bsta5bVTgog24tbFbONpUUBqkQAm09ryp2c77FjLnTVJ7bxkTh/fz7s90cYzbSUG6173 BNjaV/uIIkJpESG4b/j/6W7ZFXo+TF0ey73efIMcDvj7sRov+2L9K3Vv8ZV1EfrQslvi P6nbZX3Ji9rnhCqQYAhDrwBlm8otFpivV3ayPRj73PsNYmz3tawXskRRSEN0Z+48PPax DvEA== X-Received: by 10.180.9.51 with SMTP id w19mr3282662wia.27.1392231903048; Wed, 12 Feb 2014 11:05:03 -0800 (PST) Received: from localhost.localdomain (cpc64773-cmbg15-2-0-cust171.5-4.cable.virginmedia.com. [86.9.84.172]) by mx.google.com with ESMTPSA id fm3sm7876900wib.8.2014.02.12.11.05.01 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 12 Feb 2014 11:05:02 -0800 (PST) From: Eugene Krasnikov To: linville@tuxdriver.com Cc: linux-wireless@vger.kernel.org, Pontus Fuchs Subject: [PATCH 4/9] Cache nv to avoid request_firmware on resume path Date: Wed, 12 Feb 2014 19:04:43 +0000 Message-Id: <1392231888-2191-4-git-send-email-k.eugene.e@gmail.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1392231888-2191-1-git-send-email-k.eugene.e@gmail.com> References: <1392231888-2191-1-git-send-email-k.eugene.e@gmail.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=-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 From: Pontus Fuchs If wowlan if off mac80211 will stop / start the driver on suspend / resume. This causes problems on resume since request_firmware is called from start. Fix this by caching the nv. Signed-off-by: Pontus Fuchs --- drivers/net/wireless/ath/wcn36xx/main.c | 2 ++ drivers/net/wireless/ath/wcn36xx/smd.c | 22 ++++++++++------------ drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 2 ++ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index e64a678..a801aaa 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -17,6 +17,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include +#include #include #include "wcn36xx.h" @@ -992,6 +993,7 @@ static int wcn36xx_remove(struct platform_device *pdev) struct wcn36xx *wcn = hw->priv; wcn36xx_dbg(WCN36XX_DBG_MAC, "platform remove\n"); + release_firmware(wcn->nv); mutex_destroy(&wcn->hal_mutex); ieee80211_unregister_hw(hw); diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index ad93cc7..d5e90c4 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -251,21 +251,22 @@ static int wcn36xx_smd_rsp_status_check(void *buf, size_t len) int wcn36xx_smd_load_nv(struct wcn36xx *wcn) { - const struct firmware *nv; struct nv_data *nv_d; struct wcn36xx_hal_nv_img_download_req_msg msg_body; int fw_bytes_left; int ret; u16 fm_offset = 0; - ret = request_firmware(&nv, WLAN_NV_FILE, wcn->dev); - if (ret) { - wcn36xx_err("Failed to load nv file %s: %d\n", - WLAN_NV_FILE, ret); - goto out_free_nv; + if (!wcn->nv) { + ret = request_firmware(&wcn->nv, WLAN_NV_FILE, wcn->dev); + if (ret) { + wcn36xx_err("Failed to load nv file %s: %d\n", + WLAN_NV_FILE, ret); + goto out; + } } - nv_d = (struct nv_data *)nv->data; + nv_d = (struct nv_data *)wcn->nv->data; INIT_HAL_MSG(msg_body, WCN36XX_HAL_DOWNLOAD_NV_REQ); msg_body.header.len += WCN36XX_NV_FRAGMENT_SIZE; @@ -275,7 +276,7 @@ int wcn36xx_smd_load_nv(struct wcn36xx *wcn) mutex_lock(&wcn->hal_mutex); do { - fw_bytes_left = nv->size - fm_offset - 4; + fw_bytes_left = wcn->nv->size - fm_offset - 4; if (fw_bytes_left > WCN36XX_NV_FRAGMENT_SIZE) { msg_body.last_fragment = 0; msg_body.nv_img_buffer_size = WCN36XX_NV_FRAGMENT_SIZE; @@ -313,10 +314,7 @@ int wcn36xx_smd_load_nv(struct wcn36xx *wcn) out_unlock: mutex_unlock(&wcn->hal_mutex); -out_free_nv: - release_firmware(nv); - - return ret; +out: return ret; } static int wcn36xx_smd_start_rsp(struct wcn36xx *wcn, void *buf, size_t len) diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h index c5bd61c..0c5413f 100644 --- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h +++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h @@ -171,6 +171,8 @@ struct wcn36xx { struct device *dev; struct list_head vif_list; + const struct firmware *nv; + u8 fw_revision; u8 fw_version; u8 fw_minor;