* [PATCH v1] s390/qeth: use kstrtobool() in qeth_bridgeport_hostnotification_store()
@ 2017-10-04 13:38 Andy Shevchenko
2017-10-05 8:22 ` Julian Wiedmann
0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2017-10-04 13:38 UTC (permalink / raw)
To: Julian Wiedmann, Ursula Braun, Martin Schwidefsky,
Heiko Carstens, linux-s390, David Miller, netdev
Cc: Andy Shevchenko
The sysfs enabled value is a boolean, so kstrtobool() is a better fit
for parsing the input string since it does the range checking for us.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/s390/net/qeth_l2_sys.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/s390/net/qeth_l2_sys.c b/drivers/s390/net/qeth_l2_sys.c
index 4608daedb204..470a4e5f3c62 100644
--- a/drivers/s390/net/qeth_l2_sys.c
+++ b/drivers/s390/net/qeth_l2_sys.c
@@ -146,18 +146,15 @@ static ssize_t qeth_bridgeport_hostnotification_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
struct qeth_card *card = dev_get_drvdata(dev);
- int rc = 0;
- int enable;
+ bool enable;
+ int rc;
if (!card)
return -EINVAL;
- if (sysfs_streq(buf, "0"))
- enable = 0;
- else if (sysfs_streq(buf, "1"))
- enable = 1;
- else
- return -EINVAL;
+ rc = kstrtobool(buf, &enable);
+ if (rc)
+ return rc;
mutex_lock(&card->conf_mutex);
--
2.14.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1] s390/qeth: use kstrtobool() in qeth_bridgeport_hostnotification_store()
2017-10-04 13:38 [PATCH v1] s390/qeth: use kstrtobool() in qeth_bridgeport_hostnotification_store() Andy Shevchenko
@ 2017-10-05 8:22 ` Julian Wiedmann
0 siblings, 0 replies; 2+ messages in thread
From: Julian Wiedmann @ 2017-10-05 8:22 UTC (permalink / raw)
To: Andy Shevchenko, Ursula Braun, Martin Schwidefsky,
Heiko Carstens, linux-s390, David Miller, netdev
On 10/04/2017 03:38 PM, Andy Shevchenko wrote:
> The sysfs enabled value is a boolean, so kstrtobool() is a better fit
> for parsing the input string since it does the range checking for us.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
Thanks Andy, queued up for our next upstream submission.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-10-05 8:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-04 13:38 [PATCH v1] s390/qeth: use kstrtobool() in qeth_bridgeport_hostnotification_store() Andy Shevchenko
2017-10-05 8:22 ` Julian Wiedmann
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.