Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753426AbdFLR1e (ORCPT ); Mon, 12 Jun 2017 13:27:34 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:32789 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752142AbdFLR1a (ORCPT ); Mon, 12 Jun 2017 13:27:30 -0400 From: Tal Shorer To: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, gregkh@linuxfoundation.org, balbi@kernel.org, corbet@lwn.net Cc: Tal Shorer Subject: [PATCH 8/8] usb: gadget: u_serial: remove port_line_config from struct gserial Date: Mon, 12 Jun 2017 20:26:15 +0300 Message-Id: <1497288375-3559-9-git-send-email-tal.shorer@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1497288375-3559-1-git-send-email-tal.shorer@gmail.com> References: <1497288375-3559-1-git-send-email-tal.shorer@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3477 Lines: 102 GetLineCoding and SetLineCoding are a cdc-acm thing. It doesn't make sense to have that in the generic u_serial layer. Moreso, f_acm has its own port_line_coding in its own struct and it uses that, while the one in struct gserial is set once upon initialization and then never used. Also, the initialized never-used values were invalid, with bDataBits and bCharFormat having each other's value. Signed-off-by: Tal Shorer --- drivers/usb/gadget/function/u_serial.c | 22 ++-------------------- drivers/usb/gadget/function/u_serial.h | 3 --- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c index 8d9abf1..654d4a6 100644 --- a/drivers/usb/gadget/function/u_serial.c +++ b/drivers/usb/gadget/function/u_serial.c @@ -129,9 +129,6 @@ struct gs_port { wait_queue_head_t drain_wait; /* wait while writes drain */ bool write_busy; wait_queue_head_t close_wait; - - /* REVISIT this state ... */ - struct usb_cdc_line_coding port_line_coding; /* 8-N-1 etc */ }; static struct portmaster { @@ -1314,7 +1311,7 @@ static void gserial_console_exit(void) #endif static int -gs_port_alloc(unsigned port_num, struct usb_cdc_line_coding *coding) +gs_port_alloc(unsigned port_num) { struct gs_port *port; int ret = 0; @@ -1343,7 +1340,6 @@ gs_port_alloc(unsigned port_num, struct usb_cdc_line_coding *coding) INIT_LIST_HEAD(&port->write_pool); port->port_num = port_num; - port->port_line_coding = *coding; ports[port_num].port = port; out: @@ -1392,18 +1388,12 @@ EXPORT_SYMBOL_GPL(gserial_free_line); int gserial_alloc_line(unsigned char *line_num) { - struct usb_cdc_line_coding coding; struct device *tty_dev; int ret; int port_num; - coding.dwDTERate = cpu_to_le32(9600); - coding.bCharFormat = 8; - coding.bParityType = USB_CDC_NO_PARITY; - coding.bDataBits = USB_CDC_1_STOP_BITS; - for (port_num = 0; port_num < MAX_U_SERIAL_PORTS; port_num++) { - ret = gs_port_alloc(port_num, &coding); + ret = gs_port_alloc(port_num); if (ret == -EBUSY) continue; if (ret) @@ -1491,11 +1481,6 @@ int gserial_connect(struct gserial *gser, u8 port_num) gser->ioport = port; port->port_usb = gser; - /* REVISIT unclear how best to handle this state... - * we don't really couple it with the Linux TTY. - */ - gser->port_line_coding = port->port_line_coding; - /* REVISIT if waiting on "carrier detect", signal. */ /* if it's already open, start I/O ... and notify the serial @@ -1543,9 +1528,6 @@ void gserial_disconnect(struct gserial *gser) /* tell the TTY glue not to do I/O here any more */ spin_lock_irqsave(&port->port_lock, flags); - /* REVISIT as above: how best to track this? */ - port->port_line_coding = gser->port_line_coding; - port->port_usb = NULL; gser->ioport = NULL; if (port->port.count > 0 || port->openclose) { diff --git a/drivers/usb/gadget/function/u_serial.h b/drivers/usb/gadget/function/u_serial.h index 8d0901e..0549efe 100644 --- a/drivers/usb/gadget/function/u_serial.h +++ b/drivers/usb/gadget/function/u_serial.h @@ -44,9 +44,6 @@ struct gserial { struct usb_ep *in; struct usb_ep *out; - /* REVISIT avoid this CDC-ACM support harder ... */ - struct usb_cdc_line_coding port_line_coding; /* 9600-8-N-1 etc */ - /* notification callbacks */ void (*connect)(struct gserial *p); void (*disconnect)(struct gserial *p); -- 2.7.4