From: Tejun Heo <tj@home-tj.org>
To: rusty@rustcorp.com.au, mochel@osdl.org, greg@kroah.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 2.6.10-rc1 4/15] driver-model: const qualifier removed from @val of param_array()
Date: Thu, 4 Nov 2004 15:44:41 +0900 [thread overview]
Message-ID: <20041104064440.GD24890@home-tj.org> (raw)
In-Reply-To: <20041104063532.GA24566@home-tj.org>
dp_04_param_array_val_noconst.patch
This is the 4th patch of 15 patches for devparam.
This patch removes the const qualifier from @val of param_array().
param_array() does modify @val and I think it's clearer this way.
Signed-off-by: Tejun Heo <tj@home-tj.org>
Index: linux-export/include/linux/moduleparam.h
===================================================================
--- linux-export.orig/include/linux/moduleparam.h 2004-11-04 14:48:38.000000000 +0900
+++ linux-export/include/linux/moduleparam.h 2004-11-04 14:48:38.000000000 +0900
@@ -185,7 +185,7 @@ extern int param_get_string(char *buffer
extern int param_set_flag(const char *val, struct kernel_param *kp);
extern int param_get_flag(char *buffer, struct kernel_param *kp);
-int param_array(const char *name, const char *val,
+int param_array(const char *name, char *val,
long min_val, long max_val, unsigned int min, unsigned int max,
void *elem, int elemsize,
int (*set)(const char *, struct kernel_param *kp),
Index: linux-export/kernel/module.c
===================================================================
--- linux-export.orig/kernel/module.c 2004-11-04 14:48:38.000000000 +0900
+++ linux-export/kernel/module.c 2004-11-04 14:48:38.000000000 +0900
@@ -703,6 +703,7 @@ int set_obsolete(const char *val, struct
int dummy;
char *endp;
const char *p;
+ char *v = (char *)val;
struct obsolete_modparm *obsparm = kp->arg;
if (!val) {
@@ -722,23 +723,23 @@ int set_obsolete(const char *val, struct
max = min;
switch (*endp) {
case 'b':
- return param_array(kp->name, val, KPARAM_NO_RANGE, min, max,
+ return param_array(kp->name, v, KPARAM_NO_RANGE, min, max,
obsparm->addr, 1,
param_set_byte, &dummy);
case 'h':
- return param_array(kp->name, val, KPARAM_NO_RANGE, min, max,
+ return param_array(kp->name, v, KPARAM_NO_RANGE, min, max,
obsparm->addr, sizeof(short),
param_set_short, &dummy);
case 'i':
- return param_array(kp->name, val, KPARAM_NO_RANGE, min, max,
+ return param_array(kp->name, v, KPARAM_NO_RANGE, min, max,
obsparm->addr, sizeof(int),
param_set_int, &dummy);
case 'l':
- return param_array(kp->name, val, KPARAM_NO_RANGE, min, max,
+ return param_array(kp->name, v, KPARAM_NO_RANGE, min, max,
obsparm->addr, sizeof(long),
param_set_long, &dummy);
case 's':
- return param_array(kp->name, val, KPARAM_NO_RANGE, min, max,
+ return param_array(kp->name, v, KPARAM_NO_RANGE, min, max,
obsparm->addr, sizeof(char *),
param_set_charp, &dummy);
@@ -756,7 +757,7 @@ int set_obsolete(const char *val, struct
}
if (size >= maxsize)
goto oversize;
- return param_array(kp->name, val, KPARAM_NO_RANGE, min, max,
+ return param_array(kp->name, v, KPARAM_NO_RANGE, min, max,
obsparm->addr, maxsize,
obsparm_copy_string, &dummy);
}
Index: linux-export/kernel/params.c
===================================================================
--- linux-export.orig/kernel/params.c 2004-11-04 14:48:38.000000000 +0900
+++ linux-export/kernel/params.c 2004-11-04 14:48:38.000000000 +0900
@@ -268,7 +268,7 @@ int param_get_invbool(char *buffer, stru
}
/* We cheat here and temporarily mangle the string. */
-int param_array(const char *name, const char *val,
+int param_array(const char *name, char *val,
long min_val, long max_val, unsigned int min, unsigned int max,
void *elem, int elemsize,
int (*set)(const char *, struct kernel_param *kp),
@@ -304,7 +304,7 @@ int param_array(const char *name, const
/* nul-terminate and parse */
save = val[len];
- ((char *)val)[len] = '\0';
+ val[len] = '\0';
ret = set(val, &kp);
if (ret != 0)
@@ -327,7 +327,7 @@ int param_array_set(const char *val, str
struct kparam_array *arr = kp->arg;
unsigned int t;
- return param_array(kp->name, val, kp->min, kp->max,
+ return param_array(kp->name, (char *)val, kp->min, kp->max,
1, arr->max, arr->elem, arr->elemsize,
arr->set, arr->num ?: &t);
}
next prev parent reply other threads:[~2004-11-04 6:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-04 6:35 [PATCH 2.6.10-rc1 0/15] driver-model: per-device parameter, round 3 Tejun Heo
2004-11-04 6:38 ` [PATCH 2.6.10-rc1 1/15] driver-model: param_array_set num field fix Tejun Heo
2004-11-04 6:39 ` [PATCH 2.6.10-rc1 2/15] driver-model: flag type helpers added to moduleparam Tejun Heo
2004-11-04 6:40 ` [PATCH 2.6.10-rc1 3/15] driver-model: Tejun Heo
2004-11-04 6:44 ` Tejun Heo [this message]
2004-11-04 6:45 ` [PATCH 2.6.10-rc1 5/15] driver-model: param_array_delims() implemented Tejun Heo
2004-11-04 6:47 ` [PATCH 2.6.10-rc1 6/15] driver-model: ':' added to default param_array delimiters Tejun Heo
2004-11-04 6:48 ` [PATCH 2.6.10-rc1 7/15] driver-model: next_arg() renamed to param_next_arg() and became global Tejun Heo
2004-11-04 6:49 ` [PATCH 2.6.10-rc1 8/15] driver-model: MODULE_PARAM_PREFIX is changed to empty string from nothing Tejun Heo
2004-11-04 6:50 ` [PATCH 2.6.10-rc1 9/15] driver-model: parse_args()'s @unknown function modified to take void *arg Tejun Heo
2004-11-04 6:51 ` [PATCH 2.6.10-rc1 10/15] driver-model: module_param_array() changed back to accept variable name directly for @num and module_param_arr() added Tejun Heo
2004-11-04 6:52 ` [PATCH 2.6.10-rc1 11/15] driver-model: module_param_array/arr() change applied Tejun Heo
2004-11-04 6:53 ` [PATCH 2.6.10-rc1 12/15] driver-model: devparam implemented Tejun Heo
2004-11-04 6:53 ` [PATCH 2.6.10-rc1 13/15] driver-model: devparam applied Tejun Heo
2004-11-04 6:54 ` [PATCH 2.6.10-rc1 14/15] driver-model: devparam documentation Tejun Heo
2004-11-04 6:54 ` [PATCH 2.6.10-rc1 15/15] driver-model: via-velocity converted to use devparam Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20041104064440.GD24890@home-tj.org \
--to=tj@home-tj.org \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mochel@osdl.org \
--cc=rusty@rustcorp.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®