@@ -335,8 +335,8 @@ gk20a_instobj_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
priv->domain ? "IOMMU" : "DMA", args->size, args->align);
/* Round size and align to page bounds */
- size = max((args->size + ~PAGE_MASK) & PAGE_MASK, (u32)PAGE_SIZE);
- align = max((args->align + ~PAGE_MASK) & PAGE_MASK, (u32)PAGE_SIZE);
+ size = max(roundup(args->size, PAGE_SIZE), PAGE_SIZE);
+ align = max(roundup(args->align, PAGE_SIZE), PAGE_SIZE);
if (priv->domain)
ret = gk20a_instobj_ctor_iommu(parent, engine, oclass,
Use the roundup() macro to make code easier to read and fix a warning when the driver is compiled for 64 bit architectures. Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> --- Ben, this should probably be squashed into patch 6/6 of my "RAM device removal & IOMMU support" series, since it is not merged yet. drm/nouveau/nvkm/subdev/instmem/gk20a.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)