/* * This function performs cleanup for adapter structure. * * The cleanup is done recursively, by canceling all pending * commands, freeing the member buffers previously allocated * (command buffers, scan table buffer, sleep confirm command * buffer), stopping the timers and calling the cleanup routines * for every interface. */ static void mwifiex_adapter_cleanup(struct mwifiex_adapter *adapter) { int idx; if (!adapter) { pr_err("%s: adapter is NULL\n", __func__); return; } mwifiex_cancel_all_pending_cmd(adapter); /* Free lock variables */ mwifiex_free_lock_list(adapter); /* Free command buffer */ dev_dbg(adapter->dev, "info: free cmd buffer\n"); mwifiex_free_cmd_buffer(adapter); for (idx = 0; idx < adapter->num_mem_types; idx++) { struct memory_type_mapping *entry = &adapter->mem_type_mapping_tbl[idx]; if (entry->mem_ptr) { vfree(entry->mem_ptr); entry->mem_ptr = NULL; } entry->mem_size = 0; } if (adapter->sleep_cfm) dev_kfree_skb_any(adapter->sleep_cfm); }
/* * This function frees the adapter structure. * * The freeing operation is done recursively, by canceling all * pending commands, freeing the member buffers previously * allocated (command buffers, scan table buffer, sleep confirm * command buffer), stopping the timers and calling the cleanup * routines for every interface, before the actual adapter * structure is freed. */ static void mwifiex_free_adapter(struct mwifiex_adapter *adapter) { if (!adapter) { pr_err("%s: adapter is NULL\n", __func__); return; } mwifiex_cancel_all_pending_cmd(adapter); /* Free lock variables */ mwifiex_free_lock_list(adapter); /* Free command buffer */ dev_dbg(adapter->dev, "info: free cmd buffer\n"); mwifiex_free_cmd_buffer(adapter); del_timer(&adapter->cmd_timer); dev_dbg(adapter->dev, "info: free scan table\n"); adapter->if_ops.cleanup_if(adapter); if (adapter->sleep_cfm) dev_kfree_skb_any(adapter->sleep_cfm); }
/* * This function performs cleanup for adapter structure. * * The cleanup is done recursively, by canceling all pending * commands, freeing the member buffers previously allocated * (command buffers, scan table buffer, sleep confirm command * buffer), stopping the timers and calling the cleanup routines * for every interface. */ static void mwifiex_adapter_cleanup(struct mwifiex_adapter *adapter) { int idx; if (!adapter) { pr_err("%s: adapter is NULL\n", __func__); return; } del_timer(&adapter->wakeup_timer); mwifiex_cancel_all_pending_cmd(adapter); wake_up_interruptible(&adapter->cmd_wait_q.wait); wake_up_interruptible(&adapter->hs_activate_wait_q); /* Free lock variables */ mwifiex_free_lock_list(adapter); /* Free command buffer */ mwifiex_dbg(adapter, INFO, "info: free cmd buffer\n"); mwifiex_free_cmd_buffer(adapter); for (idx = 0; idx < adapter->num_mem_types; idx++) { struct memory_type_mapping *entry = &adapter->mem_type_mapping_tbl[idx]; if (entry->mem_ptr) { vfree(entry->mem_ptr); entry->mem_ptr = NULL; } entry->mem_size = 0; } if (adapter->drv_info_dump) { vfree(adapter->drv_info_dump); adapter->drv_info_dump = NULL; adapter->drv_info_size = 0; } if (adapter->sleep_cfm) dev_kfree_skb_any(adapter->sleep_cfm); }