summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/f_acm.c
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2012-12-23 21:10:18 +0100
committerFelipe Balbi <balbi@ti.com>2013-04-03 14:43:31 +0300
commitc4ed4ac198495895fd1620cba15184c3b2d399dc (patch)
tree4b6d1601559aed0d29f8348c7460828d1ec27d85 /drivers/usb/gadget/f_acm.c
parentd6a0143985489e470a118605352f4b18df0ce142 (diff)
usb: gadget: push tty port allocation from gadget into f_acm
It possible to allocate the tty port number within the "instance" structure of the function and there is no need to expose this information within the gadget and therefore it is removed here. This patch converts only f_acm and all its users. The other gadgets will follow once the function is converted to the function interface. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/f_acm.c')
-rw-r--r--drivers/usb/gadget/f_acm.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/usb/gadget/f_acm.c b/drivers/usb/gadget/f_acm.c
index 61b33d23be72..ba7daaaad148 100644
--- a/drivers/usb/gadget/f_acm.c
+++ b/drivers/usb/gadget/f_acm.c
@@ -768,17 +768,24 @@ static void acm_free_instance(struct usb_function_instance *fi)
struct f_serial_opts *opts;
opts = container_of(fi, struct f_serial_opts, func_inst);
+ gserial_free_line(opts->port_num);
kfree(opts);
}
static struct usb_function_instance *acm_alloc_instance(void)
{
struct f_serial_opts *opts;
+ int ret;
opts = kzalloc(sizeof(*opts), GFP_KERNEL);
if (!opts)
return ERR_PTR(-ENOMEM);
opts->func_inst.free_func_inst = acm_free_instance;
+ ret = gserial_alloc_line(&opts->port_num);
+ if (ret) {
+ kfree(opts);
+ return ERR_PTR(ret);
+ }
return &opts->func_inst;
}
DECLARE_USB_FUNCTION_INIT(acm, acm_alloc_instance, acm_alloc_func);