drivers/net/wireless/marvell/mwifiex/init.c

Source file repositories/reference/linux-study-clean/drivers/net/wireless/marvell/mwifiex/init.c

File Facts

System
Linux kernel
Corpus path
drivers/net/wireless/marvell/mwifiex/init.c
Extension
.c
Size
20000 bytes
Lines
719
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (bssprio_node->priv == priv) {
					mwifiex_dbg(adapter, INFO,
						    "info: Delete\t"
						    "node %p, next = %p\n",
						    bssprio_node, tmp_node);
					list_del(&bssprio_node->list);
					kfree(bssprio_node);
				}
			}
			spin_unlock_bh(lock);
		}
	}
}

/*
 * This function frees the private structure, including cleans
 * up the TX and RX queues and frees the BSS priority tables.
 */
void mwifiex_free_priv(struct mwifiex_private *priv)
{
	mwifiex_clean_txrx(priv);
	mwifiex_delete_bss_prio_tbl(priv);
	mwifiex_free_curr_bcn(priv);
}

/*
 * This function is used to shutdown the driver.
 *
 * The following operations are performed sequentially -
 *      - Check if already shut down
 *      - Make sure the main process has stopped
 *      - Clean up the Tx and Rx queues
 *      - Delete BSS priority tables
 *      - Free the adapter
 *      - Notify completion
 */
void
mwifiex_shutdown_drv(struct mwifiex_adapter *adapter)
{
	struct mwifiex_private *priv;
	s32 i;
	struct sk_buff *skb;

	/* mwifiex already shutdown */
	if (adapter->hw_status == MWIFIEX_HW_STATUS_NOT_READY)
		return;

	/* cancel current command */
	if (adapter->curr_cmd) {
		mwifiex_dbg(adapter, WARN,
			    "curr_cmd is still in processing\n");
		timer_delete_sync(&adapter->cmd_timer);
		mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd);
		adapter->curr_cmd = NULL;
	}

	/* shut down mwifiex */
	mwifiex_dbg(adapter, MSG,
		    "info: shutdown mwifiex...\n");

	/* Clean up Tx/Rx queues and delete BSS priority table */
	for (i = 0; i < adapter->priv_num; i++) {
		priv = adapter->priv[i];

		mwifiex_clean_auto_tdls(priv);
		mwifiex_abort_cac(priv);
		mwifiex_free_priv(priv);
	}

	atomic_set(&adapter->tx_queued, 0);
	while ((skb = skb_dequeue(&adapter->tx_data_q)))
		mwifiex_write_data_complete(adapter, skb, 0, 0);

	spin_lock_bh(&adapter->rx_proc_lock);

	while ((skb = skb_dequeue(&adapter->rx_data_q))) {
		struct mwifiex_rxinfo *rx_info = MWIFIEX_SKB_RXCB(skb);

		atomic_dec(&adapter->rx_pending);
		priv = adapter->priv[rx_info->bss_num];
		if (priv)
			priv->stats.rx_dropped++;

		dev_kfree_skb_any(skb);
	}

	spin_unlock_bh(&adapter->rx_proc_lock);

	mwifiex_adapter_cleanup(adapter);

Annotation

Implementation Notes