Skip to content

Commit

Permalink
usb: gadget: f_tcm: remove redundant singleton
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andrzej Pietrasiewicz authored and Nicholas Bellinger committed Dec 21, 2015
1 parent e5587ea commit c3f890b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 11 deletions.
9 changes: 0 additions & 9 deletions drivers/usb/gadget/function/f_tcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1371,8 +1371,6 @@ static int usbg_init_nodeacl(struct se_node_acl *se_nacl, const char *name)
return 0;
}

struct usbg_tpg *the_only_tpg_I_currently_have;

static struct se_portal_group *usbg_make_tpg(
struct se_wwn *wwn,
struct config_group *group,
Expand All @@ -1390,11 +1388,6 @@ static struct se_portal_group *usbg_make_tpg(
return ERR_PTR(-EINVAL);
if (kstrtoul(name + 5, 0, &tpgt) || tpgt > UINT_MAX)
return ERR_PTR(-EINVAL);
if (the_only_tpg_I_currently_have) {
pr_err("Until the gadget framework can't handle multiple\n");
pr_err("gadgets, you can't do this here.\n");
return ERR_PTR(-EBUSY);
}
ret = -ENODEV;
mutex_lock(&tpg_instances_lock);
for (i = 0; i < TPG_INSTANCES; ++i)
Expand Down Expand Up @@ -1437,7 +1430,6 @@ static struct se_portal_group *usbg_make_tpg(
tpg->fi = tpg_instances[i].func_inst;
mutex_unlock(&opts->dep_lock);
mutex_unlock(&tpg_instances_lock);
the_only_tpg_I_currently_have = tpg;
return &tpg->se_tpg;

free_workqueue:
Expand Down Expand Up @@ -1481,7 +1473,6 @@ static void usbg_drop_tpg(struct se_portal_group *se_tpg)
mutex_unlock(&tpg_instances_lock);

kfree(tpg);
the_only_tpg_I_currently_have = NULL;
}

static struct se_wwn *usbg_make_tport(
Expand Down
2 changes: 0 additions & 2 deletions drivers/usb/gadget/function/tcm.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,4 @@ struct f_uas {
struct usb_request *bot_req_out;
};

extern struct usbg_tpg *the_only_tpg_I_currently_have;

#endif /* __TARGET_USB_GADGET_H__ */

0 comments on commit c3f890b

Please sign in to comment.