aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorJonathan Cameron <jic23@cam.ac.uk>2011-04-19 07:43:47 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-04-25 19:04:52 -0400
commite7e09cd667a43d8287f85d453a16fc0ec1e2c7b7 (patch)
tree29ec5f4bd232b467cc6b064c647b6c4990e9ca79 /kernel
parent8705b48e7159655c116154928fe104fd6561fa94 (diff)
params.c: Use new strtobool function to process boolean inputs
No functional changes. Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/params.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/kernel/params.c b/kernel/params.c
index 7ab388a48a2e..6888761f1b4e 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -297,21 +297,15 @@ EXPORT_SYMBOL(param_ops_charp);
297int param_set_bool(const char *val, const struct kernel_param *kp) 297int param_set_bool(const char *val, const struct kernel_param *kp)
298{ 298{
299 bool v; 299 bool v;
300 int ret;
300 301
301 /* No equals means "set"... */ 302 /* No equals means "set"... */
302 if (!val) val = "1"; 303 if (!val) val = "1";
303 304
304 /* One of =[yYnN01] */ 305 /* One of =[yYnN01] */
305 switch (val[0]) { 306 ret = strtobool(val, &v);
306 case 'y': case 'Y': case '1': 307 if (ret)
307 v = true; 308 return ret;
308 break;
309 case 'n': case 'N': case '0':
310 v = false;
311 break;
312 default:
313 return -EINVAL;
314 }
315 309
316 if (kp->flags & KPARAM_ISBOOL) 310 if (kp->flags & KPARAM_ISBOOL)
317 *(bool *)kp->arg = v; 311 *(bool *)kp->arg = v;