mwifiex: fix link error against sdio
authorArnd Bergmann <arnd@arndb.de>
Thu, 16 Jun 2016 09:01:10 +0000 (11:01 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Sat, 18 Jun 2016 13:36:00 +0000 (16:36 +0300)
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 <arnd@arndb.de>
Fixes: 65c71efe1c59 ("mwifiex: fix racing condition when downloading firmware")
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/marvell/mwifiex/init.c
drivers/net/wireless/marvell/mwifiex/main.c
drivers/net/wireless/marvell/mwifiex/sdio.c

index 78c532f0d286b249e9c0dd6e269351e83ad41128..a6d86d4ccd224b87757e646bf8354488dd7e1919 100644 (file)
@@ -788,3 +788,4 @@ poll_fw:
 
        return ret;
 }
+EXPORT_SYMBOL_GPL(mwifiex_dnld_fw);
index 2b65334235cabda5f9e4ac67286cc104c4ab2fb6..0e280f879b58c3d2ba73b3fdae715be04807465b 100644 (file)
@@ -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)
index 3a2267aeffb926704da5d7f9e85f6a6cee5b9342..d3e1561ca07508e5d35b71388a89dd40a5286622 100644 (file)
@@ -554,6 +554,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.
@@ -2742,6 +2755,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,
This page took 0.028881 seconds and 5 git commands to generate.