/* Empty queue by removing and destroying all BD's. Free all buffers. 0-fill, but do not free "txq" descriptor structure.  */
void iwl_cmd_queue_free(struct iwl_priv *priv)
/* Empty queue by removing and destroying all BD's. Free all buffers. 0-fill, but do not free "txq" descriptor structure.  */
void iwl_cmd_queue_free(struct iwl_priv *priv)
{
	struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM];
	struct iwl_queue *q = &txq->q;
	struct pci_dev *dev = priv->pci_dev;
	int i;
	if (q->n_bd == 0)
		return;
	for (i = 0; i <= TFD_CMD_SLOTS; i++)
		kfree(txq->cmd[i]);
	if (txq->q.n_bd)
		pci_free_consistent(dev, priv->hw_params.tfd_size *
				    txq->q.n_bd, txq->tfds, txq->q.dma_addr);
	kfree(txq->cmd);
	kfree(txq->meta);
	txq->cmd = NULL;
	txq->meta = NULL;
	memset(txq, 0, sizeof(*txq));
}