Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: gadget: f_tcm: remove redundant singleton

The only instance is guaranteed with TPG_INSTANCES defined to 1.

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>

authored by

Andrzej Pietrasiewicz and committed by
Nicholas Bellinger
c3f890bc e5587ea1

-11
-9
drivers/usb/gadget/function/f_tcm.c
··· 1371 1371 return 0; 1372 1372 } 1373 1373 1374 - struct usbg_tpg *the_only_tpg_I_currently_have; 1375 - 1376 1374 static struct se_portal_group *usbg_make_tpg( 1377 1375 struct se_wwn *wwn, 1378 1376 struct config_group *group, ··· 1388 1390 return ERR_PTR(-EINVAL); 1389 1391 if (kstrtoul(name + 5, 0, &tpgt) || tpgt > UINT_MAX) 1390 1392 return ERR_PTR(-EINVAL); 1391 - if (the_only_tpg_I_currently_have) { 1392 - pr_err("Until the gadget framework can't handle multiple\n"); 1393 - pr_err("gadgets, you can't do this here.\n"); 1394 - return ERR_PTR(-EBUSY); 1395 - } 1396 1393 ret = -ENODEV; 1397 1394 mutex_lock(&tpg_instances_lock); 1398 1395 for (i = 0; i < TPG_INSTANCES; ++i) ··· 1430 1437 tpg->fi = tpg_instances[i].func_inst; 1431 1438 mutex_unlock(&opts->dep_lock); 1432 1439 mutex_unlock(&tpg_instances_lock); 1433 - the_only_tpg_I_currently_have = tpg; 1434 1440 return &tpg->se_tpg; 1435 1441 1436 1442 free_workqueue: ··· 1473 1481 mutex_unlock(&tpg_instances_lock); 1474 1482 1475 1483 kfree(tpg); 1476 - the_only_tpg_I_currently_have = NULL; 1477 1484 } 1478 1485 1479 1486 static struct se_wwn *usbg_make_tport(
-2
drivers/usb/gadget/function/tcm.h
··· 129 129 struct usb_request *bot_req_out; 130 130 }; 131 131 132 - extern struct usbg_tpg *the_only_tpg_I_currently_have; 133 - 134 132 #endif /* __TARGET_USB_GADGET_H__ */