[Nouveau] [PATCH] instmem/gk20a: use roundup() macro

Alexandre Courbot acourbot at nvidia.com
Wed Feb 25 19:44:52 PST 2015


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 at 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(-)

diff --git a/drm/nouveau/nvkm/subdev/instmem/gk20a.c b/drm/nouveau/nvkm/subdev/instmem/gk20a.c
index a31196b6da8f..fcba72eb74a3 100644
--- a/drm/nouveau/nvkm/subdev/instmem/gk20a.c
+++ b/drm/nouveau/nvkm/subdev/instmem/gk20a.c
@@ -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,
-- 
2.3.0



More information about the Nouveau mailing list