aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLarry Bassel <lbassel@codeaurora.org>2011-05-11 21:27:15 (GMT)
committerLarry Bassel <lbassel@codeaurora.org>2011-05-11 22:10:07 (GMT)
commit6aaa69d90a53f169afc5222684f0102356dc39c5 (patch)
tree660fc03072960b54b042584cb6e911ce8350e1c3
parent7c86eca9ca93eff609c8def9fb6d98ebd03aee97 (diff)
pmem: remove last vestiges of in-kernel PMEM support
The APIs pmem_kalloc() and pmem_kfree() are deprecated and are now emulated using the new kernel contiguous memory allocation API. Remove a small amount of code in the PMEM driver which was only used in the implementation of these old APIs. Change-Id: I9d7a0d59c8a4a8e86a6d3582648ccf0b14d1a1c8 Signed-off-by: Larry Bassel <lbassel@codeaurora.org>
-rw-r--r--drivers/misc/pmem.c79
1 files changed, 13 insertions, 66 deletions
diff --git a/drivers/misc/pmem.c b/drivers/misc/pmem.c
index 7df1fa6..88b3e57 100644
--- a/drivers/misc/pmem.c
+++ b/drivers/misc/pmem.c
@@ -1,7 +1,7 @@
/* drivers/android/pmem.c
*
* Copyright (C) 2007 Google, Inc.
- * Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
@@ -35,10 +35,7 @@
#include <linux/pm_runtime.h>
#include <linux/memory_alloc.h>
-#define PMEM_MAX_USER_SPACE_DEVICES (10)
-#define PMEM_MAX_KERNEL_SPACE_DEVICES (2)
-#define PMEM_MAX_DEVICES \
- (PMEM_MAX_USER_SPACE_DEVICES + PMEM_MAX_KERNEL_SPACE_DEVICES)
+#define PMEM_MAX_DEVICES (10)
#define PMEM_MAX_ORDER (128)
#define PMEM_MIN_ALLOC PAGE_SIZE
@@ -244,23 +241,6 @@ struct pmem_info {
static struct pmem_info pmem[PMEM_MAX_DEVICES];
static int id_count;
-static struct {
- const char * const name;
- const int memtype;
- const int fallback_memtype;
- int info_id;
-} kapi_memtypes[] = {
-#ifdef CONFIG_KERNEL_PMEM_SMI_REGION
- { PMEM_KERNEL_SMI_DATA_NAME,
- PMEM_MEMTYPE_SMI,
- PMEM_MEMTYPE_EBI1, /* Fall back to EBI1 automatically */
- -1 },
-#endif
- { PMEM_KERNEL_EBI1_DATA_NAME,
- PMEM_MEMTYPE_EBI1,
- PMEM_INVALID_MEMTYPE, /* MUST be set invalid if no fallback */
- -1 },
-};
#define PMEM_SYSFS_DIR_NAME "pmem_regions" /* under /sys/kernel/ */
static struct kset *pmem_kset;
@@ -2661,7 +2641,7 @@ int pmem_setup(struct android_pmem_platform_data *pdata,
long (*ioctl)(struct file *, unsigned int, unsigned long),
int (*release)(struct inode *, struct file *))
{
- int i, index = 0, kapi_memtype_idx = -1, id, is_kernel_memtype = 0;
+ int i, index = 0, id;
if (id_count >= PMEM_MAX_DEVICES) {
pr_alert("pmem: %s: unable to register driver(%s) - no more "
@@ -2688,30 +2668,6 @@ int pmem_setup(struct android_pmem_platform_data *pdata,
pmem[id].allocator_type = pdata->allocator_type;
- for (i = 0; i < ARRAY_SIZE(kapi_memtypes); i++) {
- if (!strcmp(kapi_memtypes[i].name, pdata->name)) {
- if (kapi_memtypes[i].info_id >= 0) {
- pr_alert("Unable to register kernel pmem "
- "driver - duplicate registration of "
- "%s!\n", pdata->name);
- goto err_no_mem;
- }
- if (pdata->cached) {
- pr_alert("kernel arena memory must "
- "NOT be configured as 'cached'. Check "
- "and fix your board file. Failing "
- "pmem driver %s registration!",
- pdata->name);
- goto err_no_mem;
- }
-
- is_kernel_memtype = 1;
- kapi_memtypes[i].info_id = id;
- kapi_memtype_idx = i;
- break;
- }
- }
-
/* 'quantum' is a "hidden" variable that defaults to 0 in the board
* files */
pmem[id].quantum = pdata->quantum ?: PMEM_MIN_ALLOC;
@@ -2883,19 +2839,14 @@ int pmem_setup(struct android_pmem_platform_data *pdata,
INIT_LIST_HEAD(&pmem[id].data_list);
pmem[id].dev.name = pdata->name;
- if (!is_kernel_memtype) {
- pmem[id].dev.minor = id;
- pmem[id].dev.fops = &pmem_fops;
- pr_info("pmem: Initializing %s (user-space) as %s\n",
- pdata->name, pdata->cached ? "cached" : "non-cached");
-
- if (misc_register(&pmem[id].dev)) {
- pr_alert("Unable to register pmem driver!\n");
- goto err_cant_register_device;
- }
- } else { /* kernel region, no user accessible device */
- pmem[id].dev.minor = -1;
- pr_info("pmem: Initializing %s (in-kernel)\n", pdata->name);
+ pmem[id].dev.minor = id;
+ pmem[id].dev.fops = &pmem_fops;
+ pr_info("pmem: Initializing %s (user-space) as %s\n",
+ pdata->name, pdata->cached ? "cached" : "non-cached");
+
+ if (misc_register(&pmem[id].dev)) {
+ pr_alert("Unable to register pmem driver!\n");
+ goto err_cant_register_device;
}
/* do not set up unstable pmem now, wait until first memory hotplug */
@@ -2905,8 +2856,7 @@ int pmem_setup(struct android_pmem_platform_data *pdata,
pmem[id].base = allocate_contiguous_memory_nomap(pmem[id].size,
pmem[id].memory_type, PAGE_SIZE);
- if ((!is_kernel_memtype) &&
- (pmem[id].allocator_type != PMEM_ALLOCATORTYPE_SYSTEM)) {
+ if (pmem[id].allocator_type != PMEM_ALLOCATORTYPE_SYSTEM) {
ioremap_pmem(id);
if (pmem[id].vbase == 0) {
pr_err("pmem: ioremap failed for device %s\n",
@@ -2923,8 +2873,7 @@ int pmem_setup(struct android_pmem_platform_data *pdata,
return 0;
error_cant_remap:
- if (!is_kernel_memtype)
- misc_deregister(&pmem[id].dev);
+ misc_deregister(&pmem[id].dev);
err_cant_register_device:
out_put_kobj:
kobject_put(&pmem[id].kobj);
@@ -2937,8 +2886,6 @@ out_put_kobj:
err_reset_pmem_info:
pmem[id].allocate = 0;
pmem[id].dev.minor = -1;
- if (kapi_memtype_idx >= 0)
- kapi_memtypes[i].info_id = -1;
err_no_mem:
return -1;
}