Commit e2ffb77a authored by Andrzej Pietrasiewicz's avatar Andrzej Pietrasiewicz Committed by Nicholas Bellinger

usb: gadget: tcm: simplify attribute store function

Simplify function code.
Signed-off-by: default avatarAndrzej Pietrasiewicz <andrzej.p@samsung.com>
Acked-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent c8afb616
......@@ -1503,27 +1503,19 @@ static ssize_t tcm_usbg_tpg_enable_store(struct config_item *item,
if (ret)
return ret;
if (op && tpg->gadget_connect) {
ret = -EINVAL;
goto out;
}
if (!op && !tpg->gadget_connect) {
ret = -EINVAL;
goto out;
}
if ((op && tpg->gadget_connect) || (!op && !tpg->gadget_connect))
return -EINVAL;
if (op) {
if (op)
ret = usbg_attach(tpg);
if (ret)
goto out;
} else {
else
usbg_detach(tpg);
}
if (ret)
return ret;
tpg->gadget_connect = op;
return count;
out:
return ret;
}
static ssize_t tcm_usbg_tpg_nexus_show(struct config_item *item, char *page)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment