summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/legacy
diff options
context:
space:
mode:
authorAndrzej Pietrasiewicz <andrzej.p@samsung.com>2015-12-11 16:06:18 +0100
committerNicholas Bellinger <nab@linux-iscsi.org>2015-12-20 19:40:28 -0800
commitc8afb616499e204440038556a5733338e215ce7f (patch)
tree3e69007493c4d8522bfb2418426d88ee001048dd /drivers/usb/gadget/legacy
parent8c293509c8c351af13863a2f6867c9fe9d4025b3 (diff)
downloadlinux-stable-c8afb616499e204440038556a5733338e215ce7f.tar.gz
linux-stable-c8afb616499e204440038556a5733338e215ce7f.tar.bz2
linux-stable-c8afb616499e204440038556a5733338e215ce7f.zip
usb: gadget: tcm: use strtobool for a boolean value
Simplify the function. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/usb/gadget/legacy')
-rw-r--r--drivers/usb/gadget/legacy/tcm_usb_gadget.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/usb/gadget/legacy/tcm_usb_gadget.c b/drivers/usb/gadget/legacy/tcm_usb_gadget.c
index b6e46a07ff9f..98064bbfc2a7 100644
--- a/drivers/usb/gadget/legacy/tcm_usb_gadget.c
+++ b/drivers/usb/gadget/legacy/tcm_usb_gadget.c
@@ -1496,14 +1496,12 @@ static ssize_t tcm_usbg_tpg_enable_store(struct config_item *item,
{
struct se_portal_group *se_tpg = to_tpg(item);
struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg);
- unsigned long op;
+ bool op;
ssize_t ret;
- ret = kstrtoul(page, 0, &op);
- if (ret < 0)
- return -EINVAL;
- if (op > 1)
- return -EINVAL;
+ ret = strtobool(page, &op);
+ if (ret)
+ return ret;
if (op && tpg->gadget_connect) {
ret = -EINVAL;