From 919568691df41e655a6dac2b7a5f94befeedaf71 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 18 Aug 2016 09:45:06 -0400 Subject: [PATCH 1/6] USB: serial: use IS_ENABLED() instead of checking for built-in or module The IS_ENABLED() macro checks if a Kconfig symbol has been enabled either built-in or as a module, use that macro instead of open coding the same. Using the macro makes the code more readable by helping abstract away some of the Kconfig built-in and module enable details. Signed-off-by: Javier Martinez Canillas Signed-off-by: Johan Hovold --- drivers/usb/serial/keyspan_pda.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index 4f7e072e4e00..e49ad0c63ad8 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c @@ -30,12 +30,12 @@ #include /* make a simple define to handle if we are compiling keyspan_pda or xircom support */ -#if defined(CONFIG_USB_SERIAL_KEYSPAN_PDA) || defined(CONFIG_USB_SERIAL_KEYSPAN_PDA_MODULE) +#if IS_ENABLED(CONFIG_USB_SERIAL_KEYSPAN_PDA) #define KEYSPAN #else #undef KEYSPAN #endif -#if defined(CONFIG_USB_SERIAL_XIRCOM) || defined(CONFIG_USB_SERIAL_XIRCOM_MODULE) +#if IS_ENABLED(CONFIG_USB_SERIAL_XIRCOM) #define XIRCOM #else #undef XIRCOM From f1054b2d6a6b7b87c91467a301c2c08413f92d86 Mon Sep 17 00:00:00 2001 From: Mathieu OTHACEHE Date: Tue, 26 Jul 2016 19:59:41 +0200 Subject: [PATCH 2/6] USB: serial: ti_usb_3410_5052: do not use __uX types __uX types should only be used for user-space interactions. Also clean up uart-config endianess handling, and drop some redundant casts. Signed-off-by: Mathieu OTHACEHE [ johan: amend commit message ] Signed-off-by: Johan Hovold --- drivers/usb/serial/ti_usb_3410_5052.c | 99 ++++++++++++++------------- 1 file changed, 50 insertions(+), 49 deletions(-) diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 07b4bf01061d..7f3d2c71bb54 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c @@ -179,23 +179,23 @@ /* Config struct */ struct ti_uart_config { - __u16 wBaudRate; - __u16 wFlags; - __u8 bDataBits; - __u8 bParity; - __u8 bStopBits; + __be16 wBaudRate; + __be16 wFlags; + u8 bDataBits; + u8 bParity; + u8 bStopBits; char cXon; char cXoff; - __u8 bUartMode; + u8 bUartMode; } __packed; /* Get port status */ struct ti_port_status { - __u8 bCmdCode; - __u8 bModuleId; - __u8 bErrorCode; - __u8 bMSR; - __u8 bLSR; + u8 bCmdCode; + u8 bModuleId; + u8 bErrorCode; + u8 bMSR; + u8 bLSR; } __packed; /* Purge modes */ @@ -218,12 +218,12 @@ struct ti_port_status { #define TI_RW_DATA_DOUBLE_WORD 0x04 struct ti_write_data_bytes { - __u8 bAddrType; - __u8 bDataType; - __u8 bDataCounter; + u8 bAddrType; + u8 bDataType; + u8 bDataCounter; __be16 wBaseAddrHi; __be16 wBaseAddrLo; - __u8 bData[0]; + u8 bData[0]; } __packed; struct ti_read_data_request { @@ -258,7 +258,7 @@ struct ti_interrupt { /* Firmware image header */ struct ti_firmware_header { __le16 wLength; - __u8 bCheckSum; + u8 bCheckSum; } __packed; /* UART addresses */ @@ -288,9 +288,9 @@ struct ti_firmware_header { struct ti_port { int tp_is_open; - __u8 tp_msr; - __u8 tp_shadow_mcr; - __u8 tp_uart_mode; /* 232 or 485 modes */ + u8 tp_msr; + u8 tp_shadow_mcr; + u8 tp_uart_mode; /* 232 or 485 modes */ unsigned int tp_uart_base_addr; int tp_flags; struct ti_device *tp_tdev; @@ -343,7 +343,7 @@ static int ti_get_serial_info(struct ti_port *tport, struct serial_struct __user *ret_arg); static int ti_set_serial_info(struct tty_struct *tty, struct ti_port *tport, struct serial_struct __user *new_arg); -static void ti_handle_new_msr(struct ti_port *tport, __u8 msr); +static void ti_handle_new_msr(struct ti_port *tport, u8 msr); static void ti_stop_read(struct ti_port *tport, struct tty_struct *tty); static int ti_restart_read(struct ti_port *tport, struct tty_struct *tty); @@ -354,7 +354,7 @@ static int ti_command_in_sync(struct ti_device *tdev, __u8 command, __u16 moduleid, __u16 value, __u8 *data, int size); static int ti_write_byte(struct usb_serial_port *port, struct ti_device *tdev, - unsigned long addr, __u8 mask, __u8 byte); + unsigned long addr, u8 mask, u8 byte); static int ti_download_firmware(struct ti_device *tdev); @@ -647,9 +647,11 @@ static int ti_open(struct tty_struct *tty, struct usb_serial_port *port) struct urb *urb; int port_number; int status; - __u16 open_settings = (__u8)(TI_PIPE_MODE_CONTINUOUS | - TI_PIPE_TIMEOUT_ENABLE | - (TI_TRANSFER_TIMEOUT << 2)); + u16 open_settings; + + open_settings = (TI_PIPE_MODE_CONTINUOUS | + TI_PIPE_TIMEOUT_ENABLE | + (TI_TRANSFER_TIMEOUT << 2)); if (tport == NULL) return -ENODEV; @@ -959,6 +961,8 @@ static void ti_set_termios(struct tty_struct *tty, int status; int port_number = port->port_number; unsigned int mcr; + u16 wbaudrate; + u16 wflags = 0; cflag = tty->termios.c_cflag; iflag = tty->termios.c_iflag; @@ -974,12 +978,10 @@ static void ti_set_termios(struct tty_struct *tty, if (!config) return; - config->wFlags = 0; - /* these flags must be set */ - config->wFlags |= TI_UART_ENABLE_MS_INTS; - config->wFlags |= TI_UART_ENABLE_AUTO_START_DMA; - config->bUartMode = (__u8)(tport->tp_uart_mode); + wflags |= TI_UART_ENABLE_MS_INTS; + wflags |= TI_UART_ENABLE_AUTO_START_DMA; + config->bUartMode = tport->tp_uart_mode; switch (cflag & CSIZE) { case CS5: @@ -1002,14 +1004,14 @@ static void ti_set_termios(struct tty_struct *tty, if (cflag & PARENB) { if (cflag & PARODD) { - config->wFlags |= TI_UART_ENABLE_PARITY_CHECKING; + wflags |= TI_UART_ENABLE_PARITY_CHECKING; config->bParity = TI_UART_ODD_PARITY; } else { - config->wFlags |= TI_UART_ENABLE_PARITY_CHECKING; + wflags |= TI_UART_ENABLE_PARITY_CHECKING; config->bParity = TI_UART_EVEN_PARITY; } } else { - config->wFlags &= ~TI_UART_ENABLE_PARITY_CHECKING; + wflags &= ~TI_UART_ENABLE_PARITY_CHECKING; config->bParity = TI_UART_NO_PARITY; } @@ -1021,8 +1023,8 @@ static void ti_set_termios(struct tty_struct *tty, if (cflag & CRTSCTS) { /* RTS flow control must be off to drop RTS for baud rate B0 */ if ((cflag & CBAUD) != B0) - config->wFlags |= TI_UART_ENABLE_RTS_IN; - config->wFlags |= TI_UART_ENABLE_CTS_OUT; + wflags |= TI_UART_ENABLE_RTS_IN; + wflags |= TI_UART_ENABLE_CTS_OUT; } else { ti_restart_read(tport, tty); } @@ -1032,21 +1034,21 @@ static void ti_set_termios(struct tty_struct *tty, config->cXoff = STOP_CHAR(tty); if (I_IXOFF(tty)) - config->wFlags |= TI_UART_ENABLE_X_IN; + wflags |= TI_UART_ENABLE_X_IN; else ti_restart_read(tport, tty); if (I_IXON(tty)) - config->wFlags |= TI_UART_ENABLE_X_OUT; + wflags |= TI_UART_ENABLE_X_OUT; } baud = tty_get_baud_rate(tty); if (!baud) baud = 9600; if (tport->tp_tdev->td_is_3410) - config->wBaudRate = (__u16)((923077 + baud/2) / baud); + wbaudrate = (923077 + baud/2) / baud; else - config->wBaudRate = (__u16)((461538 + baud/2) / baud); + wbaudrate = (461538 + baud/2) / baud; /* FIXME: Should calculate resulting baud here and report it back */ if ((cflag & CBAUD) != B0) @@ -1054,12 +1056,12 @@ static void ti_set_termios(struct tty_struct *tty, dev_dbg(&port->dev, "%s - BaudRate=%d, wBaudRate=%d, wFlags=0x%04X, bDataBits=%d, bParity=%d, bStopBits=%d, cXon=%d, cXoff=%d, bUartMode=%d\n", - __func__, baud, config->wBaudRate, config->wFlags, + __func__, baud, wbaudrate, wflags, config->bDataBits, config->bParity, config->bStopBits, config->cXon, config->cXoff, config->bUartMode); - cpu_to_be16s(&config->wBaudRate); - cpu_to_be16s(&config->wFlags); + config->wBaudRate = cpu_to_be16(wbaudrate); + config->wFlags = cpu_to_be16(wflags); status = ti_command_out_sync(tport->tp_tdev, TI_SET_CONFIG, (__u8)(TI_UART1_PORT + port_number), 0, (__u8 *)config, @@ -1189,7 +1191,7 @@ static void ti_interrupt_callback(struct urb *urb) int function; int status = urb->status; int retval; - __u8 msr; + u8 msr; switch (status) { case 0: @@ -1522,7 +1524,7 @@ static int ti_set_serial_info(struct tty_struct *tty, struct ti_port *tport, } -static void ti_handle_new_msr(struct ti_port *tport, __u8 msr) +static void ti_handle_new_msr(struct ti_port *tport, u8 msr) { struct async_icount *icount; struct tty_struct *tty; @@ -1634,8 +1636,8 @@ static int ti_command_in_sync(struct ti_device *tdev, __u8 command, static int ti_write_byte(struct usb_serial_port *port, - struct ti_device *tdev, unsigned long addr, - __u8 mask, __u8 byte) + struct ti_device *tdev, unsigned long addr, + u8 mask, u8 byte) { int status; unsigned int size; @@ -1679,11 +1681,10 @@ static int ti_do_download(struct usb_device *dev, int pipe, int len; for (pos = sizeof(struct ti_firmware_header); pos < size; pos++) - cs = (__u8)(cs + buffer[pos]); + cs = (u8)(cs + buffer[pos]); header = (struct ti_firmware_header *)buffer; - header->wLength = cpu_to_le16((__u16)(size - - sizeof(struct ti_firmware_header))); + header->wLength = cpu_to_le16(size - sizeof(*header)); header->bCheckSum = cs; dev_dbg(&dev->dev, "%s - downloading firmware\n", __func__); @@ -1701,7 +1702,7 @@ static int ti_download_firmware(struct ti_device *tdev) { int status; int buffer_size; - __u8 *buffer; + u8 *buffer; struct usb_device *dev = tdev->td_serial->dev; unsigned int pipe = usb_sndbulkpipe(dev, tdev->td_serial->port[0]->bulk_out_endpointAddress); From 14e3c97c2db8735b5304379dd4e6cfe1d68a7a49 Mon Sep 17 00:00:00 2001 From: Mathieu OTHACEHE Date: Tue, 26 Jul 2016 19:59:42 +0200 Subject: [PATCH 3/6] USB: serial: ti_usb_3410_5052: remove useless dev_dbg messages Remove useless or redundant dev_dbg messages. Signed-off-by: Mathieu OTHACEHE [ johan: drop an unrelated change ] Signed-off-by: Johan Hovold --- drivers/usb/serial/ti_usb_3410_5052.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 7f3d2c71bb54..4dc2514526d1 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c @@ -688,7 +688,6 @@ static int ti_open(struct tty_struct *tty, struct usb_serial_port *port) if (tty) ti_set_termios(tty, port, &tty->termios); - dev_dbg(&port->dev, "%s - sending TI_OPEN_PORT\n", __func__); status = ti_command_out_sync(tdev, TI_OPEN_PORT, (__u8)(TI_UART1_PORT + port_number), open_settings, NULL, 0); if (status) { @@ -697,7 +696,6 @@ static int ti_open(struct tty_struct *tty, struct usb_serial_port *port) goto unlink_int_urb; } - dev_dbg(&port->dev, "%s - sending TI_START_PORT\n", __func__); status = ti_command_out_sync(tdev, TI_START_PORT, (__u8)(TI_UART1_PORT + port_number), 0, NULL, 0); if (status) { @@ -706,7 +704,6 @@ static int ti_open(struct tty_struct *tty, struct usb_serial_port *port) goto unlink_int_urb; } - dev_dbg(&port->dev, "%s - sending TI_PURGE_PORT\n", __func__); status = ti_command_out_sync(tdev, TI_PURGE_PORT, (__u8)(TI_UART1_PORT + port_number), TI_PURGE_INPUT, NULL, 0); if (status) { @@ -730,7 +727,6 @@ static int ti_open(struct tty_struct *tty, struct usb_serial_port *port) if (tty) ti_set_termios(tty, port, &tty->termios); - dev_dbg(&port->dev, "%s - sending TI_OPEN_PORT (2)\n", __func__); status = ti_command_out_sync(tdev, TI_OPEN_PORT, (__u8)(TI_UART1_PORT + port_number), open_settings, NULL, 0); if (status) { @@ -739,7 +735,6 @@ static int ti_open(struct tty_struct *tty, struct usb_serial_port *port) goto unlink_int_urb; } - dev_dbg(&port->dev, "%s - sending TI_START_PORT (2)\n", __func__); status = ti_command_out_sync(tdev, TI_START_PORT, (__u8)(TI_UART1_PORT + port_number), 0, NULL, 0); if (status) { @@ -749,7 +744,6 @@ static int ti_open(struct tty_struct *tty, struct usb_serial_port *port) } /* start read urb */ - dev_dbg(&port->dev, "%s - start read urb\n", __func__); urb = port->read_urb; if (!urb) { dev_err(&port->dev, "%s - no read urb\n", __func__); @@ -775,7 +769,6 @@ static int ti_open(struct tty_struct *tty, struct usb_serial_port *port) usb_kill_urb(port->serial->port[0]->interrupt_in_urb); release_lock: mutex_unlock(&tdev->td_open_close_lock); - dev_dbg(&port->dev, "%s - exit %d\n", __func__, status); return status; } @@ -805,7 +798,6 @@ static void ti_close(struct usb_serial_port *port) port_number = port->port_number; - dev_dbg(&port->dev, "%s - sending TI_CLOSE_PORT\n", __func__); status = ti_command_out_sync(tdev, TI_CLOSE_PORT, (__u8)(TI_UART1_PORT + port_number), 0, NULL, 0); if (status) @@ -832,7 +824,6 @@ static int ti_write(struct tty_struct *tty, struct usb_serial_port *port, struct ti_port *tport = usb_get_serial_port_data(port); if (count == 0) { - dev_dbg(&port->dev, "%s - write request of 0 bytes\n", __func__); return 0; } @@ -939,11 +930,9 @@ static int ti_ioctl(struct tty_struct *tty, switch (cmd) { case TIOCGSERIAL: - dev_dbg(&port->dev, "%s - TIOCGSERIAL\n", __func__); return ti_get_serial_info(tport, (struct serial_struct __user *)arg); case TIOCSSERIAL: - dev_dbg(&port->dev, "%s - TIOCSSERIAL\n", __func__); return ti_set_serial_info(tty, tport, (struct serial_struct __user *)arg); } From 98ba0853e7c8266fe48490d466c88d68121a0917 Mon Sep 17 00:00:00 2001 From: Mathieu OTHACEHE Date: Tue, 26 Jul 2016 19:59:44 +0200 Subject: [PATCH 4/6] USB: serial: ti_usb_3410_5052: remove useless NULL-testing It is useless to check the return of usb_get_serial_port_data in the tty and tty-port callbacks. No need to check interface private data in close() either. Signed-off-by: Mathieu OTHACEHE [ johan: amend commit message ] Signed-off-by: Johan Hovold --- drivers/usb/serial/ti_usb_3410_5052.c | 34 +-------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 4dc2514526d1..cbd67edff7aa 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c @@ -653,9 +653,6 @@ static int ti_open(struct tty_struct *tty, struct usb_serial_port *port) TI_PIPE_TIMEOUT_ENABLE | (TI_TRANSFER_TIMEOUT << 2)); - if (tport == NULL) - return -ENODEV; - dev = port->serial->dev; tdev = tport->tp_tdev; @@ -784,8 +781,6 @@ static void ti_close(struct usb_serial_port *port) tdev = usb_get_serial_data(port->serial); tport = usb_get_serial_port_data(port); - if (tdev == NULL || tport == NULL) - return; tport->tp_is_open = 0; @@ -827,7 +822,7 @@ static int ti_write(struct tty_struct *tty, struct usb_serial_port *port, return 0; } - if (tport == NULL || !tport->tp_is_open) + if (!tport->tp_is_open) return -ENODEV; count = kfifo_in_locked(&port->write_fifo, data, count, @@ -845,9 +840,6 @@ static int ti_write_room(struct tty_struct *tty) int room = 0; unsigned long flags; - if (tport == NULL) - return 0; - spin_lock_irqsave(&tport->tp_lock, flags); room = kfifo_avail(&port->write_fifo); spin_unlock_irqrestore(&tport->tp_lock, flags); @@ -864,9 +856,6 @@ static int ti_chars_in_buffer(struct tty_struct *tty) int chars = 0; unsigned long flags; - if (tport == NULL) - return 0; - spin_lock_irqsave(&tport->tp_lock, flags); chars = kfifo_len(&port->write_fifo); spin_unlock_irqrestore(&tport->tp_lock, flags); @@ -893,9 +882,6 @@ static void ti_throttle(struct tty_struct *tty) struct usb_serial_port *port = tty->driver_data; struct ti_port *tport = usb_get_serial_port_data(port); - if (tport == NULL) - return; - if (I_IXOFF(tty) || C_CRTSCTS(tty)) ti_stop_read(tport, tty); @@ -908,9 +894,6 @@ static void ti_unthrottle(struct tty_struct *tty) struct ti_port *tport = usb_get_serial_port_data(port); int status; - if (tport == NULL) - return; - if (I_IXOFF(tty) || C_CRTSCTS(tty)) { status = ti_restart_read(tport, tty); if (status) @@ -925,9 +908,6 @@ static int ti_ioctl(struct tty_struct *tty, struct usb_serial_port *port = tty->driver_data; struct ti_port *tport = usb_get_serial_port_data(port); - if (tport == NULL) - return -ENODEV; - switch (cmd) { case TIOCGSERIAL: return ti_get_serial_info(tport, @@ -960,9 +940,6 @@ static void ti_set_termios(struct tty_struct *tty, dev_dbg(&port->dev, "%s - old clfag %08x, old iflag %08x\n", __func__, old_termios->c_cflag, old_termios->c_iflag); - if (tport == NULL) - return; - config = kmalloc(sizeof(*config), GFP_KERNEL); if (!config) return; @@ -1083,9 +1060,6 @@ static int ti_tiocmget(struct tty_struct *tty) unsigned int mcr; unsigned long flags; - if (tport == NULL) - return -ENODEV; - spin_lock_irqsave(&tport->tp_lock, flags); msr = tport->tp_msr; mcr = tport->tp_shadow_mcr; @@ -1113,9 +1087,6 @@ static int ti_tiocmset(struct tty_struct *tty, unsigned int mcr; unsigned long flags; - if (tport == NULL) - return -ENODEV; - spin_lock_irqsave(&tport->tp_lock, flags); mcr = tport->tp_shadow_mcr; @@ -1146,9 +1117,6 @@ static void ti_break(struct tty_struct *tty, int break_state) dev_dbg(&port->dev, "%s - state = %d\n", __func__, break_state); - if (tport == NULL) - return; - status = ti_write_byte(port, tport->tp_tdev, tport->tp_uart_base_addr + TI_UART_OFFSET_LCR, TI_LCR_BREAK, break_state == -1 ? TI_LCR_BREAK : 0); From 38d6d23f31a20a6557174d2ab4bdaa0cc713d67c Mon Sep 17 00:00:00 2001 From: Mathieu OTHACEHE Date: Tue, 26 Jul 2016 19:59:45 +0200 Subject: [PATCH 5/6] USB: serial: ti_usb_3410_5052: use C_X macros Use C_X tty.h macros to avoid direct manipulation of termios c_cflag variable. Signed-off-by: Mathieu OTHACEHE Signed-off-by: Johan Hovold --- drivers/usb/serial/ti_usb_3410_5052.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index cbd67edff7aa..5c7b27a04b56 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c @@ -949,7 +949,7 @@ static void ti_set_termios(struct tty_struct *tty, wflags |= TI_UART_ENABLE_AUTO_START_DMA; config->bUartMode = tport->tp_uart_mode; - switch (cflag & CSIZE) { + switch (C_CSIZE(tty)) { case CS5: config->bDataBits = TI_UART_5_DATA_BITS; break; @@ -968,8 +968,8 @@ static void ti_set_termios(struct tty_struct *tty, /* CMSPAR isn't supported by this driver */ tty->termios.c_cflag &= ~CMSPAR; - if (cflag & PARENB) { - if (cflag & PARODD) { + if (C_PARENB(tty)) { + if (C_PARODD(tty)) { wflags |= TI_UART_ENABLE_PARITY_CHECKING; config->bParity = TI_UART_ODD_PARITY; } else { @@ -981,14 +981,14 @@ static void ti_set_termios(struct tty_struct *tty, config->bParity = TI_UART_NO_PARITY; } - if (cflag & CSTOPB) + if (C_CSTOPB(tty)) config->bStopBits = TI_UART_2_STOP_BITS; else config->bStopBits = TI_UART_1_STOP_BITS; - if (cflag & CRTSCTS) { + if (C_CRTSCTS(tty)) { /* RTS flow control must be off to drop RTS for baud rate B0 */ - if ((cflag & CBAUD) != B0) + if ((C_BAUD(tty)) != B0) wflags |= TI_UART_ENABLE_RTS_IN; wflags |= TI_UART_ENABLE_CTS_OUT; } else { @@ -1017,7 +1017,7 @@ static void ti_set_termios(struct tty_struct *tty, wbaudrate = (461538 + baud/2) / baud; /* FIXME: Should calculate resulting baud here and report it back */ - if ((cflag & CBAUD) != B0) + if ((C_BAUD(tty)) != B0) tty_encode_baud_rate(tty, baud, baud); dev_dbg(&port->dev, @@ -1039,7 +1039,7 @@ static void ti_set_termios(struct tty_struct *tty, /* SET_CONFIG asserts RTS and DTR, reset them correctly */ mcr = tport->tp_shadow_mcr; /* if baud rate is B0, clear RTS and DTR */ - if ((cflag & CBAUD) == B0) + if (C_BAUD(tty) == B0) mcr &= ~(TI_MCR_DTR | TI_MCR_RTS); status = ti_set_mcr(tport, mcr); if (status) From 61fc51366b395f1441c7cd3615fb18837a4fa2f8 Mon Sep 17 00:00:00 2001 From: Mathieu OTHACEHE Date: Tue, 26 Jul 2016 19:59:46 +0200 Subject: [PATCH 6/6] USB: serial: ti_usb_3410_5052: remove unused variables Remove variables affected but never read. Also drop the now unused TI_SET_SERIAL_FLAGS define. Signed-off-by: Mathieu OTHACEHE [ johan: drop TI_SET_SERIAL_FLAGS ] Signed-off-by: Johan Hovold --- drivers/usb/serial/ti_usb_3410_5052.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 5c7b27a04b56..a8b9bdba314f 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c @@ -276,9 +276,6 @@ struct ti_firmware_header { #define TI_DEFAULT_CLOSING_WAIT 4000 /* in .01 secs */ -/* supported setserial flags */ -#define TI_SET_SERIAL_FLAGS 0 - /* read urb states */ #define TI_READ_URB_RUNNING 0 #define TI_READ_URB_STOPPING 1 @@ -292,7 +289,6 @@ struct ti_port { u8 tp_shadow_mcr; u8 tp_uart_mode; /* 232 or 485 modes */ unsigned int tp_uart_base_addr; - int tp_flags; struct ti_device *tp_tdev; struct usb_serial_port *tp_port; spinlock_t tp_lock; @@ -306,7 +302,6 @@ struct ti_device { struct usb_serial *td_serial; int td_is_3410; bool td_rs485_only; - int td_urb_error; }; static int ti_startup(struct usb_serial *serial); @@ -1157,11 +1152,9 @@ static void ti_interrupt_callback(struct urb *urb) case -ENOENT: case -ESHUTDOWN: dev_dbg(dev, "%s - urb shutting down, %d\n", __func__, status); - tdev->td_urb_error = 1; return; default: dev_err(dev, "%s - nonzero urb status, %d\n", __func__, status); - tdev->td_urb_error = 1; goto exit; } @@ -1234,12 +1227,10 @@ static void ti_bulk_in_callback(struct urb *urb) case -ENOENT: case -ESHUTDOWN: dev_dbg(dev, "%s - urb shutting down, %d\n", __func__, status); - tport->tp_tdev->td_urb_error = 1; return; default: dev_err(dev, "%s - nonzero urb status, %d\n", __func__, status); - tport->tp_tdev->td_urb_error = 1; } if (status == -EPIPE) @@ -1294,12 +1285,10 @@ static void ti_bulk_out_callback(struct urb *urb) case -ENOENT: case -ESHUTDOWN: dev_dbg(&port->dev, "%s - urb shutting down, %d\n", __func__, status); - tport->tp_tdev->td_urb_error = 1; return; default: dev_err_console(port, "%s - nonzero urb status, %d\n", __func__, status); - tport->tp_tdev->td_urb_error = 1; } /* send any buffered data */ @@ -1449,7 +1438,6 @@ static int ti_get_serial_info(struct ti_port *tport, ret_serial.type = PORT_16550A; ret_serial.line = port->minor; ret_serial.port = port->port_number; - ret_serial.flags = tport->tp_flags; ret_serial.xmit_fifo_size = kfifo_size(&port->write_fifo); ret_serial.baud_base = tport->tp_tdev->td_is_3410 ? 921600 : 460800; ret_serial.closing_wait = cwait; @@ -1474,7 +1462,6 @@ static int ti_set_serial_info(struct tty_struct *tty, struct ti_port *tport, if (cwait != ASYNC_CLOSING_WAIT_NONE) cwait = msecs_to_jiffies(10 * new_serial.closing_wait); - tport->tp_flags = new_serial.flags & TI_SET_SERIAL_FLAGS; tport->tp_port->port.closing_wait = cwait; return 0;