iwlwifi: mvm: replace the number of blocks calculation
authorSara Sharon <sara.sharon@intel.com>
Thu, 27 Oct 2016 14:58:27 +0000 (17:58 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Thu, 26 Jan 2017 07:38:56 +0000 (09:38 +0200)
The logic in the paging calculations is a bit hard to
follow. Replace it with a kernel define.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/fw.c

index 04fe1051b1e5cf2fe7aadd22c34841b913c5d6ec..606b3fc18d46e0993023813b3a43f0807e20016e 100644 (file)
@@ -270,8 +270,8 @@ static int iwl_alloc_fw_paging_mem(struct iwl_mvm *mvm,
        BUILD_BUG_ON(BIT(BLOCK_2_EXP_SIZE) != PAGING_BLOCK_SIZE);
 
        num_of_pages = image->paging_mem_size / FW_PAGING_SIZE;
-       mvm->num_of_paging_blk = ((num_of_pages - 1) /
-                                   NUM_OF_PAGE_PER_GROUP) + 1;
+       mvm->num_of_paging_blk =
+               DIV_ROUND_UP(num_of_pages, NUM_OF_PAGE_PER_GROUP);
        mvm->num_of_pages_in_last_blk =
                num_of_pages -
                NUM_OF_PAGE_PER_GROUP * (mvm->num_of_paging_blk - 1);