iwlwifi: pcie: some little cleanups
authorEliad Peller <eliad@wizery.com>
Tue, 16 Jul 2013 14:53:43 +0000 (17:53 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 6 Aug 2013 08:34:11 +0000 (10:34 +0200)
do some little cleanups in tx.c - eliminate duplicate checks,
use locally cached fields and predefined macros.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/iwlwifi/pcie/tx.c

index f29cd5c..011167c 100644 (file)
@@ -451,13 +451,10 @@ static int iwl_pcie_txq_build_tfd(struct iwl_trans *trans, struct iwl_txq *txq,
                return -EINVAL;
        }
 
-       if (WARN_ON(addr & ~DMA_BIT_MASK(36)))
+       if (WARN(addr & ~IWL_TX_DMA_MASK,
+                "Unaligned address = %llx\n", (unsigned long long)addr))
                return -EINVAL;
 
-       if (unlikely(addr & ~IWL_TX_DMA_MASK))
-               IWL_ERR(trans, "Unaligned address = %llx\n",
-                       (unsigned long long)addr);
-
        iwl_pcie_tfd_set_tb(tfd, num_tbs, addr, len);
 
        return 0;
@@ -1631,7 +1628,7 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb,
         * Check here that the packets are in the right place on the ring.
         */
        wifi_seq = IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl));
-       WARN_ONCE(trans_pcie->txq[txq_id].ampdu &&
+       WARN_ONCE(txq->ampdu &&
                  (wifi_seq & 0xff) != q->write_ptr,
                  "Q: %d WiFi Seq %d tfdNum %d",
                  txq_id, wifi_seq, q->write_ptr);
@@ -1663,7 +1660,7 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb,
         */
        len = sizeof(struct iwl_tx_cmd) + sizeof(struct iwl_cmd_header) +
              hdr_len - IWL_HCMD_SCRATCHBUF_SIZE;
-       tb1_len = (len + 3) & ~3;
+       tb1_len = ALIGN(len, 4);
 
        /* Tell NIC about any 2-byte padding after MAC header */
        if (tb1_len != len)