iwlwifi: make iwl_tx_queue->tfds void*
authorSamuel Ortiz <samuel.ortiz@intel.com>
Fri, 23 Jan 2009 21:45:13 +0000 (13:45 -0800)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 29 Jan 2009 21:01:33 +0000 (16:01 -0500)
Instead of having both tfds and tfds39, we can just have a void *tfds.
It makes the tx_queue structure nicer, and the code cleaner. It also helps
with further TX queues management code merging.

Signed-off-by: Samuel Ortiz <samuel.ortiz@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-3945.c
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-dev.h
drivers/net/wireless/iwlwifi/iwl-tx.c
drivers/net/wireless/iwlwifi/iwl3945-base.c

index 602a3a91568497ba52a24b2171d1ec7bf5beb1cb..22770f44c2faae69ffd1dbfb86bd210bae28f07d 100644 (file)
@@ -730,10 +730,11 @@ int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv,
 {
        int count;
        struct iwl_queue *q;
-       struct iwl3945_tfd *tfd;
+       struct iwl3945_tfd *tfd, *tfd_tmp;
 
        q = &txq->q;
-       tfd = &txq->tfds39[q->write_ptr];
+       tfd_tmp = (struct iwl3945_tfd *)txq->tfds;
+       tfd = &tfd_tmp[q->write_ptr];
 
        if (reset)
                memset(tfd, 0, sizeof(*tfd));
@@ -764,7 +765,7 @@ int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv,
  */
 void iwl3945_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq)
 {
-       struct iwl3945_tfd *tfd_tmp = (struct iwl3945_tfd *)&txq->tfds39[0];
+       struct iwl3945_tfd *tfd_tmp = (struct iwl3945_tfd *)txq->tfds;
        struct iwl3945_tfd *tfd = &tfd_tmp[txq->q.read_ptr];
        struct pci_dev *dev = priv->pci_dev;
        int i;
index 61788a5089712a8d5966b91c05ef8d2c73dcac90..4ce3d6a63d18bed3df3e3822db1e12d0737feded 100644 (file)
@@ -520,7 +520,7 @@ static inline u8 iwl_tfd_get_num_tbs(struct iwl_tfd *tfd)
  */
 void iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq)
 {
-       struct iwl_tfd *tfd_tmp = (struct iwl_tfd *)&txq->tfds[0];
+       struct iwl_tfd *tfd_tmp = (struct iwl_tfd *)txq->tfds;
        struct iwl_tfd *tfd;
        struct pci_dev *dev = priv->pci_dev;
        int index = txq->q.read_ptr;
@@ -563,11 +563,12 @@ int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv,
                                 u8 reset, u8 pad)
 {
        struct iwl_queue *q;
-       struct iwl_tfd *tfd;
+       struct iwl_tfd *tfd, *tfd_tmp;
        u32 num_tbs;
 
        q = &txq->q;
-       tfd = &txq->tfds[q->write_ptr];
+       tfd_tmp = (struct iwl_tfd *)txq->tfds;
+       tfd = &tfd_tmp[q->write_ptr];
 
        if (reset)
                memset(tfd, 0, sizeof(*tfd));
index 79f2d45a9fce6bbf25960b76dd52651b2d04c811..78ce4f49c5688d5d2efeffa26289e7aa66fec5eb 100644 (file)
@@ -149,8 +149,7 @@ struct iwl_tx_info {
 
 struct iwl_tx_queue {
        struct iwl_queue q;
-       struct iwl_tfd *tfds;
-       struct iwl3945_tfd *tfds39;
+       void *tfds;
        struct iwl_cmd *cmd[TFD_TX_CMD_SLOTS];
        struct iwl_tx_info *txb;
        u8 need_update;
index 1a2cfbebb17b945212e0a0419b0712caadc916fa..83e9f32cbd8e63c411fa3985dac9640c809c8924 100644 (file)
@@ -295,12 +295,12 @@ static int iwl_tx_queue_alloc(struct iwl_priv *priv,
        /* Circular buffer of transmit frame descriptors (TFDs),
         * shared with device */
        txq->tfds = pci_alloc_consistent(dev,
-                       sizeof(txq->tfds[0]) * TFD_QUEUE_SIZE_MAX,
+                       sizeof(struct iwl_tfd) * TFD_QUEUE_SIZE_MAX,
                        &txq->q.dma_addr);
 
        if (!txq->tfds) {
                IWL_ERR(priv, "pci_alloc_consistent(%zd) failed\n",
-                         sizeof(txq->tfds[0]) * TFD_QUEUE_SIZE_MAX);
+                         sizeof(struct iwl_tfd) * TFD_QUEUE_SIZE_MAX);
                goto error;
        }
        txq->q.id = id;
index c7bb9c19a902dcfff1ad9b86c27f5b4cb5016981..bc10e2ae597d1adca0d1eec81145c24a0c079719 100644 (file)
@@ -172,13 +172,13 @@ static int iwl3945_tx_queue_alloc(struct iwl_priv *priv,
 
        /* Circular buffer of transmit frame descriptors (TFDs),
         * shared with device */
-       txq->tfds39 = pci_alloc_consistent(dev,
-                       sizeof(txq->tfds39[0]) * TFD_QUEUE_SIZE_MAX,
-                       &txq->q.dma_addr);
+       txq->tfds = pci_alloc_consistent(dev,
+                               sizeof(struct iwl3945_tfd) * TFD_QUEUE_SIZE_MAX,
+                               &txq->q.dma_addr);
 
-       if (!txq->tfds39) {
+       if (!txq->tfds) {
                IWL_ERR(priv, "pci_alloc_consistent(%zd) failed\n",
-                         sizeof(txq->tfds39[0]) * TFD_QUEUE_SIZE_MAX);
+                         sizeof(struct iwl3945_tfd) * TFD_QUEUE_SIZE_MAX);
                goto error;
        }
        txq->q.id = id;
@@ -287,7 +287,7 @@ void iwl3945_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq)
        /* De-alloc circular buffer of TFDs */
        if (txq->q.n_bd)
                pci_free_consistent(dev, sizeof(struct iwl3945_tfd) *
-                                   txq->q.n_bd, txq->tfds39, txq->q.dma_addr);
+                                   txq->q.n_bd, txq->tfds, txq->q.dma_addr);
 
        /* De-alloc array of per-TFD driver data */
        kfree(txq->txb);