Prevent OBEX serial port from ever becoming a console. Signed-off-by: Michał Mirosław <mirq-linux@xxxxxxxxxxxx> --- drivers/usb/gadget/function/f_acm.c | 2 +- drivers/usb/gadget/function/f_obex.c | 2 +- drivers/usb/gadget/function/f_serial.c | 2 +- drivers/usb/gadget/function/u_serial.c | 4 ++-- drivers/usb/gadget/function/u_serial.h | 2 +- drivers/usb/gadget/legacy/dbgp.c | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/usb/gadget/function/f_acm.c b/drivers/usb/gadget/function/f_acm.c index 9fc98de83624..60d18c7dcef3 100644 --- a/drivers/usb/gadget/function/f_acm.c +++ b/drivers/usb/gadget/function/f_acm.c @@ -807,7 +807,7 @@ static struct usb_function_instance *acm_alloc_instance(void) if (!opts) return ERR_PTR(-ENOMEM); opts->func_inst.free_func_inst = acm_free_instance; - ret = gserial_alloc_line(&opts->port_num); + ret = gserial_alloc_line(&opts->port_num, true); if (ret) { kfree(opts); return ERR_PTR(ret); diff --git a/drivers/usb/gadget/function/f_obex.c b/drivers/usb/gadget/function/f_obex.c index 55b7f57d2dc7..8242ba76dc1e 100644 --- a/drivers/usb/gadget/function/f_obex.c +++ b/drivers/usb/gadget/function/f_obex.c @@ -432,7 +432,7 @@ static struct usb_function_instance *obex_alloc_inst(void) return ERR_PTR(-ENOMEM); opts->func_inst.free_func_inst = obex_free_inst; - ret = gserial_alloc_line(&opts->port_num); + ret = gserial_alloc_line(&opts->port_num, false); if (ret) { kfree(opts); return ERR_PTR(ret); diff --git a/drivers/usb/gadget/function/f_serial.c b/drivers/usb/gadget/function/f_serial.c index c860f30a0ea2..788179a9a23c 100644 --- a/drivers/usb/gadget/function/f_serial.c +++ b/drivers/usb/gadget/function/f_serial.c @@ -303,7 +303,7 @@ static struct usb_function_instance *gser_alloc_inst(void) return ERR_PTR(-ENOMEM); opts->func_inst.free_func_inst = gser_free_inst; - ret = gserial_alloc_line(&opts->port_num); + ret = gserial_alloc_line(&opts->port_num, true); if (ret) { kfree(opts); return ERR_PTR(ret); diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c index 8d2d861e1543..dd138d372940 100644 --- a/drivers/usb/gadget/function/u_serial.c +++ b/drivers/usb/gadget/function/u_serial.c @@ -1179,7 +1179,7 @@ void gserial_free_line(unsigned char port_num) } EXPORT_SYMBOL_GPL(gserial_free_line); -int gserial_alloc_line(unsigned char *line_num) +int gserial_alloc_line(unsigned char *line_num, bool maybe_console) { struct usb_cdc_line_coding coding; struct gs_port *port; @@ -1221,7 +1221,7 @@ int gserial_alloc_line(unsigned char *line_num) } *line_num = port_num; - if (!port_num) + if (maybe_console && !port_num) gs_console_init(port); err: return ret; diff --git a/drivers/usb/gadget/function/u_serial.h b/drivers/usb/gadget/function/u_serial.h index 9acaac1cbb75..40e89ddfe90e 100644 --- a/drivers/usb/gadget/function/u_serial.h +++ b/drivers/usb/gadget/function/u_serial.h @@ -54,7 +54,7 @@ struct usb_request *gs_alloc_req(struct usb_ep *ep, unsigned len, gfp_t flags); void gs_free_req(struct usb_ep *, struct usb_request *req); /* management of individual TTY ports */ -int gserial_alloc_line(unsigned char *port_line); +int gserial_alloc_line(unsigned char *port_line, bool maybe_console); void gserial_free_line(unsigned char port_line); /* connect/disconnect is handled by individual functions */ diff --git a/drivers/usb/gadget/legacy/dbgp.c b/drivers/usb/gadget/legacy/dbgp.c index e1d566c9918a..a6785a4a1ac6 100644 --- a/drivers/usb/gadget/legacy/dbgp.c +++ b/drivers/usb/gadget/legacy/dbgp.c @@ -305,7 +305,7 @@ static int dbgp_bind(struct usb_gadget *gadget, goto fail; } - if (gserial_alloc_line(&tty_line)) { + if (gserial_alloc_line(&tty_line, true)) { stp = 4; err = -ENODEV; goto fail; -- 2.20.1