summaryrefslogtreecommitdiff
path: root/drivers/nvdimm
diff options
context:
space:
mode:
authorYueHaibing <yuehaibing@huawei.com>2020-03-31 14:50:24 +0300
committerDan Williams <dan.j.williams@intel.com>2020-03-31 19:28:20 +0300
commit04ff4863e1261187ef6152d2cf1f9a20e9b4cc04 (patch)
tree8deabac0232aec448f7294d09ec605890770d7f4 /drivers/nvdimm
parent2522afb86a8cceba0f67dbf05772d21b76d79f06 (diff)
downloadlinux-04ff4863e1261187ef6152d2cf1f9a20e9b4cc04.tar.xz
libnvdimm/region: Fix build error
On CONFIG_PPC32=y build fails: drivers/nvdimm/region_devs.c:1034:14: note: in expansion of macro ‘do_div’ remainder = do_div(per_mapping, mappings); ^~~~~~ In file included from ./arch/powerpc/include/generated/asm/div64.h:1:0, from ./include/linux/kernel.h:18, from ./include/asm-generic/bug.h:19, from ./arch/powerpc/include/asm/bug.h:109, from ./include/linux/bug.h:5, from ./include/linux/scatterlist.h:7, from drivers/nvdimm/region_devs.c:5: ./include/asm-generic/div64.h:243:22: error: passing argument 1 of ‘__div64_32’ from incompatible pointer type [-Werror=incompatible-pointer-types] __rem = __div64_32(&(n), __base); \ Use div_u64 instead of do_div to fix this. Fixes: 2522afb86a8c ("libnvdimm/region: Introduce an 'align' attribute") Signed-off-by: YueHaibing <yuehaibing@huawei.com> Link: https://lore.kernel.org/r/20200331115024.31628-1-yuehaibing@huawei.com Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/nvdimm')
-rw-r--r--drivers/nvdimm/region_devs.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
index bf239e783940..ccbb5b43b8b2 100644
--- a/drivers/nvdimm/region_devs.c
+++ b/drivers/nvdimm/region_devs.c
@@ -563,8 +563,7 @@ static ssize_t align_store(struct device *dev,
* contribute to the tail capacity in system-physical-address
* space for the namespace.
*/
- dpa = val;
- remainder = do_div(dpa, nd_region->ndr_mappings);
+ dpa = div_u64_rem(val, nd_region->ndr_mappings, &remainder);
if (!is_power_of_2(dpa) || dpa < PAGE_SIZE
|| val > region_size(nd_region) || remainder)
return -EINVAL;
@@ -1010,7 +1009,7 @@ EXPORT_SYMBOL(nd_region_release_lane);
static unsigned long default_align(struct nd_region *nd_region)
{
- unsigned long align, per_mapping;
+ unsigned long align;
int i, mappings;
u32 remainder;
@@ -1030,8 +1029,7 @@ static unsigned long default_align(struct nd_region *nd_region)
}
mappings = max_t(u16, 1, nd_region->ndr_mappings);
- per_mapping = align;
- remainder = do_div(per_mapping, mappings);
+ div_u64_rem(align, mappings, &remainder);
if (remainder)
align *= mappings;