From: Jonathan Cameron <jic23@cam.ac.uk>
To: linux-kernel@vger.kernel.org
Cc: greg@kroah.com, rusty@rustcorp.com.au, adobriyan@gmail.com,
Jonathan Cameron <jic23@cam.ac.uk>
Subject: [PATCH 3/3] params.c: Use new usr_strtobool function to process boolean inputs
Date: Thu, 24 Mar 2011 13:23:45 +0000 [thread overview]
Message-ID: <1300973025-32497-4-git-send-email-jic23@cam.ac.uk> (raw)
In-Reply-To: <1300973025-32497-1-git-send-email-jic23@cam.ac.uk>
No functional changes.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
---
kernel/params.c | 14 ++++----------
1 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/kernel/params.c b/kernel/params.c
index 0da1411..49d15fe 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -297,21 +297,15 @@ EXPORT_SYMBOL(param_ops_charp);
int param_set_bool(const char *val, const struct kernel_param *kp)
{
bool v;
+ int ret;
/* No equals means "set"... */
if (!val) val = "1";
/* One of =[yYnN01] */
- switch (val[0]) {
- case 'y': case 'Y': case '1':
- v = true;
- break;
- case 'n': case 'N': case '0':
- v = false;
- break;
- default:
- return -EINVAL;
- }
+ ret = usr_strtobool(val, &v);
+ if (ret)
+ return ret;
if (kp->flags & KPARAM_ISBOOL)
*(bool *)kp->arg = v;
--
1.7.3.4
next prev parent reply other threads:[~2011-03-24 13:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-24 13:23 [RFC PATCH 0/3 V2] Introduce usr_strtobool (previously kstrtobool) Jonathan Cameron
2011-03-24 13:23 ` [PATCH 1/3] Add a usr_strtobool function matching semantics of existing in kernel equivalents Jonathan Cameron
2011-04-19 1:36 ` Rusty Russell
2011-04-19 11:31 ` Jonathan Cameron
2011-03-24 13:23 ` [PATCH 2/3] debugfs: move to new usr_strtobool Jonathan Cameron
2011-03-24 13:23 ` Jonathan Cameron [this message]
2011-04-15 13:27 ` [RFC PATCH 0/3 V2] Introduce usr_strtobool (previously kstrtobool) Jonathan Cameron
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=1300973025-32497-4-git-send-email-jic23@cam.ac.uk \
--to=jic23@cam.ac.uk \
--cc=adobriyan@gmail.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.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®