]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ludev.git/commitdiff
cmemk: Cleanup on cmem_cma_dev_0
authorSam Nelson <sam.nelson@ti.com>
Wed, 13 Apr 2016 21:21:06 +0000 (17:21 -0400)
committerSam Nelson <sam.nelson@ti.com>
Wed, 27 Apr 2016 12:49:41 +0000 (08:49 -0400)
cmem_cma_dev_0 need not be keystone 2 specific and can be common for all
platforms. Added similar handling for all platforms.

Signed-off-by: Sam Nelson <sam.nelson@ti.com>
src/cmem/module/cmemk.c

index 9aa801674da4d8ec7953ae064ed3473b243ed0a1..877412233b0dd1e2c7b158d5801390205fbf5680 100644 (file)
@@ -228,12 +228,13 @@ static int cmem_cma_npools = 0;
 static int cmem_cma_heapsize = 0;
 static struct device *cmem_cma_dev;
 static struct pool_object *cmem_cma_p_objs;
+#endif
+
+static struct device *cmem_cma_dev_0;
 #if IS_ENABLED(CONFIG_ARCH_KEYSTONE) && IS_ENABLED(CONFIG_ARM_LPAE) \
        && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0))
-static struct device *cmem_cma_dev_0;
 #define KEYSTONE_DMA_PFN_OFFSET 0x780000UL
 #endif
-#endif
 
 /*
  * For CMA allocations we treat p_objs[NBLOCKS] as a special "pool" array.
@@ -1141,12 +1142,7 @@ static long ioctl(struct file *filp, unsigned int cmd, unsigned long args)
 
                if (cmem_cma_heapsize == 0) {
                    __D("no explicit CMEM CMA heap, using global area\n");
-#if IS_ENABLED(CONFIG_ARCH_KEYSTONE) && IS_ENABLED(CONFIG_ARM_LPAE) \
-       && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0))
                    dev = cmem_cma_dev_0;
-#else
-                   dev = NULL;
-#endif
                }
                else {
                    dev = &cmem_cma_dev[heap_pool[bi]];
@@ -2322,15 +2318,13 @@ int __init cmem_init(void)
        goto fail_after_reg;
     }
 
-#if IS_ENABLED(CONFIG_ARCH_KEYSTONE) && IS_ENABLED(CONFIG_ARM_LPAE) \
-       && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0))
+    /* Create cmem device */
     cmem_cma_dev_0 = device_create(cmem_class, NULL, MKDEV(cmem_major, 0),
                                   NULL, "cmem");
-
+#if IS_ENABLED(CONFIG_ARCH_KEYSTONE) && IS_ENABLED(CONFIG_ARM_LPAE) \
+       && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0))
     cmem_cma_dev_0->coherent_dma_mask = DMA_BIT_MASK(32);
     cmem_cma_dev_0->dma_pfn_offset = KEYSTONE_DMA_PFN_OFFSET;
-#else
-    device_create(cmem_class, NULL, MKDEV(cmem_major, 0), NULL, "cmem");
 #endif
     for (bi = 0; bi < NBLOCKS; bi++) {
        if (!block_start[bi] || !block_end[bi]) {