]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
video: tegra: nvmap: Consolidate zeroed mem config
authorAlex Waterman <alexw@nvidia.com>
Mon, 28 Apr 2014 18:27:17 +0000 (11:27 -0700)
committerMitch Luban <mluban@nvidia.com>
Tue, 14 Oct 2014 02:49:44 +0000 (19:49 -0700)
Consilidate the NVMAP_FORCE_ZEROED_USER_PAGES config to only
two locations. Both are in nvmap_handle.c and ensure that
the module param zero_memory is enabled and unchangable when
NVMAP_FORCE_ZEROED_USER_PAGES is set.

Change-Id: I54de5c6742f92eafdd8f5ca4aaf87d0f06865aaa
Reviewed-on: http://git-master/r/403038
Signed-off-by: Jon McCaffrey <jmccaffrey@nvidia.com>
Reviewed-on: http://git-master/r/555613
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Mitch Luban <mluban@nvidia.com>
drivers/video/tegra/nvmap/nvmap_handle.c
drivers/video/tegra/nvmap/nvmap_priv.h

index 4c598f732eb41d8af42cd2084bf37b206b969c0b..e45afc7226a8506e740536a3b19385e631b39e8d 100644 (file)
 #include "nvmap_priv.h"
 #include "nvmap_ioctl.h"
 
+#ifdef CONFIG_NVMAP_FORCE_ZEROED_USER_PAGES
+bool zero_memory = 1;
+#else
 bool zero_memory;
+#endif
 u32 nvmap_max_handle_count;
 
 static int zero_memory_set(const char *arg, const struct kernel_param *kp)
 {
+#ifdef CONFIG_NVMAP_FORCE_ZEROED_USER_PAGES
+       return -EPERM;
+#else
        param_set_bool(arg, kp);
        nvmap_page_pool_clear();
        return 0;
+#endif
 }
 
 static struct kernel_param_ops zero_memory_ops = {
@@ -88,7 +96,7 @@ void nvmap_altfree(void *ptr, size_t len)
 void _nvmap_handle_free(struct nvmap_handle *h)
 {
        unsigned int i, nr_page, page_index = 0;
-#ifdef CONFIG_NVMAP_PAGE_POOLS
+#if defined(CONFIG_NVMAP_PAGE_POOLS)
        struct nvmap_page_pool *pool = NULL;
 #endif
 
@@ -123,7 +131,7 @@ void _nvmap_handle_free(struct nvmap_handle *h)
        for (i = 0; i < nr_page; i++)
                h->pgalloc.pages[i] = nvmap_to_page(h->pgalloc.pages[i]);
 
-#ifdef CONFIG_NVMAP_PAGE_POOLS
+#if defined(CONFIG_NVMAP_PAGE_POOLS)
        if (!zero_memory) {
                pool = &nvmap_dev->pool;
 
index ba1e1854ee6c65830a75689f4c326d70c2c987c1..486b64f32751e1ef636ad9868bfd16e73d8541d1 100644 (file)
 #define __GFP_NVMAP     (GFP_KERNEL | __GFP_HIGHMEM)
 #endif
 
-#ifdef CONFIG_NVMAP_FORCE_ZEROED_USER_PAGES
-#define NVMAP_ZEROED_PAGES     __GFP_ZERO
-#else
-#define NVMAP_ZEROED_PAGES     0
-#endif
-
-#define GFP_NVMAP              (__GFP_NVMAP | __GFP_NOWARN | NVMAP_ZEROED_PAGES)
+#define GFP_NVMAP       (__GFP_NVMAP | __GFP_NOWARN)
 
 #define NVMAP_NUM_PTES         64