From patchwork Mon Apr 12 09:47:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 12197477 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 595E3C43461 for ; Mon, 12 Apr 2021 09:53:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 26E356120B for ; Mon, 12 Apr 2021 09:53:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242166AbhDLJxb (ORCPT ); Mon, 12 Apr 2021 05:53:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:35508 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239622AbhDLJs0 (ORCPT ); Mon, 12 Apr 2021 05:48:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B50A76120B; Mon, 12 Apr 2021 09:48:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618220888; bh=ADjfyJ0X8Wa3xUssDrUvlvHtaYa/1AEMvi6lfD/NlKU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MbU9uF2pPDZIF099J9YnLlw2uxarWulUoVjWLpbkv+IIrK876k82meS/71qE9diE0 S0P75JmMyhQluSW5deTGa+32/7vjcwPIl6EjVAbyZ3ODb7sex9s5XWZTNflxJDlGcC o1jCOC9jWU7TYcL6vTsZ2+vJNWqJer7Ra7KqyeQpxIJk/rbnX8bZnHr5juODzXbtaH hlalhPTlL9JlJu1orP6/NxFjy9D9pI+ndY19GpYXbji4oEiDvl9q/84ZEsKiaOOyh0 qy0GuFCOnDFMO1PDjXCPd7Afgv3cPR0GY7HniNQEmGllGH+FWM48mQP7fDawJ09HfB dDsnTmZ3jqIFA== Received: from johan by xi with local (Exim 4.93.0.4) (envelope-from ) id 1lVtAo-0000GD-Tl; Mon, 12 Apr 2021 11:48:02 +0200 From: Johan Hovold To: Johan Hovold Cc: linux-usb@vger.kernel.org Subject: [PATCH 01/10] USB: serial: io_ti: clean up vendor-request helpers Date: Mon, 12 Apr 2021 11:47:29 +0200 Message-Id: <20210412094738.944-2-johan@kernel.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210412094738.944-1-johan@kernel.org> References: <20210412094738.944-1-johan@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Clean up the vendor-request helpers by using kernel-types consistently and using void pointers for the data arguments, which allows removing a cast from one caller. Signed-off-by: Johan Hovold --- drivers/usb/serial/io_ti.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 17720670e06c..5d99e6d25c11 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c @@ -252,8 +252,8 @@ static int edge_remove_sysfs_attrs(struct usb_serial_port *port); #define TI_VSEND_TIMEOUT_DEFAULT 1000 #define TI_VSEND_TIMEOUT_FW_DOWNLOAD 10000 -static int ti_vread_sync(struct usb_device *dev, __u8 request, - __u16 value, __u16 index, u8 *data, int size) +static int ti_vread_sync(struct usb_device *dev, u8 request, u16 value, + u16 index, void *data, int size) { int status; @@ -271,7 +271,7 @@ static int ti_vread_sync(struct usb_device *dev, __u8 request, } static int ti_vsend_sync(struct usb_device *dev, u8 request, u16 value, - u16 index, u8 *data, int size, int timeout) + u16 index, void *data, int size, int timeout) { int status; @@ -284,9 +284,8 @@ static int ti_vsend_sync(struct usb_device *dev, u8 request, u16 value, return 0; } -static int send_cmd(struct usb_device *dev, __u8 command, - __u8 moduleid, __u16 value, u8 *data, - int size) +static int send_cmd(struct usb_device *dev, u8 command, u8 moduleid, + u16 value, void *data, int size) { return ti_vsend_sync(dev, command, value, moduleid, data, size, TI_VSEND_TIMEOUT_DEFAULT); @@ -2354,7 +2353,7 @@ static void change_port_settings(struct tty_struct *tty, status = send_cmd(edge_port->port->serial->dev, UMPC_SET_CONFIG, (__u8)(UMPM_UART1_PORT + port_number), - 0, (__u8 *)config, sizeof(*config)); + 0, config, sizeof(*config)); if (status) dev_dbg(dev, "%s - error %d when trying to write config to device\n", __func__, status); From patchwork Mon Apr 12 09:47:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 12197479 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECD18C433B4 for ; Mon, 12 Apr 2021 09:53:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C3BFA61243 for ; Mon, 12 Apr 2021 09:53:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242273AbhDLJxe (ORCPT ); Mon, 12 Apr 2021 05:53:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:35522 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240566AbhDLJs0 (ORCPT ); Mon, 12 Apr 2021 05:48:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BF1346121E; Mon, 12 Apr 2021 09:48:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618220888; bh=jyhRk8cJ8FQuSo/Iw3sX9HwF9/KVoQaDVz5B1ASHdI4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XPaUOUpB+0kxraLQBpf3gTrDC3Q3s2uJmutlYmtepjNtFgV4HxPV820uDbp3c3mr8 2cVdpz9cgP4L+prUFnGz+idvBpDT1BWWx4/a821ZPt0iBeRPGRDUv4WpFFS0dBq0Pj rjBNqU/IAwNl/MfrdYQx6hTQNHPDA0Tc8wvTiKH+jOB+ZPBwzuOspFv5oI4KxcjkcP Ao6lxxKbK8O+83h0AoiDVECl9I6Egivz/8xH9QgRo1iRGHYkrUxFinoIfe8votVKVb k2MkvaFoRzOFOqow183Tuv2xL2Qdx7Iacu57kHK4OCHHt8sJt3AMm8Dr1MFrxu2vnU /WPlGNZtkdjBQ== Received: from johan by xi with local (Exim 4.93.0.4) (envelope-from ) id 1lVtAp-0000GF-05; Mon, 12 Apr 2021 11:48:03 +0200 From: Johan Hovold To: Johan Hovold Cc: linux-usb@vger.kernel.org Subject: [PATCH 02/10] USB: serial: io_ti: add send-port-command helper Date: Mon, 12 Apr 2021 11:47:30 +0200 Message-Id: <20210412094738.944-3-johan@kernel.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210412094738.944-1-johan@kernel.org> References: <20210412094738.944-1-johan@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Add a send-port-command helper which takes care of determining the UART module id when sending commands instead of doing so at every call site. Signed-off-by: Johan Hovold --- drivers/usb/serial/io_ti.c | 41 ++++++++++++-------------------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 5d99e6d25c11..f65a712078ab 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c @@ -284,11 +284,12 @@ static int ti_vsend_sync(struct usb_device *dev, u8 request, u16 value, return 0; } -static int send_cmd(struct usb_device *dev, u8 command, u8 moduleid, - u16 value, void *data, int size) +static int send_port_cmd(struct usb_serial_port *port, u8 command, u16 value, + void *data, int size) { - return ti_vsend_sync(dev, command, value, moduleid, data, size, - TI_VSEND_TIMEOUT_DEFAULT); + return ti_vsend_sync(port->serial->dev, command, value, + UMPM_UART1_PORT + port->port_number, + data, size, TI_VSEND_TIMEOUT_DEFAULT); } /* clear tx/rx buffers and fifo in TI UMP */ @@ -298,12 +299,7 @@ static int purge_port(struct usb_serial_port *port, __u16 mask) dev_dbg(&port->dev, "%s - port %d, mask %x\n", __func__, port_number, mask); - return send_cmd(port->serial->dev, - UMPC_PURGE_PORT, - (__u8)(UMPM_UART1_PORT + port_number), - mask, - NULL, - 0); + return send_port_cmd(port, UMPC_PURGE_PORT, mask, NULL, 0); } /** @@ -1500,12 +1496,9 @@ static int do_boot_mode(struct edgeport_serial *serial, static int ti_do_config(struct edgeport_port *port, int feature, int on) { - int port_number = port->port->port_number; - on = !!on; /* 1 or 0 not bitmask */ - return send_cmd(port->port->serial->dev, - feature, (__u8)(UMPM_UART1_PORT + port_number), - on, NULL, 0); + + return send_port_cmd(port->port, feature, on, NULL, 0); } static int restore_mcr(struct edgeport_port *port, __u8 mcr) @@ -1874,8 +1867,7 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) dev_dbg(&port->dev, "%s - Sending UMPC_OPEN_PORT\n", __func__); /* Tell TI to open and start the port */ - status = send_cmd(dev, UMPC_OPEN_PORT, - (u8)(UMPM_UART1_PORT + port_number), open_settings, NULL, 0); + status = send_port_cmd(port, UMPC_OPEN_PORT, open_settings, NULL, 0); if (status) { dev_err(&port->dev, "%s - cannot send open command, %d\n", __func__, status); @@ -1883,8 +1875,7 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) } /* Start the DMA? */ - status = send_cmd(dev, UMPC_START_PORT, - (u8)(UMPM_UART1_PORT + port_number), 0, NULL, 0); + status = send_port_cmd(port, UMPC_START_PORT, 0, NULL, 0); if (status) { dev_err(&port->dev, "%s - cannot send start DMA command, %d\n", __func__, status); @@ -1967,9 +1958,7 @@ static void edge_close(struct usb_serial_port *port) { struct edgeport_serial *edge_serial; struct edgeport_port *edge_port; - struct usb_serial *serial = port->serial; unsigned long flags; - int port_number; edge_serial = usb_get_serial_data(port->serial); edge_port = usb_get_serial_port_data(port); @@ -1990,9 +1979,7 @@ static void edge_close(struct usb_serial_port *port) spin_unlock_irqrestore(&edge_port->ep_lock, flags); dev_dbg(&port->dev, "%s - send umpc_close_port\n", __func__); - port_number = port->port_number; - send_cmd(serial->dev, UMPC_CLOSE_PORT, - (__u8)(UMPM_UART1_PORT + port_number), 0, NULL, 0); + send_port_cmd(port, UMPC_CLOSE_PORT, 0, NULL, 0); mutex_lock(&edge_serial->es_lock); --edge_port->edge_serial->num_ports_open; @@ -2225,7 +2212,6 @@ static void change_port_settings(struct tty_struct *tty, int baud; unsigned cflag; int status; - int port_number = edge_port->port->port_number; config = kmalloc (sizeof (*config), GFP_KERNEL); if (!config) { @@ -2351,9 +2337,8 @@ static void change_port_settings(struct tty_struct *tty, cpu_to_be16s(&config->wFlags); cpu_to_be16s(&config->wBaudRate); - status = send_cmd(edge_port->port->serial->dev, UMPC_SET_CONFIG, - (__u8)(UMPM_UART1_PORT + port_number), - 0, config, sizeof(*config)); + status = send_port_cmd(edge_port->port, UMPC_SET_CONFIG, 0, config, + sizeof(*config)); if (status) dev_dbg(dev, "%s - error %d when trying to write config to device\n", __func__, status); From patchwork Mon Apr 12 09:47:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 12197475 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4492DC433ED for ; Mon, 12 Apr 2021 09:53:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0B5D36120B for ; Mon, 12 Apr 2021 09:53:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242112AbhDLJx3 (ORCPT ); Mon, 12 Apr 2021 05:53:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:35512 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240405AbhDLJs0 (ORCPT ); Mon, 12 Apr 2021 05:48:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BC8AD6124C; Mon, 12 Apr 2021 09:48:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618220888; bh=1u6+2U/lTbZfvQi4wEkNsfyEubphBVem/KzYxzaR5fk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PuLFYrM/TE/PzmdjuXS0qCS9K0pxXjU8hB4ToUeJVF+74juHhcuWE3dceBUpG+IIO d3BKS1MxRZOA3c+E9Gi385FcQk7SEvKd2ZS5hIvKrgStOCkFtfjbLJOvwMrPwE2D5Z 2YDqxOKRZSN5Jr6GyOfCPUdxGG4Lmg5feYw85Vh9nbqaOYvd50RIOMcYMXzQle8jxI p9X/ca9cKFAVF9mdDeuN7p0p2MP/q6CHUzMFoNLH/DdUcuriiDD11srgp0bhOIkoNo g7vNyHSNLQAE8C895/2SW+q4cxuE0+szfT2ITnPcxUYQxW/Ur7Qp2SyWE0653/LJNv PQi2rrvOnI66w== Received: from johan by xi with local (Exim 4.93.0.4) (envelope-from ) id 1lVtAp-0000GJ-2b; Mon, 12 Apr 2021 11:48:03 +0200 From: Johan Hovold To: Johan Hovold Cc: linux-usb@vger.kernel.org Subject: [PATCH 03/10] USB: serial: io_ti: add read-port-command helper Date: Mon, 12 Apr 2021 11:47:31 +0200 Message-Id: <20210412094738.944-4-johan@kernel.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210412094738.944-1-johan@kernel.org> References: <20210412094738.944-1-johan@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Add a read-port-command helper analogous to the send-port-command helper to take care of the UART module id instead of open coding. Signed-off-by: Johan Hovold --- drivers/usb/serial/io_ti.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index f65a712078ab..480a73aff78f 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c @@ -284,6 +284,14 @@ static int ti_vsend_sync(struct usb_device *dev, u8 request, u16 value, return 0; } +static int read_port_cmd(struct usb_serial_port *port, u8 command, u16 value, + void *data, int size) +{ + return ti_vread_sync(port->serial->dev, command, value, + UMPM_UART1_PORT + port->port_number, + data, size); +} + static int send_port_cmd(struct usb_serial_port *port, u8 command, u16 value, void *data, int size) { @@ -1826,7 +1834,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) struct edgeport_serial *edge_serial; struct usb_device *dev; struct urb *urb; - int port_number; int status; u16 open_settings; u8 transaction_timeout; @@ -1834,8 +1841,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) if (edge_port == NULL) return -ENODEV; - port_number = port->port_number; - dev = port->serial->dev; /* turn off loopback */ @@ -1892,9 +1897,7 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) } /* Read Initial MSR */ - status = ti_vread_sync(dev, UMPC_READ_MSR, 0, - (__u16)(UMPM_UART1_PORT + port_number), - &edge_port->shadow_msr, 1); + status = read_port_cmd(port, UMPC_READ_MSR, 0, &edge_port->shadow_msr, 1); if (status) { dev_err(&port->dev, "%s - cannot send read MSR command, %d\n", __func__, status); From patchwork Mon Apr 12 09:47:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 12197495 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E31EC43460 for ; Mon, 12 Apr 2021 09:56:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 429DE61262 for ; Mon, 12 Apr 2021 09:56:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242861AbhDLJyQ (ORCPT ); Mon, 12 Apr 2021 05:54:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:35910 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242535AbhDLJu0 (ORCPT ); Mon, 12 Apr 2021 05:50:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B9E946121D; Mon, 12 Apr 2021 09:48:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618220889; bh=qH6RsnGB4PDDNzXXr47X0/dM/gcjFWxfgFnN1I531nI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SEVcCsINLs1J8bYIBs8FkhzPtTkdwFr3Po4G+wNVcE+HxtzfaUFG98uG5JfQO4Z98 XeGTTIZ/hmWJOP1XHouXg0nedTlKzYkxR17zrofx/WsBSjr5wk4ET1TJWPUp7Zzu0I CxcsEBpxY8YnaVwAzWX9UQrXLJUyDJzo7UvojfPgQMjAkUEoUevTABMwIryVoqEMdv 7DE+x/6M85fhpSkGriyflM9+xoLxdIV0DMNX/T+2jKebhYo2TPh1q4oZAXEeFesm4c tj0iwyA+CjgcpRPeQaU3kwx1RRZUxGyt9P74NvT2C8uB1Y6Pg3/E6IigWLpUjHNW8T vVVJEDitXSEhg== Received: from johan by xi with local (Exim 4.93.0.4) (envelope-from ) id 1lVtAp-0000GM-5W; Mon, 12 Apr 2021 11:48:03 +0200 From: Johan Hovold To: Johan Hovold Cc: linux-usb@vger.kernel.org Subject: [PATCH 04/10] USB: serial: io_ti: use kernel types consistently Date: Mon, 12 Apr 2021 11:47:32 +0200 Message-Id: <20210412094738.944-5-johan@kernel.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210412094738.944-1-johan@kernel.org> References: <20210412094738.944-1-johan@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Use kernel types consistently by replacing the remaining __uXX types. Signed-off-by: Johan Hovold --- drivers/usb/serial/io_ti.c | 110 ++++++++++++++++++------------------- drivers/usb/serial/io_ti.h | 32 +++++------ 2 files changed, 71 insertions(+), 71 deletions(-) diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 480a73aff78f..b2e41ddd757e 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c @@ -64,7 +64,7 @@ /* Product information read from the Edgeport */ struct product_info { int TiMode; /* Current TI Mode */ - __u8 hardware_type; /* Type of hardware */ + u8 hardware_type; /* Type of hardware */ } __attribute__((packed)); /* @@ -87,13 +87,13 @@ struct edgeport_fw_hdr { } __packed; struct edgeport_port { - __u16 uart_base; - __u16 dma_address; - __u8 shadow_msr; - __u8 shadow_mcr; - __u8 shadow_lsr; - __u8 lsr_mask; - __u32 ump_read_timeout; /* + u16 uart_base; + u16 dma_address; + u8 shadow_msr; + u8 shadow_mcr; + u8 shadow_lsr; + u8 lsr_mask; + u32 ump_read_timeout; /* * Number of milliseconds the UMP will * wait without data before completing * a read short @@ -104,7 +104,7 @@ struct edgeport_port { struct edgeport_serial *edge_serial; struct usb_serial_port *port; - __u8 bUartMode; /* Port type, 0: RS232, etc. */ + u8 bUartMode; /* Port type, 0: RS232, etc. */ spinlock_t ep_lock; int ep_read_urb_state; int ep_write_urb_in_use; @@ -301,7 +301,7 @@ static int send_port_cmd(struct usb_serial_port *port, u8 command, u16 value, } /* clear tx/rx buffers and fifo in TI UMP */ -static int purge_port(struct usb_serial_port *port, __u16 mask) +static int purge_port(struct usb_serial_port *port, u16 mask) { int port_number = port->port_number; @@ -319,10 +319,10 @@ static int purge_port(struct usb_serial_port *port, __u16 mask) * @buffer: pointer to input data buffer */ static int read_download_mem(struct usb_device *dev, int start_address, - int length, __u8 address_type, __u8 *buffer) + int length, u8 address_type, u8 *buffer) { int status = 0; - __u8 read_length; + u8 read_length; u16 be_start_address; dev_dbg(&dev->dev, "%s - @ %x for %d\n", __func__, start_address, length); @@ -335,7 +335,7 @@ static int read_download_mem(struct usb_device *dev, int start_address, if (length > 64) read_length = 64; else - read_length = (__u8)length; + read_length = (u8)length; if (read_length > 1) { dev_dbg(&dev->dev, "%s - @ %x for %d\n", __func__, start_address, read_length); @@ -346,7 +346,7 @@ static int read_download_mem(struct usb_device *dev, int start_address, */ be_start_address = swab16((u16)start_address); status = ti_vread_sync(dev, UMPC_MEMORY_READ, - (__u16)address_type, + (u16)address_type, be_start_address, buffer, read_length); @@ -368,7 +368,7 @@ static int read_download_mem(struct usb_device *dev, int start_address, } static int read_ram(struct usb_device *dev, int start_address, - int length, __u8 *buffer) + int length, u8 *buffer) { return read_download_mem(dev, start_address, length, DTK_ADDR_SPACE_XDATA, buffer); @@ -376,7 +376,7 @@ static int read_ram(struct usb_device *dev, int start_address, /* Read edgeport memory to a given block */ static int read_boot_mem(struct edgeport_serial *serial, - int start_address, int length, __u8 *buffer) + int start_address, int length, u8 *buffer) { int status = 0; int i; @@ -384,7 +384,7 @@ static int read_boot_mem(struct edgeport_serial *serial, for (i = 0; i < length; i++) { status = ti_vread_sync(serial->serial->dev, UMPC_MEMORY_READ, serial->TI_I2C_Type, - (__u16)(start_address+i), &buffer[i], 0x01); + (u16)(start_address+i), &buffer[i], 0x01); if (status) { dev_dbg(&serial->serial->dev->dev, "%s - ERROR %x\n", __func__, status); return status; @@ -402,7 +402,7 @@ static int read_boot_mem(struct edgeport_serial *serial, /* Write given block to TI EPROM memory */ static int write_boot_mem(struct edgeport_serial *serial, - int start_address, int length, __u8 *buffer) + int start_address, int length, u8 *buffer) { int status = 0; int i; @@ -436,7 +436,7 @@ static int write_boot_mem(struct edgeport_serial *serial, /* Write edgeport I2C memory to TI chip */ static int write_i2c_mem(struct edgeport_serial *serial, - int start_address, int length, __u8 address_type, __u8 *buffer) + int start_address, int length, u8 address_type, u8 *buffer) { struct device *dev = &serial->serial->dev->dev; int status = 0; @@ -522,7 +522,7 @@ static int tx_active(struct edgeport_port *port) { int status; struct out_endpoint_desc_block *oedb; - __u8 *lsr; + u8 *lsr; int bytes_left = 0; oedb = kmalloc(sizeof(*oedb), GFP_KERNEL); @@ -593,7 +593,7 @@ static int choose_config(struct usb_device *dev) } static int read_rom(struct edgeport_serial *serial, - int start_address, int length, __u8 *buffer) + int start_address, int length, u8 *buffer) { int status; @@ -611,7 +611,7 @@ static int read_rom(struct edgeport_serial *serial, } static int write_rom(struct edgeport_serial *serial, int start_address, - int length, __u8 *buffer) + int length, u8 *buffer) { if (serial->product_info.TiMode == TI_MODE_BOOT) return write_boot_mem(serial, start_address, length, @@ -636,7 +636,7 @@ static int get_descriptor_addr(struct edgeport_serial *serial, status = read_rom(serial, start_address, sizeof(struct ti_i2c_desc), - (__u8 *)rom_desc); + (u8 *)rom_desc); if (status) return 0; @@ -652,13 +652,13 @@ static int get_descriptor_addr(struct edgeport_serial *serial, } /* Validate descriptor checksum */ -static int valid_csum(struct ti_i2c_desc *rom_desc, __u8 *buffer) +static int valid_csum(struct ti_i2c_desc *rom_desc, u8 *buffer) { - __u16 i; - __u8 cs = 0; + u16 i; + u8 cs = 0; for (i = 0; i < le16_to_cpu(rom_desc->Size); i++) - cs = (__u8)(cs + buffer[i]); + cs = (u8)(cs + buffer[i]); if (cs != rom_desc->CheckSum) { pr_debug("%s - Mismatch %x - %x", __func__, rom_desc->CheckSum, cs); @@ -674,8 +674,8 @@ static int check_i2c_image(struct edgeport_serial *serial) int status = 0; struct ti_i2c_desc *rom_desc; int start_address = 2; - __u8 *buffer; - __u16 ttype; + u8 *buffer; + u16 ttype; rom_desc = kmalloc(sizeof(*rom_desc), GFP_KERNEL); if (!rom_desc) @@ -703,7 +703,7 @@ static int check_i2c_image(struct edgeport_serial *serial) status = read_rom(serial, start_address, sizeof(struct ti_i2c_desc), - (__u8 *)rom_desc); + (u8 *)rom_desc); if (status) break; @@ -748,7 +748,7 @@ static int check_i2c_image(struct edgeport_serial *serial) return status; } -static int get_manuf_info(struct edgeport_serial *serial, __u8 *buffer) +static int get_manuf_info(struct edgeport_serial *serial, u8 *buffer) { int status; int start_address; @@ -793,10 +793,10 @@ static int get_manuf_info(struct edgeport_serial *serial, __u8 *buffer) /* Build firmware header used for firmware update */ static int build_i2c_fw_hdr(u8 *header, const struct firmware *fw) { - __u8 *buffer; + u8 *buffer; int buffer_size; int i; - __u8 cs = 0; + u8 cs = 0; struct ti_i2c_desc *i2c_header; struct ti_i2c_image_header *img_header; struct ti_i2c_firmware_rec *firmware_rec; @@ -840,7 +840,7 @@ static int build_i2c_fw_hdr(u8 *header, const struct firmware *fw) le16_to_cpu(img_header->Length)); for (i=0; i < buffer_size; i++) { - cs = (__u8)(cs + buffer[i]); + cs = (u8)(cs + buffer[i]); } kfree(buffer); @@ -916,7 +916,7 @@ static int bulk_xfer(struct usb_serial *serial, void *buffer, } /* Download given firmware image to the device (IN BOOT MODE) */ -static int download_code(struct edgeport_serial *serial, __u8 *image, +static int download_code(struct edgeport_serial *serial, u8 *image, int image_length) { int status = 0; @@ -1090,7 +1090,7 @@ static int do_download_mode(struct edgeport_serial *serial, if (!ti_manuf_desc) return -ENOMEM; - status = get_manuf_info(serial, (__u8 *)ti_manuf_desc); + status = get_manuf_info(serial, (u8 *)ti_manuf_desc); if (status) { kfree(ti_manuf_desc); return status; @@ -1135,7 +1135,7 @@ static int do_download_mode(struct edgeport_serial *serial, status = read_rom(serial, start_address + sizeof(struct ti_i2c_desc), sizeof(struct ti_i2c_firmware_rec), - (__u8 *)firmware_version); + (u8 *)firmware_version); if (status) { kfree(firmware_version); kfree(rom_desc); @@ -1261,8 +1261,8 @@ static int do_download_mode(struct edgeport_serial *serial, if (start_address != 0) { #define HEADER_SIZE (sizeof(struct ti_i2c_desc) + \ sizeof(struct ti_i2c_firmware_rec)) - __u8 *header; - __u8 *vheader; + u8 *header; + u8 *vheader; header = kmalloc(HEADER_SIZE, GFP_KERNEL); if (!header) { @@ -1408,8 +1408,8 @@ static int do_boot_mode(struct edgeport_serial *serial, if (!check_i2c_image(serial)) { struct ti_i2c_image_header *header; int i; - __u8 cs = 0; - __u8 *buffer; + u8 cs = 0; + u8 *buffer; int buffer_size; /* @@ -1420,7 +1420,7 @@ static int do_boot_mode(struct edgeport_serial *serial, if (!ti_manuf_desc) return -ENOMEM; - status = get_manuf_info(serial, (__u8 *)ti_manuf_desc); + status = get_manuf_info(serial, (u8 *)ti_manuf_desc); if (status) { kfree(ti_manuf_desc); goto stayinbootmode; @@ -1463,13 +1463,13 @@ static int do_boot_mode(struct edgeport_serial *serial, for (i = sizeof(struct ti_i2c_image_header); i < buffer_size; i++) { - cs = (__u8)(cs + buffer[i]); + cs = (u8)(cs + buffer[i]); } header = (struct ti_i2c_image_header *)buffer; /* update length and checksum after padding */ - header->Length = cpu_to_le16((__u16)(buffer_size - + header->Length = cpu_to_le16((u16)(buffer_size - sizeof(struct ti_i2c_image_header))); header->CheckSum = cs; @@ -1509,7 +1509,7 @@ static int ti_do_config(struct edgeport_port *port, int feature, int on) return send_port_cmd(port->port, feature, on, NULL, 0); } -static int restore_mcr(struct edgeport_port *port, __u8 mcr) +static int restore_mcr(struct edgeport_port *port, u8 mcr) { int status = 0; @@ -1525,9 +1525,9 @@ static int restore_mcr(struct edgeport_port *port, __u8 mcr) } /* Convert TI LSR to standard UART flags */ -static __u8 map_line_status(__u8 ti_lsr) +static u8 map_line_status(u8 ti_lsr) { - __u8 lsr = 0; + u8 lsr = 0; #define MAP_FLAG(flagUmp, flagUart) \ if (ti_lsr & flagUmp) \ @@ -1545,7 +1545,7 @@ static __u8 map_line_status(__u8 ti_lsr) return lsr; } -static void handle_new_msr(struct edgeport_port *edge_port, __u8 msr) +static void handle_new_msr(struct edgeport_port *edge_port, u8 msr) { struct async_icount *icount; struct tty_struct *tty; @@ -1581,10 +1581,10 @@ static void handle_new_msr(struct edgeport_port *edge_port, __u8 msr) } static void handle_new_lsr(struct edgeport_port *edge_port, int lsr_data, - __u8 lsr, __u8 data) + u8 lsr, u8 data) { struct async_icount *icount; - __u8 new_lsr = (__u8)(lsr & (__u8)(LSR_OVER_ERR | LSR_PAR_ERR | + u8 new_lsr = (u8)(lsr & (u8)(LSR_OVER_ERR | LSR_PAR_ERR | LSR_FRM_ERR | LSR_BREAK)); dev_dbg(&edge_port->port->dev, "%s - %02x\n", __func__, new_lsr); @@ -1596,7 +1596,7 @@ static void handle_new_lsr(struct edgeport_port *edge_port, int lsr_data, * Parity and Framing errors only count if they * occur exclusive of a break being received. */ - new_lsr &= (__u8)(LSR_OVER_ERR | LSR_BREAK); + new_lsr &= (u8)(LSR_OVER_ERR | LSR_BREAK); /* Place LSR data byte into Rx buffer */ if (lsr_data) @@ -1625,8 +1625,8 @@ static void edge_interrupt_callback(struct urb *urb) int port_number; int function; int retval; - __u8 lsr; - __u8 msr; + u8 lsr; + u8 msr; int status = urb->status; switch (status) { @@ -2229,7 +2229,7 @@ static void change_port_settings(struct tty_struct *tty, /* These flags must be set */ config->wFlags |= UMP_MASK_UART_FLAGS_RECEIVE_MS_INT; config->wFlags |= UMP_MASK_UART_FLAGS_AUTO_START_ON_ERR; - config->bUartMode = (__u8)(edge_port->bUartMode); + config->bUartMode = (u8)(edge_port->bUartMode); switch (cflag & CSIZE) { case CS5: @@ -2321,7 +2321,7 @@ static void change_port_settings(struct tty_struct *tty, } edge_port->baud_rate = baud; - config->wBaudRate = (__u16)((461550L + baud/2) / baud); + config->wBaudRate = (u16)((461550L + baud/2) / baud); /* FIXME: Recompute actual baud from divisor here */ diff --git a/drivers/usb/serial/io_ti.h b/drivers/usb/serial/io_ti.h index 50b899d55ed0..e31406c252dd 100644 --- a/drivers/usb/serial/io_ti.h +++ b/drivers/usb/serial/io_ti.h @@ -133,14 +133,14 @@ #define UMPD_OEDB2_ADDRESS 0xFF10 struct out_endpoint_desc_block { - __u8 Configuration; - __u8 XBufAddr; - __u8 XByteCount; - __u8 Unused1; - __u8 Unused2; - __u8 YBufAddr; - __u8 YByteCount; - __u8 BufferSize; + u8 Configuration; + u8 XBufAddr; + u8 XByteCount; + u8 Unused1; + u8 Unused2; + u8 YBufAddr; + u8 YByteCount; + u8 BufferSize; } __attribute__((packed)); @@ -150,14 +150,14 @@ struct out_endpoint_desc_block { */ /* UART settings */ struct ump_uart_config { - __u16 wBaudRate; /* Baud rate */ - __u16 wFlags; /* Bitmap mask of flags */ - __u8 bDataBits; /* 5..8 - data bits per character */ - __u8 bParity; /* Parity settings */ - __u8 bStopBits; /* Stop bits settings */ + u16 wBaudRate; /* Baud rate */ + u16 wFlags; /* Bitmap mask of flags */ + u8 bDataBits; /* 5..8 - data bits per character */ + u8 bParity; /* Parity settings */ + u8 bStopBits; /* Stop bits settings */ char cXon; /* XON character */ char cXoff; /* XOFF character */ - __u8 bUartMode; /* Will be updated when a user */ + u8 bUartMode; /* Will be updated when a user */ /* interface is defined */ } __attribute__((packed)); @@ -168,8 +168,8 @@ struct ump_uart_config { */ /* Interrupt packet structure */ struct ump_interrupt { - __u8 bICode; /* Interrupt code (interrupt num) */ - __u8 bIInfo; /* Interrupt information */ + u8 bICode; /* Interrupt code (interrupt num) */ + u8 bIInfo; /* Interrupt information */ } __attribute__((packed)); From patchwork Mon Apr 12 09:47:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 12197483 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C5F9C433B4 for ; Mon, 12 Apr 2021 09:53:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EEF2D61243 for ; Mon, 12 Apr 2021 09:53:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242438AbhDLJxl (ORCPT ); Mon, 12 Apr 2021 05:53:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:35902 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242473AbhDLJuS (ORCPT ); Mon, 12 Apr 2021 05:50:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C20FA61261; Mon, 12 Apr 2021 09:48:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618220888; bh=SacsNMsD7qMpaC8Pm4RXTvMaz/GI6AhSy077SEOrgQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rYCmJy8BralkeK7z6eMO0ONYpy3yr/RePhfiJBCpyBki4nkjfKvtNi7ZV/pv32PzD iMCwg2a16ZIh4C2nZU+VG9RO0cac39tGz/gob1WqnLbi38dbma+Yx9kCokg5xt8AyM /Zq2AY0eD0fVYQr4stXtG2QPEFxB4/umN5h6mgCuNY1u9T9okG5TdBy3Br4+nm2j2Y HUM6QYWKSkCnW8QPsQ/ONhAeAAxQG+OwjnN+zf7/YDT47J04YZd4QPoFjOgiCcov3g NNBBZ92/GcAVTnfsROcrrNDFWzVLVdynPZpHHLBiCJwFNWbtLN2WiXy9zvI09IGxhs fwxnpMBO8S3PA== Received: from johan by xi with local (Exim 4.93.0.4) (envelope-from ) id 1lVtAp-0000GP-8u; Mon, 12 Apr 2021 11:48:03 +0200 From: Johan Hovold To: Johan Hovold Cc: linux-usb@vger.kernel.org Subject: [PATCH 05/10] USB: serial: io_ti: drop unnecessary packed attributes Date: Mon, 12 Apr 2021 11:47:33 +0200 Message-Id: <20210412094738.944-6-johan@kernel.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210412094738.944-1-johan@kernel.org> References: <20210412094738.944-1-johan@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Drop unnecessary packed attributes from structures that don't need it and use the __packed macro consistently. Signed-off-by: Johan Hovold --- drivers/usb/serial/io_ti.c | 2 +- drivers/usb/serial/io_ti.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index b2e41ddd757e..39503fdccebf 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c @@ -65,7 +65,7 @@ struct product_info { int TiMode; /* Current TI Mode */ u8 hardware_type; /* Type of hardware */ -} __attribute__((packed)); +} __packed; /* * Edgeport firmware header diff --git a/drivers/usb/serial/io_ti.h b/drivers/usb/serial/io_ti.h index e31406c252dd..24fe1312c84d 100644 --- a/drivers/usb/serial/io_ti.h +++ b/drivers/usb/serial/io_ti.h @@ -141,7 +141,7 @@ struct out_endpoint_desc_block { u8 YBufAddr; u8 YByteCount; u8 BufferSize; -} __attribute__((packed)); +}; /* @@ -159,7 +159,7 @@ struct ump_uart_config { char cXoff; /* XOFF character */ u8 bUartMode; /* Will be updated when a user */ /* interface is defined */ -} __attribute__((packed)); +}; /* @@ -170,7 +170,7 @@ struct ump_uart_config { struct ump_interrupt { u8 bICode; /* Interrupt code (interrupt num) */ u8 bIInfo; /* Interrupt information */ -} __attribute__((packed)); +}; #define TIUMP_GET_PORT_FROM_CODE(c) (((c) >> 6) & 0x01) From patchwork Mon Apr 12 09:47:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 12197485 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36B3CC433B4 for ; Mon, 12 Apr 2021 09:53:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 180CB61247 for ; Mon, 12 Apr 2021 09:53:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241407AbhDLJxn (ORCPT ); Mon, 12 Apr 2021 05:53:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:35904 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242475AbhDLJuS (ORCPT ); Mon, 12 Apr 2021 05:50:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C6D9F61277; Mon, 12 Apr 2021 09:48:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618220888; bh=h9fvXgLThgG6bWbqBFZJHQe5cKyhLIqCsS03LB273xY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cx1/9Sr/RPp6jA8em+yqLS4wR8XzlEbn04Tm4AgqhTXkzE4y0wY/L25ocLFIH9ggx YWaRZG3Ndukk56E5pwiuU4klyU3eE6+u92Gt/WH8x8b6WFCg4lDkABYUSUgagybG8k T0TQJkW2CSyC9aOLs1mzmnSl9TcKpA8vLwpwjkWPCEzAD1npbSxQdMrTX+nl1OeVMR zuuhCSv1yDKkPfJQaSekgh8lSWb4xbH11gN0lxXHJwLLUR9q9Fa3k7M+kY+EqHxPXv gAzfVLm7ikGWGG395NrENo8PGz/JLR9jXhPXw5Phf5wKv7e1fkkym8iVJ/mvAU9G8R KTy6ZVah9M1OQ== Received: from johan by xi with local (Exim 4.93.0.4) (envelope-from ) id 1lVtAp-0000GS-BC; Mon, 12 Apr 2021 11:48:03 +0200 From: Johan Hovold To: Johan Hovold Cc: linux-usb@vger.kernel.org Subject: [PATCH 06/10] USB: serial: ti_usb_3410_5052: drop unnecessary packed attributes Date: Mon, 12 Apr 2021 11:47:34 +0200 Message-Id: <20210412094738.944-7-johan@kernel.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210412094738.944-1-johan@kernel.org> References: <20210412094738.944-1-johan@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Drop unnecessary packed attributes from structures that don't need it. Signed-off-by: Johan Hovold --- drivers/usb/serial/ti_usb_3410_5052.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index d9bffb2de8bf..11e6792981b7 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c @@ -184,7 +184,7 @@ struct ti_uart_config { char cXon; char cXoff; u8 bUartMode; -} __packed; +}; /* Get port status */ struct ti_port_status { @@ -193,7 +193,7 @@ struct ti_port_status { u8 bErrorCode; u8 bMSR; u8 bLSR; -} __packed; +}; /* Purge modes */ #define TI_PURGE_OUTPUT 0x00 @@ -236,13 +236,13 @@ struct ti_read_data_bytes { __u8 bModuleId; __u8 bErrorCode; __u8 bData[]; -} __packed; +}; /* Interrupt struct */ struct ti_interrupt { __u8 bICode; __u8 bIInfo; -} __packed; +}; /* Interrupt codes */ #define TI_CODE_HARDWARE_ERROR 0xFF From patchwork Mon Apr 12 09:47:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 12197487 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FDD8C433B4 for ; Mon, 12 Apr 2021 09:53:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1F7EA6121D for ; Mon, 12 Apr 2021 09:53:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238456AbhDLJxp (ORCPT ); Mon, 12 Apr 2021 05:53:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:35908 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242534AbhDLJu0 (ORCPT ); Mon, 12 Apr 2021 05:50:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D415A6125F; Mon, 12 Apr 2021 09:48:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618220889; bh=9d+kzp2tdUev6VliW4VYKC4a67tJ2oBEUnHcE9oQ61c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SZW2rPSEiGrBVbCTC1p9Fj5FL2DLwxNlk9Ug+Lpu2p1SHgfOembV4cyX3alw+GoBA RZPOTDoXJqXHHaUVJw9Yd7FsdV7DBrK+dgOAsmHVPNfp2T9KJ2Ic5WKfWYtF1bQR1e ct2gjf6AEmgmUanRuRPn/1wkrcLlWnm7I6z7vUVl7ojBnGPDV3ePnl4quXXfDrFvZZ SLw5C3S2uaRGJQjc4eFiWsHg+XBGBumjlizVbBMbYh5LE9/8JJ33PheWPVoqB/Uevv 9h196MEPoS5Yb6RvMfggI6PAWhoU1qQe/RlVcXcFM8bzmmQqex/900GhGgWQo8YXsJ TwS/u8l5PAUYw== Received: from johan by xi with local (Exim 4.93.0.4) (envelope-from ) id 1lVtAp-0000GV-E6; Mon, 12 Apr 2021 11:48:03 +0200 From: Johan Hovold To: Johan Hovold Cc: linux-usb@vger.kernel.org Subject: [PATCH 07/10] USB: serial: ti_usb_3410_5052: clean up vendor-request helpers Date: Mon, 12 Apr 2021 11:47:35 +0200 Message-Id: <20210412094738.944-8-johan@kernel.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210412094738.944-1-johan@kernel.org> References: <20210412094738.944-1-johan@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Make the vendor-request helpers data parameters be void pointers and drop the caller casts. Signed-off-by: Johan Hovold --- drivers/usb/serial/ti_usb_3410_5052.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 11e6792981b7..25d5a6e83009 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c @@ -334,9 +334,9 @@ 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); static int ti_command_out_sync(struct ti_device *tdev, __u8 command, - __u16 moduleid, __u16 value, __u8 *data, int size); + __u16 moduleid, __u16 value, void *data, int size); static int ti_command_in_sync(struct ti_device *tdev, __u8 command, - __u16 moduleid, __u16 value, __u8 *data, int size); + __u16 moduleid, __u16 value, void *data, int size); static int ti_write_byte(struct usb_serial_port *port, struct ti_device *tdev, unsigned long addr, u8 mask, u8 byte); @@ -999,7 +999,7 @@ static void ti_set_termios(struct tty_struct *tty, 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, + (__u8)(TI_UART1_PORT + port_number), 0, config, sizeof(*config)); if (status) dev_err(&port->dev, "%s - cannot set config on port %d, %d\n", @@ -1376,7 +1376,7 @@ static int ti_get_lsr(struct ti_port *tport, u8 *lsr) return -ENOMEM; status = ti_command_in_sync(tdev, TI_GET_PORT_STATUS, - (__u8)(TI_UART1_PORT+port_number), 0, (__u8 *)data, size); + (__u8)(TI_UART1_PORT+port_number), 0, data, size); if (status) { dev_err(&port->dev, "%s - get port status command failed, %d\n", @@ -1475,7 +1475,7 @@ static int ti_restart_read(struct ti_port *tport, struct tty_struct *tty) static int ti_command_out_sync(struct ti_device *tdev, __u8 command, - __u16 moduleid, __u16 value, __u8 *data, int size) + __u16 moduleid, __u16 value, void *data, int size) { int status; @@ -1492,7 +1492,7 @@ static int ti_command_out_sync(struct ti_device *tdev, __u8 command, static int ti_command_in_sync(struct ti_device *tdev, __u8 command, - __u16 moduleid, __u16 value, __u8 *data, int size) + __u16 moduleid, __u16 value, void *data, int size) { int status; @@ -1535,8 +1535,7 @@ static int ti_write_byte(struct usb_serial_port *port, data->bData[1] = byte; status = ti_command_out_sync(tdev, TI_WRITE_DATA, TI_RAM_PORT, 0, - (__u8 *)data, size); - + data, size); if (status < 0) dev_err(&port->dev, "%s - failed, %d\n", __func__, status); From patchwork Mon Apr 12 09:47:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 12197489 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB53BC433ED for ; Mon, 12 Apr 2021 09:56:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 916506121D for ; Mon, 12 Apr 2021 09:56:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237377AbhDLJyD (ORCPT ); Mon, 12 Apr 2021 05:54:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:35912 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242532AbhDLJu0 (ORCPT ); Mon, 12 Apr 2021 05:50:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E49A1611AD; Mon, 12 Apr 2021 09:48:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618220889; bh=g6aOx7cCccnc41Y05RH5FwlkJS7QwPbOY3agjMVQwDo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TVCUGtChMN7sILus3D0WbcPr569NiN8Hs532h4XdMcl2juhtEo78i5YeZe/+KXY7s As3BYIuIZ5hx0nRmcOeT+CWMU6N9YyOC97JvcPJGav8UjcSwX1B4cahKofbWSMa39l E82MJ21rklowe8hSPYuIps6eTP2fbFRGyDXplJO9FEE2vHxluAGe1uxm+r1WyIrZfN frrNMdf7Vw9Ig0caoZtVqh0lHmDwatXOx8FZOCIfwKJcXlMn0R3Ur51x+Xw2PgKaVl pBiW8egTZDmdkOhqnOhJT3KUl0/0kvegLQmvcbTshtGehqVF0SZkNanxs97LY4B7n2 bPh7LP3TXH9lA== Received: from johan by xi with local (Exim 4.93.0.4) (envelope-from ) id 1lVtAp-0000GY-HI; Mon, 12 Apr 2021 11:48:03 +0200 From: Johan Hovold To: Johan Hovold Cc: linux-usb@vger.kernel.org Subject: [PATCH 08/10] USB: serial: ti_usb_3410_5052: add port-command helpers Date: Mon, 12 Apr 2021 11:47:36 +0200 Message-Id: <20210412094738.944-9-johan@kernel.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210412094738.944-1-johan@kernel.org> References: <20210412094738.944-1-johan@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Add two port-command helpers to handle the UART module-id parameter instead of open coding. Signed-off-by: Johan Hovold --- drivers/usb/serial/ti_usb_3410_5052.c | 95 +++++++++++++-------------- 1 file changed, 45 insertions(+), 50 deletions(-) diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 25d5a6e83009..f63ee11f41e8 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c @@ -333,10 +333,14 @@ 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); -static int ti_command_out_sync(struct ti_device *tdev, __u8 command, +static int ti_command_out_sync(struct usb_device *udev, __u8 command, __u16 moduleid, __u16 value, void *data, int size); -static int ti_command_in_sync(struct ti_device *tdev, __u8 command, +static int ti_command_in_sync(struct usb_device *udev, __u8 command, __u16 moduleid, __u16 value, void *data, int size); +static int ti_port_cmd_out(struct usb_serial_port *port, u8 command, + u16 value, void *data, int size); +static int ti_port_cmd_in(struct usb_serial_port *port, u8 command, + u16 value, void *data, int size); static int ti_write_byte(struct usb_serial_port *port, struct ti_device *tdev, unsigned long addr, u8 mask, u8 byte); @@ -635,10 +639,10 @@ static int ti_open(struct tty_struct *tty, struct usb_serial_port *port) struct ti_device *tdev; struct usb_device *dev; struct urb *urb; - int port_number; int status; u16 open_settings; + open_settings = (TI_PIPE_MODE_CONTINUOUS | TI_PIPE_TIMEOUT_ENABLE | (TI_TRANSFER_TIMEOUT << 2)); @@ -650,8 +654,6 @@ static int ti_open(struct tty_struct *tty, struct usb_serial_port *port) if (mutex_lock_interruptible(&tdev->td_open_close_lock)) return -ERESTARTSYS; - port_number = port->port_number; - tport->tp_msr = 0; tport->tp_shadow_mcr |= (TI_MCR_RTS | TI_MCR_DTR); @@ -675,31 +677,27 @@ static int ti_open(struct tty_struct *tty, struct usb_serial_port *port) if (tty) ti_set_termios(tty, port, &tty->termios); - status = ti_command_out_sync(tdev, TI_OPEN_PORT, - (__u8)(TI_UART1_PORT + port_number), open_settings, NULL, 0); + status = ti_port_cmd_out(port, TI_OPEN_PORT, open_settings, NULL, 0); if (status) { dev_err(&port->dev, "%s - cannot send open command, %d\n", __func__, status); goto unlink_int_urb; } - status = ti_command_out_sync(tdev, TI_START_PORT, - (__u8)(TI_UART1_PORT + port_number), 0, NULL, 0); + status = ti_port_cmd_out(port, TI_START_PORT, 0, NULL, 0); if (status) { dev_err(&port->dev, "%s - cannot send start command, %d\n", __func__, status); goto unlink_int_urb; } - status = ti_command_out_sync(tdev, TI_PURGE_PORT, - (__u8)(TI_UART1_PORT + port_number), TI_PURGE_INPUT, NULL, 0); + status = ti_port_cmd_out(port, TI_PURGE_PORT, TI_PURGE_INPUT, NULL, 0); if (status) { dev_err(&port->dev, "%s - cannot clear input buffers, %d\n", __func__, status); goto unlink_int_urb; } - status = ti_command_out_sync(tdev, TI_PURGE_PORT, - (__u8)(TI_UART1_PORT + port_number), TI_PURGE_OUTPUT, NULL, 0); + status = ti_port_cmd_out(port, TI_PURGE_PORT, TI_PURGE_OUTPUT, NULL, 0); if (status) { dev_err(&port->dev, "%s - cannot clear output buffers, %d\n", __func__, status); @@ -714,16 +712,14 @@ static int ti_open(struct tty_struct *tty, struct usb_serial_port *port) if (tty) ti_set_termios(tty, port, &tty->termios); - status = ti_command_out_sync(tdev, TI_OPEN_PORT, - (__u8)(TI_UART1_PORT + port_number), open_settings, NULL, 0); + status = ti_port_cmd_out(port, TI_OPEN_PORT, open_settings, NULL, 0); if (status) { dev_err(&port->dev, "%s - cannot send open command (2), %d\n", __func__, status); goto unlink_int_urb; } - status = ti_command_out_sync(tdev, TI_START_PORT, - (__u8)(TI_UART1_PORT + port_number), 0, NULL, 0); + status = ti_port_cmd_out(port, TI_START_PORT, 0, NULL, 0); if (status) { dev_err(&port->dev, "%s - cannot send start command (2), %d\n", __func__, status); @@ -764,7 +760,6 @@ static void ti_close(struct usb_serial_port *port) { struct ti_device *tdev; struct ti_port *tport; - int port_number; int status; unsigned long flags; @@ -780,10 +775,7 @@ static void ti_close(struct usb_serial_port *port) kfifo_reset_out(&port->write_fifo); spin_unlock_irqrestore(&tport->tp_lock, flags); - port_number = port->port_number; - - status = ti_command_out_sync(tdev, TI_CLOSE_PORT, - (__u8)(TI_UART1_PORT + port_number), 0, NULL, 0); + status = ti_port_cmd_out(port, TI_CLOSE_PORT, 0, NULL, 0); if (status) dev_err(&port->dev, "%s - cannot send close port command, %d\n" @@ -904,7 +896,6 @@ static void ti_set_termios(struct tty_struct *tty, struct ti_uart_config *config; int baud; int status; - int port_number = port->port_number; unsigned int mcr; u16 wbaudrate; u16 wflags = 0; @@ -998,12 +989,11 @@ static void ti_set_termios(struct tty_struct *tty, 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, config, - sizeof(*config)); + status = ti_port_cmd_out(port, TI_SET_CONFIG, 0, config, + sizeof(*config)); if (status) dev_err(&port->dev, "%s - cannot set config on port %d, %d\n", - __func__, port_number, status); + __func__, port->port_number, status); /* SET_CONFIG asserts RTS and DTR, reset them correctly */ mcr = tport->tp_shadow_mcr; @@ -1012,9 +1002,8 @@ static void ti_set_termios(struct tty_struct *tty, mcr &= ~(TI_MCR_DTR | TI_MCR_RTS); status = ti_set_mcr(tport, mcr); if (status) - dev_err(&port->dev, - "%s - cannot set modem control on port %d, %d\n", - __func__, port_number, status); + dev_err(&port->dev, "%s - cannot set modem control on port %d, %d\n", + __func__, port->port_number, status); kfree(config); } @@ -1365,9 +1354,7 @@ static int ti_set_mcr(struct ti_port *tport, unsigned int mcr) static int ti_get_lsr(struct ti_port *tport, u8 *lsr) { int size, status; - struct ti_device *tdev = tport->tp_tdev; struct usb_serial_port *port = tport->tp_port; - int port_number = port->port_number; struct ti_port_status *data; size = sizeof(struct ti_port_status); @@ -1375,8 +1362,7 @@ static int ti_get_lsr(struct ti_port *tport, u8 *lsr) if (!data) return -ENOMEM; - status = ti_command_in_sync(tdev, TI_GET_PORT_STATUS, - (__u8)(TI_UART1_PORT+port_number), 0, data, size); + status = ti_port_cmd_in(port, TI_GET_PORT_STATUS, 0, data, size); if (status) { dev_err(&port->dev, "%s - get port status command failed, %d\n", @@ -1473,34 +1459,28 @@ static int ti_restart_read(struct ti_port *tport, struct tty_struct *tty) return status; } - -static int ti_command_out_sync(struct ti_device *tdev, __u8 command, +static int ti_command_out_sync(struct usb_device *udev, __u8 command, __u16 moduleid, __u16 value, void *data, int size) { int status; - status = usb_control_msg(tdev->td_serial->dev, - usb_sndctrlpipe(tdev->td_serial->dev, 0), command, - (USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT), - value, moduleid, data, size, 1000); - + status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), command, + USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, + value, moduleid, data, size, 1000); if (status < 0) return status; return 0; } - -static int ti_command_in_sync(struct ti_device *tdev, __u8 command, +static int ti_command_in_sync(struct usb_device *udev, __u8 command, __u16 moduleid, __u16 value, void *data, int size) { int status; - status = usb_control_msg(tdev->td_serial->dev, - usb_rcvctrlpipe(tdev->td_serial->dev, 0), command, - (USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN), - value, moduleid, data, size, 1000); - + status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), command, + USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, + value, moduleid, data, size, 1000); if (status == size) status = 0; else if (status >= 0) @@ -1509,6 +1489,21 @@ static int ti_command_in_sync(struct ti_device *tdev, __u8 command, return status; } +static int ti_port_cmd_out(struct usb_serial_port *port, u8 command, + u16 value, void *data, int size) +{ + return ti_command_out_sync(port->serial->dev, command, + TI_UART1_PORT + port->port_number, + value, data, size); +} + +static int ti_port_cmd_in(struct usb_serial_port *port, u8 command, + u16 value, void *data, int size) +{ + return ti_command_in_sync(port->serial->dev, command, + TI_UART1_PORT + port->port_number, + value, data, size); +} static int ti_write_byte(struct usb_serial_port *port, struct ti_device *tdev, unsigned long addr, @@ -1534,8 +1529,8 @@ static int ti_write_byte(struct usb_serial_port *port, data->bData[0] = mask; data->bData[1] = byte; - status = ti_command_out_sync(tdev, TI_WRITE_DATA, TI_RAM_PORT, 0, - data, size); + status = ti_command_out_sync(port->serial->dev, TI_WRITE_DATA, + TI_RAM_PORT, 0, data, size); if (status < 0) dev_err(&port->dev, "%s - failed, %d\n", __func__, status); From patchwork Mon Apr 12 09:47:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 12197491 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57FC6C433ED for ; Mon, 12 Apr 2021 09:56:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3064061284 for ; Mon, 12 Apr 2021 09:56:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241489AbhDLJyJ (ORCPT ); Mon, 12 Apr 2021 05:54:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:35914 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242536AbhDLJu0 (ORCPT ); Mon, 12 Apr 2021 05:50:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0967F61288; Mon, 12 Apr 2021 09:48:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618220889; bh=MbuIECVA9D/u19XDPKwheS5aCWi1oiQz/L6V5WcnQ9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AFGrA74O5MYe6t79hBSil6E5tuQ69owe07UEkjsl69i7q3XB1nZs6w+TlLjwP8dHk Fm772KsymiKhQ01XyFT0C/sneSZrH0CCo09D1q7iTyN1S3yCxyko8hSWHwPRt9j2G1 R1dIxw+ovJZC1qw+rfB18TrwonjAJiuaORMc3oI2fK6mWGbr3AWyI0zG/MEhcmue5+ Ju2VrMKnuQdSkgMU2+/fKDiRYxLAkzE8XM+Im5ieri6p/QH0H2pHVEswqm81LB9BYD sxlf18ktgDGgCWKP5n/LmZuh0qr3iV7G2MnMM2MR+im/SNhWb8Z2Ej+pflD36wSpur +3PTfNXqeHSLg== Received: from johan by xi with local (Exim 4.93.0.4) (envelope-from ) id 1lVtAp-0000Gb-KU; Mon, 12 Apr 2021 11:48:03 +0200 From: Johan Hovold To: Johan Hovold Cc: linux-usb@vger.kernel.org Subject: [PATCH 09/10] USB: serial: ti_usb_3410_5052: use kernel types consistently Date: Mon, 12 Apr 2021 11:47:37 +0200 Message-Id: <20210412094738.944-10-johan@kernel.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210412094738.944-1-johan@kernel.org> References: <20210412094738.944-1-johan@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Replace the remaining uses of user-space __XX types. Signed-off-by: Johan Hovold --- drivers/usb/serial/ti_usb_3410_5052.c | 34 +++++++++++++-------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index f63ee11f41e8..aadcb00f1343 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c @@ -224,24 +224,24 @@ struct ti_write_data_bytes { } __packed; struct ti_read_data_request { - __u8 bAddrType; - __u8 bDataType; - __u8 bDataCounter; + u8 bAddrType; + u8 bDataType; + u8 bDataCounter; __be16 wBaseAddrHi; __be16 wBaseAddrLo; } __packed; struct ti_read_data_bytes { - __u8 bCmdCode; - __u8 bModuleId; - __u8 bErrorCode; - __u8 bData[]; + u8 bCmdCode; + u8 bModuleId; + u8 bErrorCode; + u8 bData[]; }; /* Interrupt struct */ struct ti_interrupt { - __u8 bICode; - __u8 bIInfo; + u8 bICode; + u8 bIInfo; }; /* Interrupt codes */ @@ -333,10 +333,10 @@ 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); -static int ti_command_out_sync(struct usb_device *udev, __u8 command, - __u16 moduleid, __u16 value, void *data, int size); -static int ti_command_in_sync(struct usb_device *udev, __u8 command, - __u16 moduleid, __u16 value, void *data, int size); +static int ti_command_out_sync(struct usb_device *udev, u8 command, + u16 moduleid, u16 value, void *data, int size); +static int ti_command_in_sync(struct usb_device *udev, u8 command, + u16 moduleid, u16 value, void *data, int size); static int ti_port_cmd_out(struct usb_serial_port *port, u8 command, u16 value, void *data, int size); static int ti_port_cmd_in(struct usb_serial_port *port, u8 command, @@ -1459,8 +1459,8 @@ static int ti_restart_read(struct ti_port *tport, struct tty_struct *tty) return status; } -static int ti_command_out_sync(struct usb_device *udev, __u8 command, - __u16 moduleid, __u16 value, void *data, int size) +static int ti_command_out_sync(struct usb_device *udev, u8 command, + u16 moduleid, u16 value, void *data, int size) { int status; @@ -1473,8 +1473,8 @@ static int ti_command_out_sync(struct usb_device *udev, __u8 command, return 0; } -static int ti_command_in_sync(struct usb_device *udev, __u8 command, - __u16 moduleid, __u16 value, void *data, int size) +static int ti_command_in_sync(struct usb_device *udev, u8 command, + u16 moduleid, u16 value, void *data, int size) { int status; From patchwork Mon Apr 12 09:47:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 12197499 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A953C43616 for ; Mon, 12 Apr 2021 09:56:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E4A3861263 for ; Mon, 12 Apr 2021 09:56:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242882AbhDLJyW (ORCPT ); Mon, 12 Apr 2021 05:54:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:35918 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242542AbhDLJu0 (ORCPT ); Mon, 12 Apr 2021 05:50:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 200E26128B; Mon, 12 Apr 2021 09:48:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618220889; bh=VANim6b6ABVVkb21MkrR38Z0jqTkgYPR57e7Q61KJAo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SI1mRyPknTnuxjPbW3axJl43dvOl7kl04HxmZkSNB1M66sVv9T4LQdRpXDkeo8HYS U2GgZwfKBWNHbuiC2nDtdVT9WH0luBvsQZo0ndfRkX0JmmS2M7gxqWG5i4Cf1qDrUV 5XP7GLW8zBljjgUr6/KhhjBBjTo+cgU3glj4JCvdAvS6l/Vn+FuhBFi2rU+Gfjb0JR xWPFhWYcOItHnYMqskXa1mhQvY0l7BO/H1ZvUSAvfuMjKHKGImDMq/3ERGbwccxQ1R u/cykjjTHW0sRIToR/dHQ3NAidtdK7Cajht2w4j/B5Efkk/cLLIcIXwJY9KJXBdUqA hwiYC/fWrccxw== Received: from johan by xi with local (Exim 4.93.0.4) (envelope-from ) id 1lVtAp-0000Ge-NV; Mon, 12 Apr 2021 11:48:03 +0200 From: Johan Hovold To: Johan Hovold Cc: linux-usb@vger.kernel.org Subject: [PATCH 10/10] USB: serial: ti_usb_3410_5052: clean up termios CSIZE handling Date: Mon, 12 Apr 2021 11:47:38 +0200 Message-Id: <20210412094738.944-11-johan@kernel.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210412094738.944-1-johan@kernel.org> References: <20210412094738.944-1-johan@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Remove the random white space from the CSIZE switch. 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 aadcb00f1343..8598f5a47349 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c @@ -911,18 +911,18 @@ static void ti_set_termios(struct tty_struct *tty, switch (C_CSIZE(tty)) { case CS5: - config->bDataBits = TI_UART_5_DATA_BITS; - break; + config->bDataBits = TI_UART_5_DATA_BITS; + break; case CS6: - config->bDataBits = TI_UART_6_DATA_BITS; - break; + config->bDataBits = TI_UART_6_DATA_BITS; + break; case CS7: - config->bDataBits = TI_UART_7_DATA_BITS; - break; + config->bDataBits = TI_UART_7_DATA_BITS; + break; default: case CS8: - config->bDataBits = TI_UART_8_DATA_BITS; - break; + config->bDataBits = TI_UART_8_DATA_BITS; + break; } /* CMSPAR isn't supported by this driver */