Module Name: src Committed By: riastradh Date: Sun Sep 8 15:44:14 UTC 2013
Modified Files: src/sys/external/bsd/drm2/drm [riastradh-drm2]: drm_gem_vm.c drm_scatter.c drm_vm.c Log Message: Avoid the PAGE_MASK mess in drm_gem_vm.c, drm_scatter.c, & drm_vm.c. To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/external/bsd/drm2/drm/drm_gem_vm.c \ src/sys/external/bsd/drm2/drm/drm_vm.c cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/external/bsd/drm2/drm/drm_scatter.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/external/bsd/drm2/drm/drm_gem_vm.c diff -u src/sys/external/bsd/drm2/drm/drm_gem_vm.c:1.1.2.1 src/sys/external/bsd/drm2/drm/drm_gem_vm.c:1.1.2.2 --- src/sys/external/bsd/drm2/drm/drm_gem_vm.c:1.1.2.1 Wed Jul 24 02:54:09 2013 +++ src/sys/external/bsd/drm2/drm/drm_gem_vm.c Sun Sep 8 15:44:14 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: drm_gem_vm.c,v 1.1.2.1 2013/07/24 02:54:09 riastradh Exp $ */ +/* $NetBSD: drm_gem_vm.c,v 1.1.2.2 2013/09/08 15:44:14 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: drm_gem_vm.c,v 1.1.2.1 2013/07/24 02:54:09 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: drm_gem_vm.c,v 1.1.2.2 2013/09/08 15:44:14 riastradh Exp $"); #include <sys/types.h> @@ -85,7 +85,7 @@ drm_gem_mmap_object_locked(struct drm_de KASSERT(drm_core_check_feature(dev, DRIVER_GEM)); KASSERT(dev->driver->gem_uvm_ops != NULL); - if (byte_offset != trunc_page(byte_offset)) /* XXX kassert? */ + if (byte_offset != (byte_offset & ~(PAGE_SIZE-1))) /* XXX kassert? */ return -EINVAL; if (drm_ht_find_item(&mm->offset_hash, page_offset, &hash) != 0) { Index: src/sys/external/bsd/drm2/drm/drm_vm.c diff -u src/sys/external/bsd/drm2/drm/drm_vm.c:1.1.2.1 src/sys/external/bsd/drm2/drm/drm_vm.c:1.1.2.2 --- src/sys/external/bsd/drm2/drm/drm_vm.c:1.1.2.1 Wed Jul 24 02:53:31 2013 +++ src/sys/external/bsd/drm2/drm/drm_vm.c Sun Sep 8 15:44:14 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: drm_vm.c,v 1.1.2.1 2013/07/24 02:53:31 riastradh Exp $ */ +/* $NetBSD: drm_vm.c,v 1.1.2.2 2013/09/08 15:44:14 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: drm_vm.c,v 1.1.2.1 2013/07/24 02:53:31 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: drm_vm.c,v 1.1.2.2 2013/09/08 15:44:14 riastradh Exp $"); #include <sys/types.h> @@ -50,7 +50,7 @@ drm_mmap_paddr(struct drm_device *dev, o paddr_t paddr = (paddr_t)-1; int error; - if (byte_offset != trunc_page(byte_offset)) + if (byte_offset != (byte_offset & ~(PAGE_SIZE-1))) return (paddr_t)-1; mutex_lock(&dev->struct_mutex); Index: src/sys/external/bsd/drm2/drm/drm_scatter.c diff -u src/sys/external/bsd/drm2/drm/drm_scatter.c:1.1.2.2 src/sys/external/bsd/drm2/drm/drm_scatter.c:1.1.2.3 --- src/sys/external/bsd/drm2/drm/drm_scatter.c:1.1.2.2 Wed Jul 24 03:27:52 2013 +++ src/sys/external/bsd/drm2/drm/drm_scatter.c Sun Sep 8 15:44:14 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: drm_scatter.c,v 1.1.2.2 2013/07/24 03:27:52 riastradh Exp $ */ +/* $NetBSD: drm_scatter.c,v 1.1.2.3 2013/09/08 15:44:14 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: drm_scatter.c,v 1.1.2.2 2013/07/24 03:27:52 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: drm_scatter.c,v 1.1.2.3 2013/09/08 15:44:14 riastradh Exp $"); #include <sys/types.h> #include <sys/bus.h> @@ -123,7 +123,7 @@ drm_sg_alloc_mem(struct drm_device *dev, KASSERT(drm_core_check_feature(dev, DRIVER_SG)); KASSERT(size <= (size_t)0xffffffffUL); /* XXX 32-bit sizes only? */ - const size_t nbytes = round_page(size); + const size_t nbytes = PAGE_ALIGN(size); const size_t npages = nbytes >> PAGE_SHIFT; KASSERT(npages <= (size_t)INT_MAX);