From patchwork Wed Jul 8 12:49:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11651577 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 011536C1 for ; Wed, 8 Jul 2020 12:50:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DB21220774 for ; Wed, 8 Jul 2020 12:50:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594212624; bh=GbAbOo+eUvRZyK2oKcE6C/xGJJ16beL+VhHUlLdum3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=cFlyc001NmZGaWv4ozfgZWpXOpWWUwJVivBKAfGlgDBYLYVl/3zfhxUADziSC37+I HK+9zMZVFMa/aQM8VupDlz1fzfeuHGEEzenZ0agvFf/aqW/JJVdcGbKsodGgcfcxAZ bqhY8Jj32YLbSso1mjxgsf5AbhHACiZlBTu4bOkU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729345AbgGHMuY (ORCPT ); Wed, 8 Jul 2020 08:50:24 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:38496 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729171AbgGHMuU (ORCPT ); Wed, 8 Jul 2020 08:50:20 -0400 Received: by mail-lj1-f193.google.com with SMTP id 9so54049122ljv.5 for ; Wed, 08 Jul 2020 05:50:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pyXSfGSid1WnxNkWrZfC4q2C1FC22J+GRzpJHuNhHWc=; b=gYPU5aBXp0vFFZ7IBtgCMtTuGYFmww75hsx781ls8dNy4m33qGIbii4lm7x3UK69+S HHbd1JThzo/eCY+q5rUFvR1VluHHQbAWriVRAny0B9MyD5pdVqogt1pAx6NFapR+UUF0 qDlpH5UzGoUONJmPOmj2Fcf4Mh9jH2pn80p+R3+d8z9LhjLZeKLWZ42zOkotVRTEsETY uAHxoiptpoxY6Rl013sQMzwqpPcnH08SpNZamXw5EtnB+OYuUaGlUoqOdXZ6AjizW3mS XHVT5LO2h/5SsFAZBDwr+f3GkB3m6nu+udx3uu61rYst56aGdIfusug2buLObdPzmxuA zftg== X-Gm-Message-State: AOAM530DCEi/Uli7nnZTIj8jgWGAjFa7tUQvey1MUwnuCil8ymt+h3cu nc3L0cKJbZNdp6oLTE7PryaR3eXL4lk= X-Google-Smtp-Source: ABdhPJx3/FGZJveh2pxLKt/xkyOCJ15rXQC1lREgg4kWpHcmZWG/3gn1fsRhZLRU1bW73ATu5neezA== X-Received: by 2002:a2e:8e9a:: with SMTP id z26mr35133698ljk.470.1594212617976; Wed, 08 Jul 2020 05:50:17 -0700 (PDT) Received: from xi.terra (c-beaee455.07-184-6d6c6d4.bbcust.telenor.se. [85.228.174.190]) by smtp.gmail.com with ESMTPSA id y24sm892222ljy.91.2020.07.08.05.50.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jul 2020 05:50:16 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.93.0.4) (envelope-from ) id 1jt9Wg-00045W-0b; Wed, 08 Jul 2020 14:50:14 +0200 From: Johan Hovold To: linux-usb@vger.kernel.org Cc: Johan Hovold Subject: [PATCH 01/10] USB: serial: ftdi_sio: make process-packet buffer unsigned Date: Wed, 8 Jul 2020 14:49:51 +0200 Message-Id: <20200708125000.15659-2-johan@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200708125000.15659-1-johan@kernel.org> References: <20200708125000.15659-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Use an unsigned type for the process-packet buffer argument and give it a more apt name. Signed-off-by: Johan Hovold --- drivers/usb/serial/ftdi_sio.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 9ad44a96dfe3..96b9e2768ac5 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -2480,12 +2480,12 @@ static int ftdi_prepare_write_buffer(struct usb_serial_port *port, #define FTDI_RS_ERR_MASK (FTDI_RS_BI | FTDI_RS_PE | FTDI_RS_FE | FTDI_RS_OE) static int ftdi_process_packet(struct usb_serial_port *port, - struct ftdi_private *priv, char *packet, int len) + struct ftdi_private *priv, unsigned char *buf, int len) { + unsigned char status; + unsigned char *ch; int i; - char status; char flag; - char *ch; if (len < 2) { dev_dbg(&port->dev, "malformed packet\n"); @@ -2495,7 +2495,7 @@ static int ftdi_process_packet(struct usb_serial_port *port, /* Compare new line status to the old one, signal if different/ N.B. packet may be processed more than once, but differences are only processed once. */ - status = packet[0] & FTDI_STATUS_B0_MASK; + status = buf[0] & FTDI_STATUS_B0_MASK; if (status != priv->prev_status) { char diff_status = status ^ priv->prev_status; @@ -2521,7 +2521,7 @@ static int ftdi_process_packet(struct usb_serial_port *port, } /* save if the transmitter is empty or not */ - if (packet[1] & FTDI_RS_TEMT) + if (buf[1] & FTDI_RS_TEMT) priv->transmit_empty = 1; else priv->transmit_empty = 0; @@ -2535,29 +2535,29 @@ static int ftdi_process_packet(struct usb_serial_port *port, * data payload to avoid over-reporting. */ flag = TTY_NORMAL; - if (packet[1] & FTDI_RS_ERR_MASK) { + if (buf[1] & FTDI_RS_ERR_MASK) { /* Break takes precedence over parity, which takes precedence * over framing errors */ - if (packet[1] & FTDI_RS_BI) { + if (buf[1] & FTDI_RS_BI) { flag = TTY_BREAK; port->icount.brk++; usb_serial_handle_break(port); - } else if (packet[1] & FTDI_RS_PE) { + } else if (buf[1] & FTDI_RS_PE) { flag = TTY_PARITY; port->icount.parity++; - } else if (packet[1] & FTDI_RS_FE) { + } else if (buf[1] & FTDI_RS_FE) { flag = TTY_FRAME; port->icount.frame++; } /* Overrun is special, not associated with a char */ - if (packet[1] & FTDI_RS_OE) { + if (buf[1] & FTDI_RS_OE) { port->icount.overrun++; tty_insert_flip_char(&port->port, 0, TTY_OVERRUN); } } port->icount.rx += len; - ch = packet + 2; + ch = buf + 2; if (port->port.console && port->sysrq) { for (i = 0; i < len; i++, ch++) { From patchwork Wed Jul 8 12:49:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11651573 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 71ABF739 for ; Wed, 8 Jul 2020 12:50:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5935C206C3 for ; Wed, 8 Jul 2020 12:50:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594212623; bh=gksZSqMhdYcaioQ9kPUHgLQtkIOBxA9nbMu7A4lhF1Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=zPqOxmyHlcfQGn5SG+9+EJfpNZiQfvTs4aKhl4LmU9cmXoFYojTXQPPwG1WQgCEq7 aS2K3JZG9GY7zAQtqbyUK8XAEjZbOkQJDERezvne/2d3Ni3w9GG0bvnYVa267wYC1s LSkIJOrVXgZiLHYPWcnL3WXpLaGkow90hVMFNF2E= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729341AbgGHMuW (ORCPT ); Wed, 8 Jul 2020 08:50:22 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:38498 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728997AbgGHMuV (ORCPT ); Wed, 8 Jul 2020 08:50:21 -0400 Received: by mail-lj1-f194.google.com with SMTP id 9so54049169ljv.5 for ; Wed, 08 Jul 2020 05:50:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+mu6uFgak7+P+k9FraJxtiqlzNSqZXEgXJp0cM19Q/s=; b=Vlo1y/6OIDO4xNwn2eBcDeqZ02iycr+DoaCqXpe0tGdY501199bXWb1W5fuO1NW+WI HCPl9iUIl4KzqgUQEv20HTRu7qgMMjFtw51wx0Zzza3v4Ckmnh6BSJxzriaW2xZcKbvc ICivHxE5ATfoDVnsAEaO7xpxfcgF71CNwiT4omjhRQ5Fmr6I9DsLd4TPPVRQ5M/LO62a YejEpKankqFH/eB/J2+sEAWjJKsJYKQODRpioiQjNG7FORTckZJXmR4FC1BRUax7j84f HOifxiziUL80bbKFg+qPWygZTNSPSSeroOcgGa/L/wLAb+rg6PA2UX9CA/KYO7u0gbIH bsfQ== X-Gm-Message-State: AOAM532n8Hpo6wJU8WQGjPtJ3gQEaaIBqAo6IN7GUkwV+mRokhSYKAH6 0e2d3hiGvCX9lm6juVWavV4VwCoQims= X-Google-Smtp-Source: ABdhPJwR3a1JUDrhEb9j0lgLkrexj0FwxYjJxI7W/4aTLm1a+l/Y9ZwfgyJaWzeLFxQ2EdCY8ZHinw== X-Received: by 2002:a2e:960a:: with SMTP id v10mr23534284ljh.223.1594212618462; Wed, 08 Jul 2020 05:50:18 -0700 (PDT) Received: from xi.terra (c-beaee455.07-184-6d6c6d4.bbcust.telenor.se. [85.228.174.190]) by smtp.gmail.com with ESMTPSA id r19sm896346ljn.40.2020.07.08.05.50.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jul 2020 05:50:16 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.93.0.4) (envelope-from ) id 1jt9Wg-00045b-32; Wed, 08 Jul 2020 14:50:14 +0200 From: Johan Hovold To: linux-usb@vger.kernel.org Cc: Johan Hovold Subject: [PATCH 02/10] USB: serial: ftdi_sio: clean up receive processing Date: Wed, 8 Jul 2020 14:49:52 +0200 Message-Id: <20200708125000.15659-3-johan@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200708125000.15659-1-johan@kernel.org> References: <20200708125000.15659-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Clean up receive processing by dropping the character pointer and keeping the length argument unchanged throughout the function. Also make it more apparent that sysrq processing can consume a characters by adding an explicit continue. Signed-off-by: Johan Hovold --- drivers/usb/serial/ftdi_sio.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 96b9e2768ac5..33f1cca7eaa6 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -2483,7 +2483,6 @@ static int ftdi_process_packet(struct usb_serial_port *port, struct ftdi_private *priv, unsigned char *buf, int len) { unsigned char status; - unsigned char *ch; int i; char flag; @@ -2526,8 +2525,7 @@ static int ftdi_process_packet(struct usb_serial_port *port, else priv->transmit_empty = 0; - len -= 2; - if (!len) + if (len == 2) return 0; /* status only */ /* @@ -2556,19 +2554,20 @@ static int ftdi_process_packet(struct usb_serial_port *port, } } - port->icount.rx += len; - ch = buf + 2; + port->icount.rx += len - 2; if (port->port.console && port->sysrq) { - for (i = 0; i < len; i++, ch++) { - if (!usb_serial_handle_sysrq_char(port, *ch)) - tty_insert_flip_char(&port->port, *ch, flag); + for (i = 2; i < len; i++) { + if (usb_serial_handle_sysrq_char(port, buf[i])) + continue; + tty_insert_flip_char(&port->port, buf[i], flag); } } else { - tty_insert_flip_string_fixed_flag(&port->port, ch, flag, len); + tty_insert_flip_string_fixed_flag(&port->port, buf + 2, flag, + len - 2); } - return len; + return len - 2; } static void ftdi_process_read_urb(struct urb *urb) From patchwork Wed Jul 8 12:49:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11651575 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 39D1A739 for ; Wed, 8 Jul 2020 12:50:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2194720775 for ; Wed, 8 Jul 2020 12:50:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594212624; bh=Fq37C3XambmrVtbDt+8LrF6BOPipAFeIb3Vt+YeTFIc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=xgoN/fnk2oiqRt6nynrdmczgusK12Gaid0JPN6U+TuwgLEyP5nRBBfDWv3oBWeZLL 1mcvyI9S9JORERnq5sGBxBijtCSpFTdWH/WlQajoIEaxN2JGSA1RaOzz5MUb0ZdFWU 5ZvJ9KapVx9Hn3rPjQo69UF4BXmvjH04kG6zvv8E= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729343AbgGHMuX (ORCPT ); Wed, 8 Jul 2020 08:50:23 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:44769 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729207AbgGHMuV (ORCPT ); Wed, 8 Jul 2020 08:50:21 -0400 Received: by mail-lj1-f196.google.com with SMTP id s9so54044938ljm.11 for ; Wed, 08 Jul 2020 05:50:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aDuUk3K2Ne/be8X+ATcbR7rLDEPHbUhT4BRk6qHTxNs=; b=mtAKNPInbMMFSVnDZKmcZ1e2POlsg261H1//haS7csOOZk0XgKrhWsIM1guSbLHem5 u4mPQSpYFBDCCfOCp9Qtb06G3yDqfWIdPIb0GRNul3QFwt6Hy7pNlK6dHtzodcQth9yS zn1AACFS1OGaz7bJn5aqrz5mAAe6Z157Gq8cPQLyMTcHi6+sBwGnurH1LlkRzLsSAMwu Q6aOB8ES+/cVnCnGu+xzfWrc+PFsuzakZuGDX+klTTrb4hkZKm/Sw6KGLOSnb0jfX0TF zH7XV6zm5T/ByDA7uAVd/qVk0Jb1R3ElwOveDbeFPg/tTdi66u2KpUqMoDSf0OFG16dt 9HEw== X-Gm-Message-State: AOAM533CMlKXZ0OUdLsSKOEYn+LEkLWCmwUxo9Xu0Ijp0mEQWo2FI5Ks CSd9BG1EuVDd28yKXfVf4+rMSZ4CP4Y= X-Google-Smtp-Source: ABdhPJzoHChsS6pXKnj+7FjwGzCJMnxn3302xnBHJmqzcd6nAO+ZS+p+uBJq+IN5mT/dZrH5ERShgg== X-Received: by 2002:a2e:8992:: with SMTP id c18mr25516482lji.388.1594212619060; Wed, 08 Jul 2020 05:50:19 -0700 (PDT) Received: from xi.terra (c-beaee455.07-184-6d6c6d4.bbcust.telenor.se. [85.228.174.190]) by smtp.gmail.com with ESMTPSA id x64sm10357704lff.14.2020.07.08.05.50.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jul 2020 05:50:16 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.93.0.4) (envelope-from ) id 1jt9Wg-00045g-6B; Wed, 08 Jul 2020 14:50:14 +0200 From: Johan Hovold To: linux-usb@vger.kernel.org Cc: Johan Hovold Subject: [PATCH 03/10] USB: serial: ftdi_sio: fix break and sysrq handling Date: Wed, 8 Jul 2020 14:49:53 +0200 Message-Id: <20200708125000.15659-4-johan@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200708125000.15659-1-johan@kernel.org> References: <20200708125000.15659-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Only the last NUL in a packet should be flagged as a break character, for example, to avoid dropping unrelated characters when IGNBRK is set. Also make sysrq work by consuming the break character instead of having it immediately cancel the sysrq request, and by not processing it prematurely to avoid triggering a sysrq based on an unrelated character received in the same packet (which was received *before* the break). Note that the break flag can be left set also for a packet received immediately following a break and that and an ending NUL in such a packet will continue to be reported as a break as there's no good way to tell it apart from an actual break. Tested on FT232R and FT232H. Fixes: 72fda3ca6fc1 ("USB: serial: ftd_sio: implement sysrq handling on break") Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Johan Hovold --- drivers/usb/serial/ftdi_sio.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 33f1cca7eaa6..07b146d7033a 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -2483,6 +2483,7 @@ static int ftdi_process_packet(struct usb_serial_port *port, struct ftdi_private *priv, unsigned char *buf, int len) { unsigned char status; + bool brkint = false; int i; char flag; @@ -2534,13 +2535,17 @@ static int ftdi_process_packet(struct usb_serial_port *port, */ flag = TTY_NORMAL; if (buf[1] & FTDI_RS_ERR_MASK) { - /* Break takes precedence over parity, which takes precedence - * over framing errors */ - if (buf[1] & FTDI_RS_BI) { - flag = TTY_BREAK; + /* + * Break takes precedence over parity, which takes precedence + * over framing errors. Note that break is only associated + * with the last character in the buffer and only when it's a + * NUL. + */ + if (buf[1] & FTDI_RS_BI && buf[len - 1] == '\0') { port->icount.brk++; - usb_serial_handle_break(port); - } else if (buf[1] & FTDI_RS_PE) { + brkint = true; + } + if (buf[1] & FTDI_RS_PE) { flag = TTY_PARITY; port->icount.parity++; } else if (buf[1] & FTDI_RS_FE) { @@ -2556,8 +2561,13 @@ static int ftdi_process_packet(struct usb_serial_port *port, port->icount.rx += len - 2; - if (port->port.console && port->sysrq) { + if (brkint || (port->port.console && port->sysrq)) { for (i = 2; i < len; i++) { + if (brkint && i == len - 1) { + if (usb_serial_handle_break(port)) + return len - 3; + flag = TTY_BREAK; + } if (usb_serial_handle_sysrq_char(port, buf[i])) continue; tty_insert_flip_char(&port->port, buf[i], flag); From patchwork Wed Jul 8 12:49:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11651591 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1A9E66C1 for ; Wed, 8 Jul 2020 12:50:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 039A720774 for ; Wed, 8 Jul 2020 12:50:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594212631; bh=lPKSN3hhMx3f3jskJHbmIh1Susq0B4ZMl65AHThXTgE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=rs2LiNgOnJiHZ5S/Omzazju1RHBFlYFHdEBOgqFr3rBvpuVP7RN804yqj5tcYR1ug s9IgVqn850JRVkJ9pYpTFfYCL5oV8uiUjDgiyeYPdUeOYrYIAJbgBpq+nD/Fvf26UR EqQ2arYCRp7Gw9fBdHvFXE25dlFV9wKe8PTiaFuY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729269AbgGHMua (ORCPT ); Wed, 8 Jul 2020 08:50:30 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:44557 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729344AbgGHMu0 (ORCPT ); Wed, 8 Jul 2020 08:50:26 -0400 Received: by mail-lf1-f68.google.com with SMTP id y18so26800064lfh.11 for ; Wed, 08 Jul 2020 05:50:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sIAuoCjdhQjebZskIt0528un459ZXux9+rw/jvZ4lG4=; b=Z0Sq9h+xCEMd7/5P5Y7DIXsjhjssYXBUvyUO1psCoU7B5/RcrIZj9ZkEzk+xOuMJZe +3rymqweih4Gpu4x3pwRow8S+gywbX42sEH/uc1wfi7a+J1Nynsd+/sBSZU8Og5mYW8n afOyyk6e+xo79J7ya1kw1gDdbSrVRV86EkyVypYXqQEUh4FnkyQ7DmcFD2L5O6qOkreg stLL5rX6vYBo2X1Og+npy0IluPF6G3Da1Snws9Jsmsjv0sQHAKzykbYuLxJcK88a4zUf JGfUQ6irJa9F+sdGTzKeUfiUlEekhOVV4GlHFeoPwlwCw3x6uY3WGD8ATsXF0nJZkHfq 6bfA== X-Gm-Message-State: AOAM532XycQYh6pbHkofZTl6iQNvxi+cCGCjX4IqMkbfQ45v3NXOdISN nSBhZEXgEJwR3dpdwW/lVNnyBiI+rc8= X-Google-Smtp-Source: ABdhPJyrVgwlN3yQoWlRFMsgiJ4Lg8L05MCaeH2Ofmz44sIF/4DWXfzgbcVQoicl+LhIYdpGAmMWHA== X-Received: by 2002:a05:6512:783:: with SMTP id x3mr26267608lfr.126.1594212622405; Wed, 08 Jul 2020 05:50:22 -0700 (PDT) Received: from xi.terra (c-beaee455.07-184-6d6c6d4.bbcust.telenor.se. [85.228.174.190]) by smtp.gmail.com with ESMTPSA id d21sm892191ljo.85.2020.07.08.05.50.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jul 2020 05:50:19 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.93.0.4) (envelope-from ) id 1jt9Wg-00045m-95; Wed, 08 Jul 2020 14:50:14 +0200 From: Johan Hovold To: linux-usb@vger.kernel.org Cc: Johan Hovold Subject: [PATCH 04/10] USB: serial: only set sysrq timestamp for consoles Date: Wed, 8 Jul 2020 14:49:54 +0200 Message-Id: <20200708125000.15659-5-johan@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200708125000.15659-1-johan@kernel.org> References: <20200708125000.15659-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Only set the sysrq timestamp for console ports to avoid having every driver also check the console flag when processing incoming data. Signed-off-by: Johan Hovold --- drivers/usb/serial/f81232.c | 4 ++-- drivers/usb/serial/f81534.c | 2 +- drivers/usb/serial/ftdi_sio.c | 2 +- drivers/usb/serial/generic.c | 11 +++++++---- drivers/usb/serial/mxuport.c | 6 +++--- drivers/usb/serial/pl2303.c | 2 +- drivers/usb/serial/ssu100.c | 5 +++-- 7 files changed, 18 insertions(+), 14 deletions(-) diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c index dcda7fb164b4..0c7eacc630e0 100644 --- a/drivers/usb/serial/f81232.c +++ b/drivers/usb/serial/f81232.c @@ -424,7 +424,7 @@ static void f81232_process_read_urb(struct urb *urb) lsr = data[i]; tty_flag = f81232_handle_lsr(port, lsr); - if (port->port.console && port->sysrq) { + if (port->sysrq) { if (usb_serial_handle_sysrq_char(port, data[i + 1])) continue; } @@ -461,7 +461,7 @@ static void f81534a_process_read_urb(struct urb *urb) lsr = data[len - 1]; tty_flag = f81232_handle_lsr(port, lsr); - if (port->port.console && port->sysrq) { + if (port->sysrq) { for (i = 1; i < len - 1; ++i) { if (!usb_serial_handle_sysrq_char(port, data[i])) { tty_insert_flip_char(&port->port, data[i], diff --git a/drivers/usb/serial/f81534.c b/drivers/usb/serial/f81534.c index 2b39bda035c7..5661fd03e545 100644 --- a/drivers/usb/serial/f81534.c +++ b/drivers/usb/serial/f81534.c @@ -1238,7 +1238,7 @@ static void f81534_process_per_serial_block(struct usb_serial_port *port, schedule_work(&port_priv->lsr_work); } - if (port->port.console && port->sysrq) { + if (port->sysrq) { if (usb_serial_handle_sysrq_char(port, data[i])) continue; } diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 07b146d7033a..ade68405b015 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -2561,7 +2561,7 @@ static int ftdi_process_packet(struct usb_serial_port *port, port->icount.rx += len - 2; - if (brkint || (port->port.console && port->sysrq)) { + if (brkint || port->sysrq) { for (i = 2; i < len; i++) { if (brkint && i == len - 1) { if (usb_serial_handle_break(port)) diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 5cdf180cda23..05a2a3aa3963 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c @@ -355,13 +355,13 @@ void usb_serial_generic_process_read_urb(struct urb *urb) * stuff like 3G modems, so shortcircuit it in the 99.9999999% of * cases where the USB serial is not a console anyway. */ - if (!port->port.console || !port->sysrq) { - tty_insert_flip_string(&port->port, ch, urb->actual_length); - } else { + if (port->sysrq) { for (i = 0; i < urb->actual_length; i++, ch++) { if (!usb_serial_handle_sysrq_char(port, *ch)) tty_insert_flip_char(&port->port, *ch, TTY_NORMAL); } + } else { + tty_insert_flip_string(&port->port, ch, urb->actual_length); } tty_flip_buffer_push(&port->port); } @@ -574,7 +574,7 @@ EXPORT_SYMBOL_GPL(usb_serial_generic_get_icount); #ifdef CONFIG_MAGIC_SYSRQ int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch) { - if (port->sysrq && port->port.console) { + if (port->sysrq) { if (ch && time_before(jiffies, port->sysrq)) { handle_sysrq(ch); port->sysrq = 0; @@ -594,6 +594,9 @@ EXPORT_SYMBOL_GPL(usb_serial_handle_sysrq_char); int usb_serial_handle_break(struct usb_serial_port *port) { + if (!port->port.console) + return 0; + if (!port->sysrq) { port->sysrq = jiffies + HZ*5; return 1; diff --git a/drivers/usb/serial/mxuport.c b/drivers/usb/serial/mxuport.c index 2513ee902779..5d38c2a0f590 100644 --- a/drivers/usb/serial/mxuport.c +++ b/drivers/usb/serial/mxuport.c @@ -327,14 +327,14 @@ static void mxuport_process_read_urb_data(struct usb_serial_port *port, { int i; - if (!port->port.console || !port->sysrq) { - tty_insert_flip_string(&port->port, data, size); - } else { + if (port->sysrq) { for (i = 0; i < size; i++, data++) { if (!usb_serial_handle_sysrq_char(port, *data)) tty_insert_flip_char(&port->port, *data, TTY_NORMAL); } + } else { + tty_insert_flip_string(&port->port, data, size); } tty_flip_buffer_push(&port->port); } diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index c5a2995dfa2e..048452d8a4a4 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c @@ -1101,7 +1101,7 @@ static void pl2303_process_read_urb(struct urb *urb) if (line_status & UART_OVERRUN_ERROR) tty_insert_flip_char(&port->port, 0, TTY_OVERRUN); - if (port->port.console && port->sysrq) { + if (port->sysrq) { for (i = 0; i < urb->actual_length; ++i) if (!usb_serial_handle_sysrq_char(port, data[i])) tty_insert_flip_char(&port->port, data[i], diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c index f6aea9f1be1a..01472b96bf38 100644 --- a/drivers/usb/serial/ssu100.c +++ b/drivers/usb/serial/ssu100.c @@ -517,13 +517,14 @@ static void ssu100_process_read_urb(struct urb *urb) if (!len) return; /* status only */ - if (port->port.console && port->sysrq) { + if (port->sysrq) { for (i = 0; i < len; i++, ch++) { if (!usb_serial_handle_sysrq_char(port, *ch)) tty_insert_flip_char(&port->port, *ch, flag); } - } else + } else { tty_insert_flip_string_fixed_flag(&port->port, ch, flag, len); + } tty_flip_buffer_push(&port->port); } From patchwork Wed Jul 8 12:49:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11651583 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3A80C739 for ; Wed, 8 Jul 2020 12:50:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 183A820774 for ; Wed, 8 Jul 2020 12:50:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594212627; bh=RItev2p/qkmv5dMQH4LH1yBjD3m1GIxJfM89XyOB3+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=V8WKw2WRIxFNQ8VUzIJROMZqnrkJpudgGQH9c0orC1Qv7ZgM1K1tVFe/mWXEOYoEK HqXtmoKbapbhsMy93yah3eaOKlgeXywmIT4W2OnVlp3SCj9ZVx+IRayGZpNK3asXVA 6IBC59QBCm/G4n66M6P+0PwpFE/64L0awlIJOWLA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729350AbgGHMuY (ORCPT ); Wed, 8 Jul 2020 08:50:24 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:36502 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728759AbgGHMuW (ORCPT ); Wed, 8 Jul 2020 08:50:22 -0400 Received: by mail-lj1-f194.google.com with SMTP id d17so39365583ljl.3 for ; Wed, 08 Jul 2020 05:50:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FOKveVToAW+Q/aAOg46ZMWLgmRqlNJtzLcnTPuIwRJQ=; b=GpiC+3jIflD3qbWxs+m54UJu1FmVn63B9SE1J6mjt17I1fSIjDhCNDekGBNOXAu8Ib eK6fWiGqaJKP8vofsGLfT77rviny4hxaXbmbN+cmHQ6J7fDQOAMoqKM99yhbZNvmbEMe CVbbaCM6LgHyzy2NIrLkY7OVFkRg3f1B5XFEnxc44XA1xwG7mvjqaKsq6Fy27PWqJqtu zmcoLrnbnpKUfN59sQN17RqKx0XMhKNDb4e6V6OIhCBr1ToZ6FJj/ynIHCAxVOi0GGik HZumUPc8gdSChsogkPUEQ/kE+evYC6ieNn6bHBvWEckBw3nO2BvrEBZTg+t0FdRRbTZk YfsQ== X-Gm-Message-State: AOAM532WXKsX8XqBFsZWR9jXSBYNoRebRIjrnznTfcQKq5mm+ArN+4dz ywP4cvAm4NFNQpjLIJ8Cbyl11RDmTmE= X-Google-Smtp-Source: ABdhPJy06vz5kSkAIwvBzo78ycwxec/JO6zN+IQokGEC3WhpL6t5YUfEp26TJYrrikSv5jadmWZhMw== X-Received: by 2002:a2e:9316:: with SMTP id e22mr31367994ljh.393.1594212619794; Wed, 08 Jul 2020 05:50:19 -0700 (PDT) Received: from xi.terra (c-beaee455.07-184-6d6c6d4.bbcust.telenor.se. [85.228.174.190]) by smtp.gmail.com with ESMTPSA id x5sm886346ljm.132.2020.07.08.05.50.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jul 2020 05:50:19 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.93.0.4) (envelope-from ) id 1jt9Wg-00045q-Bv; Wed, 08 Jul 2020 14:50:14 +0200 From: Johan Hovold To: linux-usb@vger.kernel.org Cc: Johan Hovold Subject: [PATCH 05/10] USB: serial: only process sysrq when enabled Date: Wed, 8 Jul 2020 14:49:55 +0200 Message-Id: <20200708125000.15659-6-johan@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200708125000.15659-1-johan@kernel.org> References: <20200708125000.15659-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Do not set the sysrq timestamp unless CONFIG_MAGIC_SYSRQ is enabled to avoid unnecessary per-character processing for consoles. Signed-off-by: Johan Hovold --- drivers/usb/serial/generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 05a2a3aa3963..c5b35252c931 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c @@ -594,7 +594,7 @@ EXPORT_SYMBOL_GPL(usb_serial_handle_sysrq_char); int usb_serial_handle_break(struct usb_serial_port *port) { - if (!port->port.console) + if (!port->port.console || !IS_ENABLED(CONFIG_MAGIC_SYSRQ)) return 0; if (!port->sysrq) { From patchwork Wed Jul 8 12:49:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11651585 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8D41B739 for ; Wed, 8 Jul 2020 12:50:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 76E1620774 for ; Wed, 8 Jul 2020 12:50:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594212628; bh=cNgpB4EcMg9mgoHQL9jMqZaFGF6COQiDSxouNUlb3+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=wDsmSHObVicDshZRK9aXWWoqAFyjYvMlN048RRWN6i2muy+KgvwiTtr5XBGBGSTgW K8Cl6H3dFs+T+pzIljeyApgbvTHbcC3H38AdE2xGBS3u0NbYN1jFVwT8+H6KkPr+f6 gCY9vlBwyJ9bsNJTS8cChdWFY1b+Swq38jKBC6tw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729354AbgGHMu1 (ORCPT ); Wed, 8 Jul 2020 08:50:27 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:38506 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728997AbgGHMuY (ORCPT ); Wed, 8 Jul 2020 08:50:24 -0400 Received: by mail-lj1-f194.google.com with SMTP id 9so54049415ljv.5 for ; Wed, 08 Jul 2020 05:50:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BOtMdQ31hSFZmoOylpnamupfx6U1bJ5fY1OLVV+RTVk=; b=URMNMaM91JvOv/xxsxabviFV4VB5V4X8KxHamdb49NgF+W9XMR17g6zmsJPCZhAV86 i2eSRI4v1vdHie0M7iRTlEHKR8eLuyMjoGbBu9UevbCHTA7QeMujYXeC+tufyNB08gCG 35Lf5pg2bQqGxxWR+qHXN3WK74p4Wn1LXYE1z1POdwYWbapRORIz9VvVNMeXMjt5G/3L Wj5wP3+qetDVmVTgRS7JiOgTvhNkShNVR4Uy3vbueqZPHBNrAVCu4MCMA6hHWi/R4DoI pFZ43OFdTFXXiboueVMi9fhe2zKHTZDEKFzISYL1EPnBgjQj9qcLIyqRztbPGrfaq0E6 Rlow== X-Gm-Message-State: AOAM530b+UNdZutm+QbY4bEGNGMI4Yt+xaeVBK13InFwZjawbw8cVDIu qw5XHNYm/Ktw/bOHKol0ROwJ0Zb1Kbg= X-Google-Smtp-Source: ABdhPJwponsVPfDyxPfjcozaby3TjdX/Go8t1w4/RohR8PPmX9bMnHkTSuGF/lwDtY9tdVaK22HPBQ== X-Received: by 2002:a2e:6806:: with SMTP id c6mr20696002lja.219.1594212621489; Wed, 08 Jul 2020 05:50:21 -0700 (PDT) Received: from xi.terra (c-beaee455.07-184-6d6c6d4.bbcust.telenor.se. [85.228.174.190]) by smtp.gmail.com with ESMTPSA id m4sm891088ljo.70.2020.07.08.05.50.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jul 2020 05:50:19 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.93.0.4) (envelope-from ) id 1jt9Wg-00045v-Ep; Wed, 08 Jul 2020 14:50:14 +0200 From: Johan Hovold To: linux-usb@vger.kernel.org Cc: Johan Hovold Subject: [PATCH 06/10] USB: serial: inline sysrq dummy function Date: Wed, 8 Jul 2020 14:49:56 +0200 Message-Id: <20200708125000.15659-7-johan@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200708125000.15659-1-johan@kernel.org> References: <20200708125000.15659-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Inline the dummy sysrq character handling when either console support or magic-sysrq support isn't enabled to allow the compiler to eliminate unused code. Signed-off-by: Johan Hovold --- drivers/usb/serial/generic.c | 9 ++------- include/linux/usb/serial.h | 9 +++++++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index c5b35252c931..a9b6d103aaf6 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c @@ -571,7 +571,7 @@ int usb_serial_generic_get_icount(struct tty_struct *tty, } EXPORT_SYMBOL_GPL(usb_serial_generic_get_icount); -#ifdef CONFIG_MAGIC_SYSRQ +#if defined(CONFIG_USB_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch) { if (port->sysrq) { @@ -584,13 +584,8 @@ int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch) } return 0; } -#else -int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch) -{ - return 0; -} -#endif EXPORT_SYMBOL_GPL(usb_serial_handle_sysrq_char); +#endif int usb_serial_handle_break(struct usb_serial_port *port) { diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 14cac4a1ae8f..be73646706a9 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h @@ -365,8 +365,17 @@ extern int usb_serial_generic_submit_read_urbs(struct usb_serial_port *port, extern void usb_serial_generic_process_read_urb(struct urb *urb); extern int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port, void *dest, size_t size); + +#if defined(CONFIG_USB_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) extern int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch); +#else +static inline int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch) +{ + return 0; +} +#endif + extern int usb_serial_handle_break(struct usb_serial_port *port); extern void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port, struct tty_struct *tty, From patchwork Wed Jul 8 12:49:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11651581 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 57F5F739 for ; Wed, 8 Jul 2020 12:50:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3E57C206C3 for ; Wed, 8 Jul 2020 12:50:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594212626; bh=elml2WOEzKouXxdGTZsiSXbpaxkVGmJcNofHrBFprfo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ll4j8gU/lvTofv70mX5cDncYz4wyN3BLyzTyNXlbJMsQnTZSDRGXEYE/QCKo2Lb9f hWyJuDIvqTW8v4o2xW3ss79mwzlgaPxSFmYmO15bHVU8BHmL0Fs4I0D63hCiTZty1V i4eYL3QhKVsxuDH3rE8wtjj4ZG46QMEgCeEALCm8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729352AbgGHMuZ (ORCPT ); Wed, 8 Jul 2020 08:50:25 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:35702 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728803AbgGHMuX (ORCPT ); Wed, 8 Jul 2020 08:50:23 -0400 Received: by mail-lj1-f193.google.com with SMTP id q4so18377077lji.2 for ; Wed, 08 Jul 2020 05:50:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pOZZQ2mEGRz/QumI30v5ahCBip5V6aX9/P7bGwMt+E4=; b=icikPZ7uZ5x9SYjCgZg7h+htUhtPGeXpVwdL3OuG1eQ+r6X1H+HMuSUR8nlunqsZB6 KKrVM1/YjzLtixd2zLQoUdI9aHlo4uImZkwU/9WRcswaPhuBxF3OZ8YsCvIqs/VFuyXa xkxe31vylNdrHt8Cqpb0GAoVYESIhbHjgv4nYxi3ovBgXdosrjLaioWmFI36bZLzzm1l EgxNnTCIgM4MPWhTAGiPJqRc+bs7HHR2ZNvWbC3cRN1pmHvvezRjLDko4MWDVs7BUn8I AJ7JxIaexP99IYn4fqpqS6p8BSD1pgGhBf9HvWwqhJNXqdDVdaWTWGavyz7ZnqtmngTP pDmg== X-Gm-Message-State: AOAM533c2kmvp6AU+4uxZ15bfaw4LlIiJNRIeYkrrf+lf7PeByH6Epl9 g6jb0fyia6d7FZmDWE2bwIFjBz80CeM= X-Google-Smtp-Source: ABdhPJy+81I57mE5K7T8UJ9i1bevssbiiYY5I/V10zPlWtPOHbQFSdS9LQCYRv46WRXuMbqXkjlIOg== X-Received: by 2002:a2e:9d84:: with SMTP id c4mr2209971ljj.46.1594212621004; Wed, 08 Jul 2020 05:50:21 -0700 (PDT) Received: from xi.terra (c-beaee455.07-184-6d6c6d4.bbcust.telenor.se. [85.228.174.190]) by smtp.gmail.com with ESMTPSA id g24sm883055ljl.139.2020.07.08.05.50.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jul 2020 05:50:19 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.93.0.4) (envelope-from ) id 1jt9Wg-000461-Hm; Wed, 08 Jul 2020 14:50:14 +0200 From: Johan Hovold To: linux-usb@vger.kernel.org Cc: Johan Hovold Subject: [PATCH 07/10] USB: serial: add sysrq break-handler dummy Date: Wed, 8 Jul 2020 14:49:57 +0200 Message-Id: <20200708125000.15659-8-johan@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200708125000.15659-1-johan@kernel.org> References: <20200708125000.15659-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Add inline sysrq break-handler dummy to allow the compiler to eliminate further code when either console or sysrq support isn't enabled and to clearly mark the two sysrq functions as belonging together. Signed-off-by: Johan Hovold --- drivers/usb/serial/generic.c | 4 ++-- include/linux/usb/serial.h | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index a9b6d103aaf6..e60f74f11acc 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c @@ -585,11 +585,10 @@ int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch) return 0; } EXPORT_SYMBOL_GPL(usb_serial_handle_sysrq_char); -#endif int usb_serial_handle_break(struct usb_serial_port *port) { - if (!port->port.console || !IS_ENABLED(CONFIG_MAGIC_SYSRQ)) + if (!port->port.console) return 0; if (!port->sysrq) { @@ -600,6 +599,7 @@ int usb_serial_handle_break(struct usb_serial_port *port) return 0; } EXPORT_SYMBOL_GPL(usb_serial_handle_break); +#endif /** * usb_serial_handle_dcd_change - handle a change of carrier detect state diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index be73646706a9..c4ed4404335e 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h @@ -369,14 +369,18 @@ extern int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port, #if defined(CONFIG_USB_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) extern int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch); +extern int usb_serial_handle_break(struct usb_serial_port *port); #else static inline int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch) { return 0; } +static inline int usb_serial_handle_break(struct usb_serial_port *port) +{ + return 0; +} #endif -extern int usb_serial_handle_break(struct usb_serial_port *port); extern void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port, struct tty_struct *tty, unsigned int status); From patchwork Wed Jul 8 12:49:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11651579 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B2CA56C1 for ; Wed, 8 Jul 2020 12:50:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9158A20775 for ; Wed, 8 Jul 2020 12:50:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594212625; bh=2DU+HH1PFYzr5LXd7klomfmetltO32u7wREwRCQ1BG8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=fqp9UYf58OIXNTH0TtCdytwFgLjMst1nU7x8LvmGBOIdTQlP5LRp3SYI96NGpYLvR H92TsF+Atrwk6q9NBc2B/KxqrniXaihh+98brt8DP9FaWlox9g9rPg9c4RTiYpaaHX 8EkTYKV88SelZG5//8oiyA2YPVYww4n3swvuFKqI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729347AbgGHMuY (ORCPT ); Wed, 8 Jul 2020 08:50:24 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:42868 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729268AbgGHMuW (ORCPT ); Wed, 8 Jul 2020 08:50:22 -0400 Received: by mail-lj1-f194.google.com with SMTP id h22so46935204lji.9 for ; Wed, 08 Jul 2020 05:50:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=H0bjgyzH5s0eIqZUX6DEWjUkmcGB3TXKjdjC99HLXfE=; b=B45aIkbos+r06pAJhSUZ7fqbpLRGmFrAKIpyPCYrsEkiTiBLxSGJ/JSjxtP18SvHT8 SU/Sxe+dhOq0uuE1VYgu2+uFnYBjEF7e3OvIn2shSlGFE0NfWXSlX9WHgTUhjH4oxVKx +o6ApgkziIa+34HRZfCqhHecCw6bm8FzX9XMbi66Okc6j2RYFFIXg5/b9iz1DLpqWixv jcGVcpOquc7DK0tZF/9Q3rEA9R9UUwDpA+klYWrwBnUbXnxxNAs//m9sF26FxWZd8tyv 7+kFVrcsYMRKJrA7P+PyuA9Ad2p7t5hIM/20b54prjWA/dYrmXfgFj5KXsZ7nB9tSOrb 67lw== X-Gm-Message-State: AOAM532jus2qS2XoVy54fq5rBexGsdPdI4iY1yYwIBWat4rM9FRfMlwh WQD18VcDEIuGpNvFrVOjjEjj1e3eiBE= X-Google-Smtp-Source: ABdhPJzaxsQ7lhL3dKaHgJ4PLHLB76A2+N6y5EIDKtgmYGJoUYRLc3u8SLzi1TnXbkAQ/wd60eL6WQ== X-Received: by 2002:a2e:9042:: with SMTP id n2mr31644959ljg.208.1594212620444; Wed, 08 Jul 2020 05:50:20 -0700 (PDT) Received: from xi.terra (c-beaee455.07-184-6d6c6d4.bbcust.telenor.se. [85.228.174.190]) by smtp.gmail.com with ESMTPSA id k14sm892552ljc.48.2020.07.08.05.50.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jul 2020 05:50:19 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.93.0.4) (envelope-from ) id 1jt9Wg-000466-KL; Wed, 08 Jul 2020 14:50:14 +0200 From: Johan Hovold To: linux-usb@vger.kernel.org Cc: Johan Hovold Subject: [PATCH 08/10] USB: serial: drop unnecessary sysrq include Date: Wed, 8 Jul 2020 14:49:58 +0200 Message-Id: <20200708125000.15659-9-johan@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200708125000.15659-1-johan@kernel.org> References: <20200708125000.15659-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org There's no need to include sysrq.h in the subsystem header. Signed-off-by: Johan Hovold --- include/linux/usb/serial.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index c4ed4404335e..4becca7ae264 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h @@ -17,7 +17,6 @@ #include #include #include -#include #include /* The maximum number of ports one device can grab at once */ From patchwork Wed Jul 8 12:49:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11651587 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 44CAD6C1 for ; Wed, 8 Jul 2020 12:50:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2484D206C3 for ; Wed, 8 Jul 2020 12:50:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594212629; bh=c+hgujOFZSPqxs9rVJPMwIOS5qkXAZMXmLMlVNWIk5A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=gHGOBGwaw4RcHoyP2F6Sw03JTFEhWbgKUu7U58LrLzoBay8DXbjV7l4MbCULIsiA4 DKOdEFRPVgaEnWbrtJFnULm8vUOgImrqYF8Rq4BCYICKMYHZF+oH3LlsjumWwb6NCH I9Zza4A+/iKbwMgu6KrGg78x13T7efH6kaRXri6A= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729357AbgGHMu2 (ORCPT ); Wed, 8 Jul 2020 08:50:28 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:38512 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729349AbgGHMu1 (ORCPT ); Wed, 8 Jul 2020 08:50:27 -0400 Received: by mail-lj1-f193.google.com with SMTP id 9so54049585ljv.5 for ; Wed, 08 Jul 2020 05:50:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=76o7TPyG5W7HRmbJ1JPr6DNE58uGocp5+r9r210o0c0=; b=jMJfdmsvJ2LsLvJzMi1nM5UPyzGpTbVNwDZ8VQodZGUopFWYblPJt2WsBJbI2k1aVi 5u6WS1POKq88f4SahoKxpGiaMmcSSf6W2GL85JKbFIQCnxvJ8jrBZwvuXp9SC8q8Rayt BC9ywmzF7WNZ/ht1fEYkHEK49TgzchERylvU4N2EPb25CLvRinGVBym6dGjuiF2wYG1m VI6iDlaY2u/W1tqZZZh/TM/94eMAz0EmnSZSFhBJB3RU04mocZ+Lgelbqq2/bvuPpdSo +5WAXg44SjsF1jgvHd3u7Pu9mbqAYiq19gzm2n+bUZN4JDePe/Lsq5LbgBDhM82LsqTo Dgtg== X-Gm-Message-State: AOAM53106hJOxqgpOdDxH/Ql6cObTm3QgIXFyWS/A17Mf/hqCttO5g4Y 4IFVm39t1aN+JNJAP/uzAM7AcjqYKbo= X-Google-Smtp-Source: ABdhPJyH2LfAILJTOLzGcQYg686siHv2bXWwq6i35+hpbgrpM0tpTEc1dZEMfBBiCOHAMUUnpjEINA== X-Received: by 2002:a2e:3202:: with SMTP id y2mr32723273ljy.465.1594212623548; Wed, 08 Jul 2020 05:50:23 -0700 (PDT) Received: from xi.terra (c-beaee455.07-184-6d6c6d4.bbcust.telenor.se. [85.228.174.190]) by smtp.gmail.com with ESMTPSA id o21sm10040545lfo.2.2020.07.08.05.50.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jul 2020 05:50:19 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.93.0.4) (envelope-from ) id 1jt9Wg-00046C-NX; Wed, 08 Jul 2020 14:50:14 +0200 From: Johan Hovold To: linux-usb@vger.kernel.org Cc: Johan Hovold Subject: [PATCH 09/10] USB: serial: drop extern keyword from function declarations Date: Wed, 8 Jul 2020 14:49:59 +0200 Message-Id: <20200708125000.15659-10-johan@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200708125000.15659-1-johan@kernel.org> References: <20200708125000.15659-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Drop the redundant extern keyword from function declarations in the subsystem header file to improve readability (and make it easier to spot the global variables). Signed-off-by: Johan Hovold --- include/linux/usb/serial.h | 81 +++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 45 deletions(-) diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 4becca7ae264..6d756d03f46f 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h @@ -315,19 +315,19 @@ struct usb_serial_driver { #define to_usb_serial_driver(d) \ container_of(d, struct usb_serial_driver, driver) -extern int usb_serial_register_drivers(struct usb_serial_driver *const serial_drivers[], +int usb_serial_register_drivers(struct usb_serial_driver *const serial_drivers[], const char *name, const struct usb_device_id *id_table); -extern void usb_serial_deregister_drivers(struct usb_serial_driver *const serial_drivers[]); -extern void usb_serial_port_softint(struct usb_serial_port *port); +void usb_serial_deregister_drivers(struct usb_serial_driver *const serial_drivers[]); +void usb_serial_port_softint(struct usb_serial_port *port); -extern int usb_serial_suspend(struct usb_interface *intf, pm_message_t message); -extern int usb_serial_resume(struct usb_interface *intf); +int usb_serial_suspend(struct usb_interface *intf, pm_message_t message); +int usb_serial_resume(struct usb_interface *intf); /* USB Serial console functions */ #ifdef CONFIG_USB_SERIAL_CONSOLE -extern void usb_serial_console_init(int minor); -extern void usb_serial_console_exit(void); -extern void usb_serial_console_disconnect(struct usb_serial *serial); +void usb_serial_console_init(int minor); +void usb_serial_console_exit(void); +void usb_serial_console_disconnect(struct usb_serial *serial); #else static inline void usb_serial_console_init(int minor) { } static inline void usb_serial_console_exit(void) { } @@ -335,40 +335,32 @@ static inline void usb_serial_console_disconnect(struct usb_serial *serial) {} #endif /* Functions needed by other parts of the usbserial core */ -extern struct usb_serial_port *usb_serial_port_get_by_minor(unsigned int minor); -extern void usb_serial_put(struct usb_serial *serial); -extern int usb_serial_generic_open(struct tty_struct *tty, - struct usb_serial_port *port); -extern int usb_serial_generic_write_start(struct usb_serial_port *port, - gfp_t mem_flags); -extern int usb_serial_generic_write(struct tty_struct *tty, - struct usb_serial_port *port, const unsigned char *buf, int count); -extern void usb_serial_generic_close(struct usb_serial_port *port); -extern int usb_serial_generic_resume(struct usb_serial *serial); -extern int usb_serial_generic_write_room(struct tty_struct *tty); -extern int usb_serial_generic_chars_in_buffer(struct tty_struct *tty); -extern void usb_serial_generic_wait_until_sent(struct tty_struct *tty, - long timeout); -extern void usb_serial_generic_read_bulk_callback(struct urb *urb); -extern void usb_serial_generic_write_bulk_callback(struct urb *urb); -extern void usb_serial_generic_throttle(struct tty_struct *tty); -extern void usb_serial_generic_unthrottle(struct tty_struct *tty); -extern int usb_serial_generic_tiocmiwait(struct tty_struct *tty, - unsigned long arg); -extern int usb_serial_generic_get_icount(struct tty_struct *tty, - struct serial_icounter_struct *icount); -extern int usb_serial_generic_register(void); -extern void usb_serial_generic_deregister(void); -extern int usb_serial_generic_submit_read_urbs(struct usb_serial_port *port, - gfp_t mem_flags); -extern void usb_serial_generic_process_read_urb(struct urb *urb); -extern int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port, - void *dest, size_t size); +struct usb_serial_port *usb_serial_port_get_by_minor(unsigned int minor); +void usb_serial_put(struct usb_serial *serial); +int usb_serial_generic_open(struct tty_struct *tty, struct usb_serial_port *port); +int usb_serial_generic_write_start(struct usb_serial_port *port, gfp_t mem_flags); +int usb_serial_generic_write(struct tty_struct *tty, struct usb_serial_port *port, + const unsigned char *buf, int count); +void usb_serial_generic_close(struct usb_serial_port *port); +int usb_serial_generic_resume(struct usb_serial *serial); +int usb_serial_generic_write_room(struct tty_struct *tty); +int usb_serial_generic_chars_in_buffer(struct tty_struct *tty); +void usb_serial_generic_wait_until_sent(struct tty_struct *tty, long timeout); +void usb_serial_generic_read_bulk_callback(struct urb *urb); +void usb_serial_generic_write_bulk_callback(struct urb *urb); +void usb_serial_generic_throttle(struct tty_struct *tty); +void usb_serial_generic_unthrottle(struct tty_struct *tty); +int usb_serial_generic_tiocmiwait(struct tty_struct *tty, unsigned long arg); +int usb_serial_generic_get_icount(struct tty_struct *tty, struct serial_icounter_struct *icount); +int usb_serial_generic_register(void); +void usb_serial_generic_deregister(void); +int usb_serial_generic_submit_read_urbs(struct usb_serial_port *port, gfp_t mem_flags); +void usb_serial_generic_process_read_urb(struct urb *urb); +int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port, void *dest, size_t size); #if defined(CONFIG_USB_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) -extern int usb_serial_handle_sysrq_char(struct usb_serial_port *port, - unsigned int ch); -extern int usb_serial_handle_break(struct usb_serial_port *port); +int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch); +int usb_serial_handle_break(struct usb_serial_port *port); #else static inline int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch) { @@ -380,13 +372,12 @@ static inline int usb_serial_handle_break(struct usb_serial_port *port) } #endif -extern void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port, - struct tty_struct *tty, - unsigned int status); +void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port, + struct tty_struct *tty, unsigned int status); -extern int usb_serial_bus_register(struct usb_serial_driver *device); -extern void usb_serial_bus_deregister(struct usb_serial_driver *device); +int usb_serial_bus_register(struct usb_serial_driver *device); +void usb_serial_bus_deregister(struct usb_serial_driver *device); extern struct bus_type usb_serial_bus_type; extern struct tty_driver *usb_serial_tty_driver; From patchwork Wed Jul 8 12:50:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11651589 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CB4FE14DD for ; Wed, 8 Jul 2020 12:50:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B4CDB20774 for ; Wed, 8 Jul 2020 12:50:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594212629; bh=GmTaXfyMjW1+6mtKUARoLfRk2vowHanMV++mAKJ0518=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=N8OR8ViVCBdL+rKDGIbZTZQF6Q2QyVrIjICLIgFvau/joh/8D2Frz6cLH9BltunAM sMlH7gyerYyFcdtnBjF5AqeVJQNMAb0ULIkrXoHeeMTNylKdgNyPQt/rOIytEAUuWX U4/igLHBLwh9Ioj8ndVKV1qMzfzt462cTRz0Rfw0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729358AbgGHMu2 (ORCPT ); Wed, 8 Jul 2020 08:50:28 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:41120 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729171AbgGHMu0 (ORCPT ); Wed, 8 Jul 2020 08:50:26 -0400 Received: by mail-lf1-f68.google.com with SMTP id c11so26809309lfh.8 for ; Wed, 08 Jul 2020 05:50:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hp3xiyJAieOb8cYFgJCXpGWGvgBzWdf1lRPZkYORU04=; b=K8MSfybsX/yCbrJIngkwrCuU9bFLYhsvYAEMiQuBgddYvbTklYABSXEPj0LXgvYmmo 18g6OXagYfHEIN08F2xrybdFg+czyq/2WGcvGJ/S76OsbJWphZHOL1aPNyQU2m3GnJQZ fOqhPY6B+/WumGoxspzc2+dWUsfNt7SLanmm98/Omgm55ulZ0DHExLmsv09e9GHnk5+x k9VnSZwUBJFsU7clHAm8ZKEMbgnywaZ98rwCIRMpCB2UV43WgCojeOeITmeEkCW61yxE 2CqZDCPZVNuWPyQKeF+TgtcSy3vz0AA6jC0DkhyUJ8LS5M1aEf7Mal1RCqvC023SNQV5 ju3A== X-Gm-Message-State: AOAM530hrZd7NFvnvoosvzz4j4SUdky2K/9I/wwJ5wWM21GyvJszsryt EmSO6vqt6Y+tzuqc4JCmHLuzbmbsW9U= X-Google-Smtp-Source: ABdhPJyjqoPReKVjx6iKkgNGe7Wlwcv/jxK0h1j34HR2tv3eyq+0WK0eSWhVmLQmoZ1GiFH9HMr7Cw== X-Received: by 2002:a19:f20a:: with SMTP id q10mr36784632lfh.89.1594212622845; Wed, 08 Jul 2020 05:50:22 -0700 (PDT) Received: from xi.terra (c-beaee455.07-184-6d6c6d4.bbcust.telenor.se. [85.228.174.190]) by smtp.gmail.com with ESMTPSA id m14sm13400875lfp.18.2020.07.08.05.50.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jul 2020 05:50:19 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.93.0.4) (envelope-from ) id 1jt9Wg-00046G-Ql; Wed, 08 Jul 2020 14:50:14 +0200 From: Johan Hovold To: linux-usb@vger.kernel.org Cc: Johan Hovold Subject: [PATCH 10/10] USB: serial: drop redundant transfer-buffer casts Date: Wed, 8 Jul 2020 14:50:00 +0200 Message-Id: <20200708125000.15659-11-johan@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200708125000.15659-1-johan@kernel.org> References: <20200708125000.15659-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Drop redundant URB transfer-buffer casts. Signed-off-by: Johan Hovold --- drivers/usb/serial/aircable.c | 2 +- drivers/usb/serial/ftdi_sio.c | 2 +- drivers/usb/serial/generic.c | 2 +- drivers/usb/serial/option.c | 3 +-- drivers/usb/serial/sierra.c | 3 +-- drivers/usb/serial/ssu100.c | 2 +- 6 files changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/usb/serial/aircable.c b/drivers/usb/serial/aircable.c index 84d52953dd0a..a1df686c3066 100644 --- a/drivers/usb/serial/aircable.c +++ b/drivers/usb/serial/aircable.c @@ -117,7 +117,7 @@ static int aircable_process_packet(struct usb_serial_port *port, static void aircable_process_read_urb(struct urb *urb) { struct usb_serial_port *port = urb->context; - char *data = (char *)urb->transfer_buffer; + char *data = urb->transfer_buffer; int has_headers; int count; int len; diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index ade68405b015..871cdccf3a5f 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -2584,7 +2584,7 @@ static void ftdi_process_read_urb(struct urb *urb) { struct usb_serial_port *port = urb->context; struct ftdi_private *priv = usb_get_serial_port_data(port); - char *data = (char *)urb->transfer_buffer; + char *data = urb->transfer_buffer; int i; int len; int count = 0; diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index e60f74f11acc..d10aa3d2ee49 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c @@ -345,7 +345,7 @@ EXPORT_SYMBOL_GPL(usb_serial_generic_submit_read_urbs); void usb_serial_generic_process_read_urb(struct urb *urb) { struct usb_serial_port *port = urb->context; - char *ch = (char *)urb->transfer_buffer; + char *ch = urb->transfer_buffer; int i; if (!urb->actual_length) diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 254a8bbeea67..8e74903352e7 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -2151,8 +2151,7 @@ static void option_instat_callback(struct urb *urb) dev_dbg(dev, "%s: urb %p port %p has data %p\n", __func__, urb, port, portdata); if (status == 0) { - struct usb_ctrlrequest *req_pkt = - (struct usb_ctrlrequest *)urb->transfer_buffer; + struct usb_ctrlrequest *req_pkt = urb->transfer_buffer; if (!req_pkt) { dev_dbg(dev, "%s: NULL req_pkt\n", __func__); diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index e8b130157b57..a862aa788a19 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c @@ -570,8 +570,7 @@ static void sierra_instat_callback(struct urb *urb) urb, port, portdata); if (status == 0) { - struct usb_ctrlrequest *req_pkt = - (struct usb_ctrlrequest *)urb->transfer_buffer; + struct usb_ctrlrequest *req_pkt = urb->transfer_buffer; if (!req_pkt) { dev_dbg(&port->dev, "%s: NULL req_pkt\n", diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c index 01472b96bf38..7d39d35e52a1 100644 --- a/drivers/usb/serial/ssu100.c +++ b/drivers/usb/serial/ssu100.c @@ -495,7 +495,7 @@ static void ssu100_update_lsr(struct usb_serial_port *port, u8 lsr, static void ssu100_process_read_urb(struct urb *urb) { struct usb_serial_port *port = urb->context; - char *packet = (char *)urb->transfer_buffer; + char *packet = urb->transfer_buffer; char flag = TTY_NORMAL; u32 len = urb->actual_length; int i;