Skip to content

Commit 04ff486

Browse files
YueHaibingdjbw
authored andcommitted
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: 2522afb ("libnvdimm/region: Introduce an 'align' attribute") Signed-off-by: YueHaibing <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dan Williams <[email protected]>
1 parent 2522afb commit 04ff486

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

drivers/nvdimm/region_devs.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -563,8 +563,7 @@ static ssize_t align_store(struct device *dev,
563563
* contribute to the tail capacity in system-physical-address
564564
* space for the namespace.
565565
*/
566-
dpa = val;
567-
remainder = do_div(dpa, nd_region->ndr_mappings);
566+
dpa = div_u64_rem(val, nd_region->ndr_mappings, &remainder);
568567
if (!is_power_of_2(dpa) || dpa < PAGE_SIZE
569568
|| val > region_size(nd_region) || remainder)
570569
return -EINVAL;
@@ -1010,7 +1009,7 @@ EXPORT_SYMBOL(nd_region_release_lane);
10101009

10111010
static unsigned long default_align(struct nd_region *nd_region)
10121011
{
1013-
unsigned long align, per_mapping;
1012+
unsigned long align;
10141013
int i, mappings;
10151014
u32 remainder;
10161015

@@ -1030,8 +1029,7 @@ static unsigned long default_align(struct nd_region *nd_region)
10301029
}
10311030

10321031
mappings = max_t(u16, 1, nd_region->ndr_mappings);
1033-
per_mapping = align;
1034-
remainder = do_div(per_mapping, mappings);
1032+
div_u64_rem(align, mappings, &remainder);
10351033
if (remainder)
10361034
align *= mappings;
10371035

0 commit comments

Comments
 (0)