summaryrefslogtreecommitdiffstats
path: root/kernel/params.c
diff options
context:
space:
mode:
authorRusty Russell2009-06-13 05:46:56 +0200
committerRusty Russell2009-06-12 14:16:56 +0200
commit45fcc70c0b6ee0c508e1fdb5fef735c3546803f4 (patch)
tree15ea34cf77ecd9bbd4f78259ced012f18a26e01b /kernel/params.c
parentmodule_param: invbool should take a 'bool', not an 'int' (diff)
downloadkernel-qcow2-linux-45fcc70c0b6ee0c508e1fdb5fef735c3546803f4.tar.gz
kernel-qcow2-linux-45fcc70c0b6ee0c508e1fdb5fef735c3546803f4.tar.xz
kernel-qcow2-linux-45fcc70c0b6ee0c508e1fdb5fef735c3546803f4.zip
module_param: split perm field into flags and perm
Impact: cleanup Rather than hack KPARAM_KMALLOCED into the perm field, separate it out. Since the perm field was 32 bits and only needs 16, we don't add bloat. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'kernel/params.c')
-rw-r--r--kernel/params.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/kernel/params.c b/kernel/params.c
index 023abbf5f89f..b4660dc13dbc 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -24,9 +24,6 @@
#include <linux/err.h>
#include <linux/slab.h>
-/* We abuse the high bits of "perm" to record whether we kmalloc'ed. */
-#define KPARAM_KMALLOCED 0x80000000
-
#if 0
#define DEBUGP printk
#else
@@ -220,13 +217,13 @@ int param_set_charp(const char *val, struct kernel_param *kp)
return -ENOSPC;
}
- if (kp->perm & KPARAM_KMALLOCED)
+ if (kp->flags & KPARAM_KMALLOCED)
kfree(*(char **)kp->arg);
/* This is a hack. We can't need to strdup in early boot, and we
* don't need to; this mangled commandline is preserved. */
if (slab_is_available()) {
- kp->perm |= KPARAM_KMALLOCED;
+ kp->flags |= KPARAM_KMALLOCED;
*(char **)kp->arg = kstrdup(val, GFP_KERNEL);
if (!kp->arg)
return -ENOMEM;
@@ -591,7 +588,7 @@ void destroy_params(const struct kernel_param *params, unsigned num)
unsigned int i;
for (i = 0; i < num; i++)
- if (params[i].perm & KPARAM_KMALLOCED)
+ if (params[i].flags & KPARAM_KMALLOCED)
kfree(*(char **)params[i].arg);
}