diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2012-12-23 21:10:04 +0100 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2013-01-21 20:52:42 +0200 |
commit | 3249ca22c088c286d6227d8fae9c85a43a8ce9f6 (patch) | |
tree | d6e0cdc2abb6d862af760af9ec7c80691182ec7a /drivers/usb/gadget/u_serial.c | |
parent | 48177cd83792d25a5bab7f887acc47c2c314810e (diff) |
usb: gadget: u_serial: convert into a module
Every user of u_serial has now to select the U_SERIAL symbol instead of
including the file.
There is one limition with this: ports and and gs_tty_driver are global
variables in u_serial. Since all users share them, there can be only one
user loaded at a time i.e. either g_serial or g_nokia.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/u_serial.c')
-rw-r--r-- | drivers/usb/gadget/u_serial.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c index d0f95482f40e..1662d839a1d6 100644 --- a/drivers/usb/gadget/u_serial.c +++ b/drivers/usb/gadget/u_serial.c @@ -26,6 +26,7 @@ #include <linux/tty_flip.h> #include <linux/slab.h> #include <linux/export.h> +#include <linux/module.h> #include "u_serial.h" @@ -309,6 +310,7 @@ gs_alloc_req(struct usb_ep *ep, unsigned len, gfp_t kmalloc_flags) return req; } +EXPORT_SYMBOL_GPL(gs_alloc_req); /* * gs_free_req @@ -320,6 +322,7 @@ void gs_free_req(struct usb_ep *ep, struct usb_request *req) kfree(req->buf); usb_ep_free_request(ep, req); } +EXPORT_SYMBOL_GPL(gs_free_req); /* * gs_send_packet @@ -1081,6 +1084,9 @@ int gserial_setup(struct usb_gadget *g, unsigned count) if (count == 0 || count > N_PORTS) return -EINVAL; + if (gs_tty_driver) + return -EBUSY; + gs_tty_driver = alloc_tty_driver(count); if (!gs_tty_driver) return -ENOMEM; @@ -1153,6 +1159,7 @@ fail: gs_tty_driver = NULL; return status; } +EXPORT_SYMBOL_GPL(gserial_setup); static int gs_closed(struct gs_port *port) { @@ -1213,6 +1220,7 @@ void gserial_cleanup(void) pr_debug("%s: cleaned up ttyGS* support\n", __func__); } +EXPORT_SYMBOL_GPL(gserial_cleanup); /** * gserial_connect - notify TTY I/O glue that USB link is active @@ -1292,7 +1300,7 @@ fail_out: gser->in->driver_data = NULL; return status; } - +EXPORT_SYMBOL_GPL(gserial_connect); /** * gserial_disconnect - notify TTY I/O glue that USB link is inactive * @gser: the function, on which gserial_connect() was called @@ -1347,3 +1355,6 @@ void gserial_disconnect(struct gserial *gser) spin_unlock_irqrestore(&port->port_lock, flags); } +EXPORT_SYMBOL_GPL(gserial_disconnect); + +MODULE_LICENSE("GPL"); |