]> git.karo-electronics.de Git - karo-tx-linux.git/commit
usb: gadget: allocate & giveback serial ports instead hard code them
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Sun, 23 Dec 2012 20:10:06 +0000 (21:10 +0100)
committerFelipe Balbi <balbi@ti.com>
Mon, 21 Jan 2013 18:52:43 +0000 (20:52 +0200)
commit19b10a8828a6cdd5a4e7e37babd5084d35641f87
tree636a228ed32d975a8214639b17b4d7a595fdf7b4
parentb473577854fea63055ff9ab84f0f52a3e8aed15e
usb: gadget: allocate & giveback serial ports instead hard code them

This patch removes gserial_setup() and gserial_cleanup() and adds
gserial_alloc_line() and gserial_free_line() to replace them.

The initial setup of u_serial happens now on module load time. A
maximum of four TTY ports can be requested which is the current limit.
In theory we could extend this limit, the hard limit is the number of
available endpoints.
alloc_tty_driver() is now called at module init time with the max
available ports. The per-line footprint here is on 32bit is 3 * size of
pointer + 60 bytes (for cdevs).
The remaining memory (struct gs_port) is allocated once a port is
requested.

With this change it is possible to load g_multi and g_serial at the same
time. GS0 receives the module that is loaded first, GS1 is received by
the next module and so on. With the configfs interface the port number
can be exported and the device node is more predictable. Nothing changes
for g_serial and friends as long as one module is used.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/acm_ms.c
drivers/usb/gadget/cdc2.c
drivers/usb/gadget/dbgp.c
drivers/usb/gadget/f_acm.c
drivers/usb/gadget/f_obex.c
drivers/usb/gadget/f_serial.c
drivers/usb/gadget/multi.c
drivers/usb/gadget/nokia.c
drivers/usb/gadget/serial.c
drivers/usb/gadget/u_serial.c
drivers/usb/gadget/u_serial.h