Commit cc75c577 authored by Xinming Hu's avatar Xinming Hu Committed by Kalle Valo

mwifiex: get rid of global save_adapter and sdio_work

This patch moves sdio_work to card structure, in this way we can get
adapter structure in the work, so save_adapter won't be needed.
Signed-off-by: default avatarXinming Hu <huxm@marvell.com>
Signed-off-by: default avatarAmitkumar Karwar <akarwar@marvell.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent a7513a4f
...@@ -32,10 +32,8 @@ ...@@ -32,10 +32,8 @@
#define SDIO_VERSION "1.0" #define SDIO_VERSION "1.0"
static void mwifiex_sdio_work(struct work_struct *work); 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 struct mwifiex_if_ops sdio_ops;
static unsigned long iface_work_flags;
static struct memory_type_mapping generic_mem_type_map[] = { static struct memory_type_mapping generic_mem_type_map[] = {
{"DUMP", NULL, 0, 0xDD}, {"DUMP", NULL, 0, 0xDD},
...@@ -123,6 +121,7 @@ mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) ...@@ -123,6 +121,7 @@ mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
card->fw_dump_enh = data->fw_dump_enh; card->fw_dump_enh = data->fw_dump_enh;
card->can_auto_tdls = data->can_auto_tdls; card->can_auto_tdls = data->can_auto_tdls;
card->can_ext_scan = data->can_ext_scan; card->can_ext_scan = data->can_ext_scan;
INIT_WORK(&card->work, mwifiex_sdio_work);
} }
sdio_claim_host(func); sdio_claim_host(func);
...@@ -388,7 +387,7 @@ mwifiex_sdio_remove(struct sdio_func *func) ...@@ -388,7 +387,7 @@ mwifiex_sdio_remove(struct sdio_func *func)
if (!adapter || !adapter->priv_num) if (!adapter || !adapter->priv_num)
return; return;
cancel_work_sync(&sdio_work); cancel_work_sync(&card->work);
mwifiex_dbg(adapter, INFO, "info: SDIO func num=%d\n", func->num); mwifiex_dbg(adapter, INFO, "info: SDIO func num=%d\n", func->num);
...@@ -2190,7 +2189,6 @@ mwifiex_update_mp_end_port(struct mwifiex_adapter *adapter, u16 port) ...@@ -2190,7 +2189,6 @@ mwifiex_update_mp_end_port(struct mwifiex_adapter *adapter, u16 port)
port, card->mp_data_port_mask); port, card->mp_data_port_mask);
} }
static struct mwifiex_adapter *save_adapter;
static void mwifiex_sdio_card_reset_work(struct mwifiex_adapter *adapter) static void mwifiex_sdio_card_reset_work(struct mwifiex_adapter *adapter)
{ {
struct sdio_mmc_card *card = adapter->card; struct sdio_mmc_card *card = adapter->card;
...@@ -2206,8 +2204,8 @@ static void mwifiex_sdio_card_reset_work(struct mwifiex_adapter *adapter) ...@@ -2206,8 +2204,8 @@ static void mwifiex_sdio_card_reset_work(struct mwifiex_adapter *adapter)
/* Previous save_adapter won't be valid after this. We will cancel /* Previous save_adapter won't be valid after this. We will cancel
* pending work requests. * pending work requests.
*/ */
clear_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, &iface_work_flags); clear_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, &card->work_flags);
clear_bit(MWIFIEX_IFACE_WORK_CARD_RESET, &iface_work_flags); clear_bit(MWIFIEX_IFACE_WORK_CARD_RESET, &card->work_flags);
mwifiex_reinit_sw(adapter); mwifiex_reinit_sw(adapter);
} }
...@@ -2513,35 +2511,40 @@ static void mwifiex_sdio_device_dump_work(struct mwifiex_adapter *adapter) ...@@ -2513,35 +2511,40 @@ static void mwifiex_sdio_device_dump_work(struct mwifiex_adapter *adapter)
static void mwifiex_sdio_work(struct work_struct *work) static void mwifiex_sdio_work(struct work_struct *work)
{ {
struct sdio_mmc_card *card =
container_of(work, struct sdio_mmc_card, work);
if (test_and_clear_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, if (test_and_clear_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP,
&iface_work_flags)) &card->work_flags))
mwifiex_sdio_device_dump_work(save_adapter); mwifiex_sdio_device_dump_work(card->adapter);
if (test_and_clear_bit(MWIFIEX_IFACE_WORK_CARD_RESET, if (test_and_clear_bit(MWIFIEX_IFACE_WORK_CARD_RESET,
&iface_work_flags)) &card->work_flags))
mwifiex_sdio_card_reset_work(save_adapter); mwifiex_sdio_card_reset_work(card->adapter);
} }
/* This function resets the card */ /* This function resets the card */
static void mwifiex_sdio_card_reset(struct mwifiex_adapter *adapter) static void mwifiex_sdio_card_reset(struct mwifiex_adapter *adapter)
{ {
save_adapter = adapter; struct sdio_mmc_card *card = adapter->card;
if (test_bit(MWIFIEX_IFACE_WORK_CARD_RESET, &iface_work_flags))
if (test_bit(MWIFIEX_IFACE_WORK_CARD_RESET, &card->work_flags))
return; return;
set_bit(MWIFIEX_IFACE_WORK_CARD_RESET, &iface_work_flags); set_bit(MWIFIEX_IFACE_WORK_CARD_RESET, &card->work_flags);
schedule_work(&sdio_work); schedule_work(&card->work);
} }
/* This function dumps FW information */ /* This function dumps FW information */
static void mwifiex_sdio_device_dump(struct mwifiex_adapter *adapter) static void mwifiex_sdio_device_dump(struct mwifiex_adapter *adapter)
{ {
save_adapter = adapter; struct sdio_mmc_card *card = adapter->card;
if (test_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, &iface_work_flags))
if (test_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, &card->work_flags))
return; return;
set_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, &iface_work_flags); set_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, &card->work_flags);
schedule_work(&sdio_work); schedule_work(&card->work);
} }
/* Function to dump SDIO function registers and SDIO scratch registers in case /* Function to dump SDIO function registers and SDIO scratch registers in case
......
...@@ -267,6 +267,9 @@ struct sdio_mmc_card { ...@@ -267,6 +267,9 @@ struct sdio_mmc_card {
struct mwifiex_sdio_mpa_tx mpa_tx; struct mwifiex_sdio_mpa_tx mpa_tx;
struct mwifiex_sdio_mpa_rx mpa_rx; struct mwifiex_sdio_mpa_rx mpa_rx;
struct work_struct work;
unsigned long work_flags;
}; };
struct mwifiex_sdio_device { struct mwifiex_sdio_device {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment