diff options
author | Oded Gabbay <oded.gabbay@gmail.com> | 2019-03-01 13:21:11 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-03-01 13:44:59 +0100 |
commit | b3bf147bd6117f2cc493c6371c6f0be659b0dd96 (patch) | |
tree | 0746b0a4d73bda58d0a5664d802e20845bb8e553 /drivers/misc/habanalabs/mmu.c | |
parent | intel_th: gth: Fix an off-by-one in output unassigning (diff) | |
download | linux-b3bf147bd6117f2cc493c6371c6f0be659b0dd96.tar.xz linux-b3bf147bd6117f2cc493c6371c6f0be659b0dd96.zip |
habanalabs: use do_div for 64-bit divisions
This patch fix compilation error in 32-bit ARM architecture regarding
division of 2 64-bit variables.
Use the kernel do_div() macro, which is implemented per architecture, for
doing these divisions instead of using the / operator.
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/habanalabs/mmu.c')
-rw-r--r-- | drivers/misc/habanalabs/mmu.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/misc/habanalabs/mmu.c b/drivers/misc/habanalabs/mmu.c index ce404e6cc9a9..2f2e99cb2743 100644 --- a/drivers/misc/habanalabs/mmu.c +++ b/drivers/misc/habanalabs/mmu.c @@ -261,9 +261,9 @@ int hl_mmu_ctx_init(struct hl_ctx *ctx) !hdev->dram_default_page_mapping) return 0; - num_of_hop3 = (prop->dram_size_for_default_page_mapping / - prop->dram_page_size) / - PTE_ENTRIES_IN_HOP; + num_of_hop3 = prop->dram_size_for_default_page_mapping; + do_div(num_of_hop3, prop->dram_page_size); + do_div(num_of_hop3, PTE_ENTRIES_IN_HOP); /* add hop1 and hop2 */ total_hops = num_of_hop3 + 2; @@ -378,9 +378,9 @@ void hl_mmu_ctx_fini(struct hl_ctx *ctx) if (hdev->dram_supports_virtual_memory && hdev->dram_default_page_mapping) { - num_of_hop3 = (prop->dram_size_for_default_page_mapping / - prop->dram_page_size) / - PTE_ENTRIES_IN_HOP; + num_of_hop3 = prop->dram_size_for_default_page_mapping; + do_div(num_of_hop3, prop->dram_page_size); + do_div(num_of_hop3, PTE_ENTRIES_IN_HOP); /* add hop1 and hop2 */ total_hops = num_of_hop3 + 2; |