From patchwork Wed Nov 16 13:09:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitkumar Karwar X-Patchwork-Id: 9431491 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 D7AD46047D for ; Wed, 16 Nov 2016 13:10:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC6CB28584 for ; Wed, 16 Nov 2016 13:10:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BEC11285D4; Wed, 16 Nov 2016 13:10:24 +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 A19F5285D5 for ; Wed, 16 Nov 2016 13:10:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932119AbcKPNKV (ORCPT ); Wed, 16 Nov 2016 08:10:21 -0500 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:42739 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750998AbcKPNKU (ORCPT ); Wed, 16 Nov 2016 08:10:20 -0500 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uAGDAAmJ015859; Wed, 16 Nov 2016 05:10:17 -0800 Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 26rr3mr00x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 16 Nov 2016 05:10:17 -0800 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1104.5; Wed, 16 Nov 2016 05:10:16 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server id 15.0.1104.5 via Frontend Transport; Wed, 16 Nov 2016 05:10:16 -0800 Received: from pe-lt949 (unknown [10.31.130.253]) by maili.marvell.com (Postfix) with ESMTP id B40CD3F7040; Wed, 16 Nov 2016 05:10:15 -0800 (PST) Received: from pe-lt949 (piotr-probook.localdomain [127.0.0.1]) by pe-lt949 (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id uAGDA1EI014849; Wed, 16 Nov 2016 18:40:01 +0530 Received: (from root@localhost) by pe-lt949 (8.14.4/8.14.4/Submit) id uAGDA0C0014847; Wed, 16 Nov 2016 18:40:00 +0530 From: Amitkumar Karwar To: CC: Cathy Luo , Nishant Sarmukadam , , , , Xinming Hu , Amitkumar Karwar Subject: [PATCH v3 4/5] mwifiex: wait firmware dump complete during card remove process Date: Wed, 16 Nov 2016 18:39:08 +0530 Message-ID: <1479301749-14803-4-git-send-email-akarwar@marvell.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1479301749-14803-1-git-send-email-akarwar@marvell.com> References: <1479301749-14803-1-git-send-email-akarwar@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-11-16_06:, , signatures=0 X-Proofpoint-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611160214 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: Xinming Hu Wait for firmware dump complete in card remove function. For sdio interface, there are two diffenrent cases, card reset trigger sdio_work and firmware dump trigger sdio_work. Do code rearrangement for distinguish between these two cases. Signed-off-by: Xinming Hu Signed-off-by: Amitkumar Karwar Reviewed-by: Brian Norris --- v2: 1. Get rid of reset_triggered flag. Instead split the code and use __mwifiex_sdio_remove() (Brian Norris/Dmitry Torokhov) 2. "v1 4/5 mwifiex: firmware dump code rearrangement.." is dropped. So rebased accordingly. v3: same as [v2,5/5]. The improvement of 'moving pcie_work to card struct' suggested by Brian is taken care in next patch. --- drivers/net/wireless/marvell/mwifiex/pcie.c | 6 +++++- drivers/net/wireless/marvell/mwifiex/sdio.c | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c index dd8f7aa..c8e69a4 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -51,6 +51,9 @@ static int mwifiex_pcie_probe_of(struct device *dev) return 0; } +static void mwifiex_pcie_work(struct work_struct *work); +static DECLARE_WORK(pcie_work, mwifiex_pcie_work); + static int mwifiex_map_pci_memory(struct mwifiex_adapter *adapter, struct sk_buff *skb, size_t size, int flags) @@ -254,6 +257,8 @@ static void mwifiex_pcie_remove(struct pci_dev *pdev) if (!adapter || !adapter->priv_num) return; + cancel_work_sync(&pcie_work); + if (user_rmmod && !adapter->mfg_mode) { mwifiex_deauthenticate_all(adapter); @@ -2722,7 +2727,6 @@ static void mwifiex_pcie_work(struct work_struct *work) mwifiex_pcie_device_dump_work(save_adapter); } -static DECLARE_WORK(pcie_work, mwifiex_pcie_work); /* This function dumps FW information */ static void mwifiex_pcie_device_dump(struct mwifiex_adapter *adapter) { diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c index 16d1d30..78f2cc9 100644 --- a/drivers/net/wireless/marvell/mwifiex/sdio.c +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c @@ -46,6 +46,9 @@ */ static u8 user_rmmod; +static void mwifiex_sdio_work(struct work_struct *work); +static DECLARE_WORK(sdio_work, mwifiex_sdio_work); + static struct mwifiex_if_ops sdio_ops; static unsigned long iface_work_flags; @@ -220,7 +223,7 @@ static int mwifiex_sdio_resume(struct device *dev) * This function removes the interface and frees up the card structure. */ static void -mwifiex_sdio_remove(struct sdio_func *func) +__mwifiex_sdio_remove(struct sdio_func *func) { struct sdio_mmc_card *card; struct mwifiex_adapter *adapter; @@ -249,6 +252,13 @@ static int mwifiex_sdio_resume(struct device *dev) mwifiex_remove_card(adapter); } +static void +mwifiex_sdio_remove(struct sdio_func *func) +{ + cancel_work_sync(&sdio_work); + __mwifiex_sdio_remove(func); +} + /* * SDIO suspend. * @@ -2227,7 +2237,7 @@ static void mwifiex_recreate_adapter(struct sdio_mmc_card *card) * discovered and initializes them from scratch. */ - mwifiex_sdio_remove(func); + __mwifiex_sdio_remove(func); /* * Normally, we would let the driver core take care of releasing these. @@ -2568,7 +2578,6 @@ static void mwifiex_sdio_work(struct work_struct *work) mwifiex_sdio_card_reset_work(save_adapter); } -static DECLARE_WORK(sdio_work, mwifiex_sdio_work); /* This function resets the card */ static void mwifiex_sdio_card_reset(struct mwifiex_adapter *adapter) {