iwlwifi: pcie: gen2: minor code cleanups in byte table update
authorJohannes Berg <johannes.berg@intel.com>
Fri, 17 Apr 2020 10:21:40 +0000 (13:21 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Fri, 24 Apr 2020 13:38:09 +0000 (16:38 +0300)
One line should be indented less, otherwise it looks like it
belongs into the parentheses, which clearly it doesn't; also
some variables can move into their respective if branches.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200417131727.a4858aa0441b.I0e70e4a5493fe6b8db6390f9349ff0e7888ab240@changeid
drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c

index 86fc001..a30f6b0 100644 (file)
@@ -90,9 +90,7 @@ static void iwl_pcie_gen2_update_byte_tbl(struct iwl_trans_pcie *trans_pcie,
                                          struct iwl_txq *txq, u16 byte_cnt,
                                          int num_tbs)
 {
-       struct iwlagn_scd_bc_tbl *scd_bc_tbl = txq->bc_tbl.addr;
        struct iwl_trans *trans = iwl_trans_pcie_get_trans(trans_pcie);
-       struct iwl_gen3_bc_tbl *scd_bc_tbl_gen3 = txq->bc_tbl.addr;
        int idx = iwl_pcie_get_cmd_index(txq, txq->write_ptr);
        u8 filled_tfd_size, num_fetch_chunks;
        u16 len = byte_cnt;
@@ -102,7 +100,7 @@ static void iwl_pcie_gen2_update_byte_tbl(struct iwl_trans_pcie *trans_pcie,
                return;
 
        filled_tfd_size = offsetof(struct iwl_tfh_tfd, tbs) +
-                                  num_tbs * sizeof(struct iwl_tfh_tb);
+                         num_tbs * sizeof(struct iwl_tfh_tb);
        /*
         * filled_tfd_size contains the number of filled bytes in the TFD.
         * Dividing it by 64 will give the number of chunks to fetch
@@ -114,12 +112,16 @@ static void iwl_pcie_gen2_update_byte_tbl(struct iwl_trans_pcie *trans_pcie,
        num_fetch_chunks = DIV_ROUND_UP(filled_tfd_size, 64) - 1;
 
        if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) {
+               struct iwl_gen3_bc_tbl *scd_bc_tbl_gen3 = txq->bc_tbl.addr;
+
                /* Starting from AX210, the HW expects bytes */
                WARN_ON(trans_pcie->bc_table_dword);
                WARN_ON(len > 0x3FFF);
                bc_ent = cpu_to_le16(len | (num_fetch_chunks << 14));
                scd_bc_tbl_gen3->tfd_offset[idx] = bc_ent;
        } else {
+               struct iwlagn_scd_bc_tbl *scd_bc_tbl = txq->bc_tbl.addr;
+
                /* Before AX210, the HW expects DW */
                WARN_ON(!trans_pcie->bc_table_dword);
                len = DIV_ROUND_UP(len, 4);