aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Streetman <ddstreet@ieee.org>2015-06-17 06:17:52 +0930
committerRusty Russell <rusty@rustcorp.com.au>2015-06-23 15:27:37 +0930
commit5104b7d7678b0029417f6ac08243773a77259ac6 (patch)
treebf1a7a2703674d474db5618302cf8b5acf3f8adc
parentparams: suppress unused variable error, warn once just in case code changes. (diff)
downloadlinux-dev-5104b7d7678b0029417f6ac08243773a77259ac6.tar.xz
linux-dev-5104b7d7678b0029417f6ac08243773a77259ac6.zip
module: make perm const
Change the struct kernel_param.perm field to a const, as it should never be changed. Signed-off-by: Dan Streetman <ddstreet@ieee.org> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (cut from larger patch)
Diffstat (limited to '')
-rw-r--r--include/linux/moduleparam.h2
-rw-r--r--kernel/params.c8
2 files changed, 4 insertions, 6 deletions
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 7e0079936396..ab5031453807 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -68,7 +68,7 @@ enum {
struct kernel_param {
const char *name;
const struct kernel_param_ops *ops;
- u16 perm;
+ const u16 perm;
s8 level;
u8 flags;
union {
diff --git a/kernel/params.c b/kernel/params.c
index e906874da5fc..a8b09f6c87dc 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -395,12 +395,11 @@ EXPORT_SYMBOL(param_ops_invbool);
int param_set_bint(const char *val, const struct kernel_param *kp)
{
- struct kernel_param boolkp;
+ /* Match bool exactly, by re-using it. */
+ struct kernel_param boolkp = *kp;
bool v;
int ret;
- /* Match bool exactly, by re-using it. */
- boolkp = *kp;
boolkp.arg = &v;
ret = param_set_bool(val, &boolkp);
@@ -480,9 +479,8 @@ static int param_array_get(char *buffer, const struct kernel_param *kp)
{
int i, off, ret;
const struct kparam_array *arr = kp->arr;
- struct kernel_param p;
+ struct kernel_param p = *kp;
- p = *kp;
for (i = off = 0; i < (arr->num ? *arr->num : arr->max); i++) {
if (i)
buffer[off++] = ',';