usb: gadget: tcm: use strtobool for a boolean value
authorAndrzej Pietrasiewicz <andrzej.p@samsung.com>
Fri, 11 Dec 2015 15:06:18 +0000 (16:06 +0100)
committerNicholas Bellinger <nab@linux-iscsi.org>
Mon, 21 Dec 2015 03:40:28 +0000 (19:40 -0800)
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>
drivers/usb/gadget/legacy/tcm_usb_gadget.c

index b6e46a07ff9fe20144ddcf995a5c75f9c8a948b5..98064bbfc2a756786f0c9ee19d287e33c825fedd 100644 (file)
@@ -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;