mirror of
https://github.com/torvalds/linux.git
synced 2024-12-29 06:12:08 +00:00
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>
This commit is contained in:
parent
8c293509c8
commit
c8afb61649
@ -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 se_portal_group *se_tpg = to_tpg(item);
|
||||||
struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg);
|
struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg);
|
||||||
unsigned long op;
|
bool op;
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
|
|
||||||
ret = kstrtoul(page, 0, &op);
|
ret = strtobool(page, &op);
|
||||||
if (ret < 0)
|
if (ret)
|
||||||
return -EINVAL;
|
return ret;
|
||||||
if (op > 1)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
if (op && tpg->gadget_connect) {
|
if (op && tpg->gadget_connect) {
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
|
Loading…
Reference in New Issue
Block a user