From patchwork Thu Jun 16 09:01:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9180095 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 C06C560573 for ; Thu, 16 Jun 2016 09:01:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB3BB262F2 for ; Thu, 16 Jun 2016 09:01:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0159282FF; Thu, 16 Jun 2016 09:01: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 A5D04262F2 for ; Thu, 16 Jun 2016 09:01:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753826AbcFPJAl (ORCPT ); Thu, 16 Jun 2016 05:00:41 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:59788 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751323AbcFPJAi (ORCPT ); Thu, 16 Jun 2016 05:00:38 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue102) with ESMTPA (Nemesis) id 0MT92U-1anWJQ3Bgc-00S4hK; Thu, 16 Jun 2016 11:00:26 +0200 From: Arnd Bergmann To: Amitkumar Karwar , Nishant Sarmukadam , Kalle Valo Cc: Arnd Bergmann , Wei-Ning Huang , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] mwifiex: fix link error against sdio Date: Thu, 16 Jun 2016 11:01:10 +0200 Message-Id: <20160616090206.932870-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:y96xWLzgP+nVHeZf7kL2piaiia1wpMLwKyv/Du+pk4axEzDKjxg 5iPSipEj/tcRXpdoSZSbGVlUdTHbR6OZSsbJCE0txeHKwMPaghz2NnWbQC5UGg2CRWK4XLB plOQ0Ne+6tIojX1nOXNUkP+XWkJ34uQRRwdxUpB4qsFuxqmYDFkbtII3t6Jzxb6hZtVkVxM Vmp7JStjQiUMsa0NnDMLQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:LQBkDqwq3ZU=:0+CB+qNulJr1MAqoKFlLp4 HU2yxrjIvcETGhSIp9ZbCSEtTuFBc3HZgT0zlAJVB6if8E1EbjlAkJuKjx5wUNLOR6OJTIH5+ ncDObqsWLcl0BIF6NYKCWBwiXQXRLXY6ChCeqK0/B6urpfwSjaOFsCIMH8AHMYtDBadpyg23Q sgsqRW69QwVuoczIU7s0VQ9WUHqkA8yuH+vJp04eDjFjDmQTtl8WfX/59nqyEJbGLN+e7nEq+ cXLeBoA7p+7OREkDYCugb0/EsafZASDP7aK2iPTZ0mUD4/1laWBCQLphI8evraOaaCEVOzRH+ obhVwMEaKzQlUUK0u8joRB6Tz4tsisb1k8lzCgWg0cOLomzKdc6DSQat4zBb8c/bXjs3JvMaY h6EW0WUtJMm4E3rUoVWFjJVZH781JoJlo4erqIBY/pHF0n80+rFXzwCzjPyaRBBOdpPzqyhTL DhLZFLP2GgnrQ6LX0NeU4U9r3w7gGSI2rmC0Pn6zTE08al/Z4GFo/eFcw4vJI++7hsdmBqTP6 +JqkXOxesa3YZtdJ31JwSYjsmQURtQ8YBHVo9iQpJeKTyNk2d7SdSINAz8l+g8LjywgtyKc05 35xxeJW4OdvNyNsltZAxcIVJjUiYoWRPw1XZMvbAH9w0bG6SMRpD4px3tTySd39VzgZ7+t83i SsnYXX+/0tAUM55qtZMkf0Nrj 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 Calling sdio_claim_host() from the interface independent part of the mwifiex driver is not only a layering violation, but also causes a link error if MMC support is disabled, or if CONFIG_MMC=m and CONFIG_MWIFIEX=y: drivers/net/built-in.o: In function `mwifiex_fw_dpc': :(.text+0xff138): undefined reference to `sdio_claim_host' :(.text+0xff158): undefined reference to `sdio_release_host' The right way to do this is to have the sdio specific code in the sdio driver front-end, and we already have a callback pointer that we can use for this after exporting the generic fw download function from the core driver. Signed-off-by: Arnd Bergmann Fixes: 65c71efe1c59 ("mwifiex: fix racing condition when downloading firmware") --- drivers/net/wireless/marvell/mwifiex/init.c | 1 + drivers/net/wireless/marvell/mwifiex/main.c | 6 ------ drivers/net/wireless/marvell/mwifiex/sdio.c | 14 ++++++++++++++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/init.c b/drivers/net/wireless/marvell/mwifiex/init.c index 78c532f0d286..a6d86d4ccd22 100644 --- a/drivers/net/wireless/marvell/mwifiex/init.c +++ b/drivers/net/wireless/marvell/mwifiex/init.c @@ -788,3 +788,4 @@ poll_fw: return ret; } +EXPORT_SYMBOL_GPL(mwifiex_dnld_fw); diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c index 2b65334235ca..0e280f879b58 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.c +++ b/drivers/net/wireless/marvell/mwifiex/main.c @@ -21,7 +21,6 @@ #include "wmm.h" #include "cfg80211.h" #include "11n.h" -#include "sdio.h" #define VERSION "1.0" @@ -515,7 +514,6 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, void *context) struct semaphore *sem = adapter->card_sem; bool init_failed = false; struct wireless_dev *wdev; - struct sdio_mmc_card *card = adapter->card; if (!firmware) { mwifiex_dbg(adapter, ERROR, @@ -531,11 +529,7 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, void *context) if (adapter->if_ops.dnld_fw) { ret = adapter->if_ops.dnld_fw(adapter, &fw); } else { - if (adapter->iface_type == MWIFIEX_SDIO) - sdio_claim_host(card->func); ret = mwifiex_dnld_fw(adapter, &fw); - if (adapter->iface_type == MWIFIEX_SDIO) - sdio_release_host(card->func); } if (ret == -1) diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c index 674465e0d837..5f8a07e38d64 100644 --- a/drivers/net/wireless/marvell/mwifiex/sdio.c +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c @@ -544,6 +544,19 @@ static int mwifiex_pm_wakeup_card_complete(struct mwifiex_adapter *adapter) return mwifiex_write_reg(adapter, CONFIGURATION_REG, 0); } +static int mwifiex_sdio_dnld_fw(struct mwifiex_adapter *adapter, + struct mwifiex_fw_image *fw) +{ + struct sdio_mmc_card *card = adapter->card; + int ret; + + sdio_claim_host(card->func); + ret = mwifiex_dnld_fw(adapter, fw); + sdio_release_host(card->func); + + return ret; +} + /* * This function is used to initialize IO ports for the * chipsets supporting SDIO new mode eg SD8897. @@ -2732,6 +2745,7 @@ static struct mwifiex_if_ops sdio_ops = { .cleanup_mpa_buf = mwifiex_cleanup_mpa_buf, .cmdrsp_complete = mwifiex_sdio_cmdrsp_complete, .event_complete = mwifiex_sdio_event_complete, + .dnld_fw = mwifiex_sdio_dnld_fw, .card_reset = mwifiex_sdio_card_reset, .reg_dump = mwifiex_sdio_reg_dump, .device_dump = mwifiex_sdio_device_dump,