From patchwork Mon Jul 31 08:02:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jiri Slaby \(SUSE\)" X-Patchwork-Id: 709532 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30B25C001DF for ; Mon, 31 Jul 2023 08:04:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231887AbjGaIEh (ORCPT ); Mon, 31 Jul 2023 04:04:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231783AbjGaIEL (ORCPT ); Mon, 31 Jul 2023 04:04:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E57A2133; Mon, 31 Jul 2023 01:02:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 51A0560F73; Mon, 31 Jul 2023 08:02:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8000C433CB; Mon, 31 Jul 2023 08:02:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690790568; bh=+zO7FyhxfQpim+6aXiX4wyEaVl0osOo9Jvm1XcJ4UJI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HWAi6/awhedagqhtUxkRfSFEcBp0m21vHP4yhbx1qdtbAYNtOaRV/42d3dD1ffs0J psw77i3kD1b6CspYgk+bxW6errj/WJ7o9HB7HHIx0uRUS+TXY4AShCup9tUxr1lXgq xQM172uelQ+mpcZU10nsf84+1nSg1miWa1fMygDxHWMAXFp1U4avA+b7WPd9NL/tUw XaCNHxvYHelZb7cnWSjY+4fJUynuU1/fgQu6+kcZc9FFWvvYycDmCeQVcFn/pMWSUZ /apXW0/CLyQ8MToM0R8AzCurEw5nH91+l0S+2YJXKuEsgQJro/XXKFwQoBqX4AGmC1 QV8leulMcBx3w== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" Subject: [PATCH 01/10] serial: move WARN_ON() in uart_write() to the condition Date: Mon, 31 Jul 2023 10:02:35 +0200 Message-ID: <20230731080244.2698-2-jirislaby@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230731080244.2698-1-jirislaby@kernel.org> References: <20230731080244.2698-1-jirislaby@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org uart code currently does the following in uart_write() and uart_flush_buffer(): if (cond) { WARN_ON(1); return; } It can be rewritten to more obvious and more readable: if (WARN_ON(cond)) return; Do so. Signed-off-by: Jiri Slaby (SUSE) --- drivers/tty/serial/serial_core.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 306ea1a560e6..e31c9b6bd8ab 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -593,10 +593,8 @@ static int uart_write(struct tty_struct *tty, * This means you called this function _after_ the port was * closed. No cookie for you. */ - if (!state) { - WARN_ON(1); + if (WARN_ON(!state)) return -EL3HLT; - } port = uart_port_lock(state, flags); circ = &state->xmit; @@ -659,10 +657,8 @@ static void uart_flush_buffer(struct tty_struct *tty) * This means you called this function _after_ the port was * closed. No cookie for you. */ - if (!state) { - WARN_ON(1); + if (WARN_ON(!state)) return; - } pr_debug("uart_flush_buffer(%d) called\n", tty->index); From patchwork Mon Jul 31 08:02:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jiri Slaby \(SUSE\)" X-Patchwork-Id: 709531 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F8E4C001DF for ; Mon, 31 Jul 2023 08:05:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231592AbjGaIFS (ORCPT ); Mon, 31 Jul 2023 04:05:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231768AbjGaIES (ORCPT ); Mon, 31 Jul 2023 04:04:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6234E1713; Mon, 31 Jul 2023 01:02:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7FC4E60E8B; Mon, 31 Jul 2023 08:02:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DE88C433C9; Mon, 31 Jul 2023 08:02:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690790570; bh=iL+/iMkVyPpitc+31cYvs+uU/ZxRswV5+Wl1H0RRVAc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kk8c18DLN8tYP5izkZrkGSFDhJrb7SeDZ2SJdORAd4uCe9aBlAuCYU4UpsXxCh1q7 nOQqzUT+G08qFcjMIIQ/pOIvdg2x0Z+65ju3cD8Z+9D7HHt45CFK7yUbIff/GI+JbK ijOILqb8o3+xF0Hiu5rwe3S86z9WyK1cqGTOMzVsiCFUu9Vm45Zg3OkfMjMOneoNtJ rZx01dTozdMNkVlKNj58/YqEESOGn3K9obS8F6L6epGPzJ9H5vi6fK1AOnbQ1PS/My AW78bF4WFORdBUyYEnCIV1MFh9lCHEl9Nif7xvBcpLJgjF4IG8zEiSJU8vAtd/YTMf 7eGVYk0787PsA== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , linux-bluetooth@vger.kernel.org Subject: [PATCH 02/10] Bluetooth: rfcomm: remove casts from tty->driver_data Date: Mon, 31 Jul 2023 10:02:36 +0200 Message-ID: <20230731080244.2698-3-jirislaby@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230731080244.2698-1-jirislaby@kernel.org> References: <20230731080244.2698-1-jirislaby@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org tty->driver_data is 'void *', so there is no need to cast from that. Therefore remove the casts and assign the pointer directly. Signed-off-by: Jiri Slaby (SUSE) Cc: Marcel Holtmann Cc: Johan Hedberg Cc: Luiz Augusto von Dentz Cc: linux-bluetooth@vger.kernel.org --- net/bluetooth/rfcomm/tty.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index 5697df9d4394..d73eec146529 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c @@ -771,7 +771,7 @@ static int rfcomm_tty_open(struct tty_struct *tty, struct file *filp) static void rfcomm_tty_close(struct tty_struct *tty, struct file *filp) { - struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data; + struct rfcomm_dev *dev = tty->driver_data; BT_DBG("tty %p dev %p dlc %p opened %d", tty, dev, dev->dlc, dev->port.count); @@ -781,7 +781,7 @@ static void rfcomm_tty_close(struct tty_struct *tty, struct file *filp) static int rfcomm_tty_write(struct tty_struct *tty, const unsigned char *buf, int count) { - struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data; + struct rfcomm_dev *dev = tty->driver_data; struct rfcomm_dlc *dlc = dev->dlc; struct sk_buff *skb; int sent = 0, size; @@ -810,7 +810,7 @@ static int rfcomm_tty_write(struct tty_struct *tty, const unsigned char *buf, in static unsigned int rfcomm_tty_write_room(struct tty_struct *tty) { - struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data; + struct rfcomm_dev *dev = tty->driver_data; int room = 0; if (dev && dev->dlc) @@ -864,7 +864,7 @@ static void rfcomm_tty_set_termios(struct tty_struct *tty, u8 baud, data_bits, stop_bits, parity, x_on, x_off; u16 changes = 0; - struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data; + struct rfcomm_dev *dev = tty->driver_data; BT_DBG("tty %p termios %p", tty, old); @@ -996,7 +996,7 @@ static void rfcomm_tty_set_termios(struct tty_struct *tty, static void rfcomm_tty_throttle(struct tty_struct *tty) { - struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data; + struct rfcomm_dev *dev = tty->driver_data; BT_DBG("tty %p dev %p", tty, dev); @@ -1005,7 +1005,7 @@ static void rfcomm_tty_throttle(struct tty_struct *tty) static void rfcomm_tty_unthrottle(struct tty_struct *tty) { - struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data; + struct rfcomm_dev *dev = tty->driver_data; BT_DBG("tty %p dev %p", tty, dev); @@ -1014,7 +1014,7 @@ static void rfcomm_tty_unthrottle(struct tty_struct *tty) static unsigned int rfcomm_tty_chars_in_buffer(struct tty_struct *tty) { - struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data; + struct rfcomm_dev *dev = tty->driver_data; BT_DBG("tty %p dev %p", tty, dev); @@ -1029,7 +1029,7 @@ static unsigned int rfcomm_tty_chars_in_buffer(struct tty_struct *tty) static void rfcomm_tty_flush_buffer(struct tty_struct *tty) { - struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data; + struct rfcomm_dev *dev = tty->driver_data; BT_DBG("tty %p dev %p", tty, dev); @@ -1052,7 +1052,7 @@ static void rfcomm_tty_wait_until_sent(struct tty_struct *tty, int timeout) static void rfcomm_tty_hangup(struct tty_struct *tty) { - struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data; + struct rfcomm_dev *dev = tty->driver_data; BT_DBG("tty %p dev %p", tty, dev); @@ -1061,7 +1061,7 @@ static void rfcomm_tty_hangup(struct tty_struct *tty) static int rfcomm_tty_tiocmget(struct tty_struct *tty) { - struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data; + struct rfcomm_dev *dev = tty->driver_data; BT_DBG("tty %p dev %p", tty, dev); @@ -1070,7 +1070,7 @@ static int rfcomm_tty_tiocmget(struct tty_struct *tty) static int rfcomm_tty_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { - struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data; + struct rfcomm_dev *dev = tty->driver_data; struct rfcomm_dlc *dlc = dev->dlc; u8 v24_sig; From patchwork Mon Jul 31 08:02:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jiri Slaby \(SUSE\)" X-Patchwork-Id: 709530 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD0F7C001DC for ; Mon, 31 Jul 2023 08:05:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231831AbjGaIFU (ORCPT ); Mon, 31 Jul 2023 04:05:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231794AbjGaIEU (ORCPT ); Mon, 31 Jul 2023 04:04:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2ABD2696; Mon, 31 Jul 2023 01:02:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 312DC60F70; Mon, 31 Jul 2023 08:02:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63489C433C7; Mon, 31 Jul 2023 08:02:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690790572; bh=CFCUO1q2jsK74UC2bwVz7miuEtn6Vz1wrsnbjpoYBoE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zxkxs5HlsQ22+uk6HxRfSnXVnkXQrgnRL0xYAU9zOhLxxVwnTltHXn3xkW5TIMaVA s2/ZkpjZZrsy8Yg47g2Yf6J1CiFdQWjIc8LClZCxbWSWsIx4BJBwYCTFv++rMjad0T bHa+WlPcEaoyuTPupPQn+KQzuiUUJlUe85LatZEg8/M7dVgtlx5YSXL2fBjUXkCtGR EeZxkxnt3IiL1s2w3nP4JNwjGIP/y34/uWg1PvxyRzGHy6wyoIRPcvYu2IFVYnJvdK Mm7KNXDq6EX4oP1juDpt5FVQYe8qiOOzMV4TeS1zxXzR4gLmFiHzfb0/A9xEBtChFX qmetPBluQldWA== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , linuxppc-dev@lists.ozlabs.org Subject: [PATCH 03/10] tty: hvsi: remove an extra variable from hvsi_write() Date: Mon, 31 Jul 2023 10:02:37 +0200 Message-ID: <20230731080244.2698-4-jirislaby@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230731080244.2698-1-jirislaby@kernel.org> References: <20230731080244.2698-1-jirislaby@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org 'source' is the same as 'buf'. Rename the parameter ('buf') to 'source' and drop the local variable. Likely, the two were introduced to have a different type. But 'char' and 'unsigned char' are the same in the kernel for a long time. Signed-off-by: Jiri Slaby (SUSE) Cc: linuxppc-dev@lists.ozlabs.org --- drivers/tty/hvc/hvsi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/tty/hvc/hvsi.c b/drivers/tty/hvc/hvsi.c index a200d01eceed..c1b8a4fd8b1e 100644 --- a/drivers/tty/hvc/hvsi.c +++ b/drivers/tty/hvc/hvsi.c @@ -905,10 +905,9 @@ static unsigned int hvsi_chars_in_buffer(struct tty_struct *tty) } static int hvsi_write(struct tty_struct *tty, - const unsigned char *buf, int count) + const unsigned char *source, int count) { struct hvsi_struct *hp = tty->driver_data; - const char *source = buf; unsigned long flags; int total = 0; int origcount = count; From patchwork Mon Jul 31 08:02:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jiri Slaby \(SUSE\)" X-Patchwork-Id: 709529 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26436C04A94 for ; Mon, 31 Jul 2023 08:05:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231565AbjGaIFm (ORCPT ); Mon, 31 Jul 2023 04:05:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231752AbjGaIE2 (ORCPT ); Mon, 31 Jul 2023 04:04:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07AE51716; Mon, 31 Jul 2023 01:03:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DBC4860F7C; Mon, 31 Jul 2023 08:02:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 174A0C433C7; Mon, 31 Jul 2023 08:02:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690790579; bh=K+H/hoatehbQhPWW2mUSJBRDUhbE9sguuS2KLp9LDIM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uDrqDxWrJYHNWB0bT+ULXoW5jX5anh43k3Ky2ZjVFk8aL7n0JQTodkmshwOD33EX3 1XvYrwsVcv6rbxAF8rXRlELFtptPGLzxZtI3WwLMPZ4WJqXdhEFn6r+0EPmYSLcEkB VpuWbddDgNdjodeainAp8fEDjRmMiZJpBpOnH0DYj1HukED29A+zm1Q30P5DOnz6f3 kp9cz/vixcsJzAN5yRIHaJ5Jcr4Vac049lFnk+YeNUFax9Wds8I0gNeopvwq0Zup6/ n+FkpwWDvnPhmm0sdOlYJNIKK0kgNcGEQPq5VyWVUS+v7p1Qrhbp0jwn0Zw+1gwBJc BjHqrS1+vl3EQ== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Tobias Klauser Subject: [PATCH 06/10] serial: altera_jtaguart: switch status to u32 Date: Mon, 31 Jul 2023 10:02:40 +0200 Message-ID: <20230731080244.2698-7-jirislaby@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230731080244.2698-1-jirislaby@kernel.org> References: <20230731080244.2698-1-jirislaby@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org 'status' is assigned a result from readl(). There is no need for the variable to be 'unsigned long'. readl() returns 32bit values. Provided, this is a Nios II driver (32-bit), there is no change in semantics. This only makes the type explicit. Signed-off-by: Jiri Slaby (SUSE) Cc: Tobias Klauser Acked-by: Tobias Klauser --- drivers/tty/serial/altera_jtaguart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/altera_jtaguart.c b/drivers/tty/serial/altera_jtaguart.c index 6203ca1de769..5fab4c978891 100644 --- a/drivers/tty/serial/altera_jtaguart.c +++ b/drivers/tty/serial/altera_jtaguart.c @@ -110,7 +110,7 @@ static void altera_jtaguart_set_termios(struct uart_port *port, static void altera_jtaguart_rx_chars(struct uart_port *port) { - unsigned long status; + u32 status; u8 ch; while ((status = readl(port->membase + ALTERA_JTAGUART_DATA_REG)) & From patchwork Mon Jul 31 08:02:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jiri Slaby \(SUSE\)" X-Patchwork-Id: 709528 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72775C001DC for ; Mon, 31 Jul 2023 08:06:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231311AbjGaIGL (ORCPT ); Mon, 31 Jul 2023 04:06:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230357AbjGaIEd (ORCPT ); Mon, 31 Jul 2023 04:04:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BEB61724; Mon, 31 Jul 2023 01:03:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 02E4160F77; Mon, 31 Jul 2023 08:03:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3261DC433C9; Mon, 31 Jul 2023 08:03:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690790583; bh=6sCzu84ZbNFeuecmBcFu3cCZGqCgnMZYTlY4wKquDdg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sqIK16KsZ0ZT6eMsToQp0hx9VJoCyerLkUrrq/zljD3OZLcpyVXHWxxKBfkVHHuz1 gv/u+bm+Krjnb+eCyXAHaTpu0ukPWjDM+jissvtq3y4bgIzRbcLBadshpgfNaZDCxc UB3CLZVCMeQ4A/cxnkgxaEgOizu/uyUGwN5pCtcwxczcyYbwhrl3UsAr3tEsMI0Kyf 3aGdzyLzyPbMy3eJpW3F7vsJjMefg62ukSiF2I5/a2/zCxV1Vy4vLqCw1EwogcO2Rc GgyZtf0ZCutLbe4Lhnh669GJ54MOasDH2gpdyDNXeztYxOQq5ejehL5CRmUz68WNsV CrvDFIDjW+Hxg== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Arnd Bergmann Subject: [PATCH 08/10] misc: ti-st: remove forward declarations and make st_int_recv() static Date: Mon, 31 Jul 2023 10:02:42 +0200 Message-ID: <20230731080244.2698-9-jirislaby@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230731080244.2698-1-jirislaby@kernel.org> References: <20230731080244.2698-1-jirislaby@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org st_kim_recv() is already declared in linux/ti_wilink_st.h. Given that is already included in st_core.c, drop the re-declaration from there. st_int_recv() is used only in st_core.c and the forward declaration is not needed. So drop the declaration and make the function static. Signed-off-by: Jiri Slaby (SUSE) Cc: Arnd Bergmann --- drivers/misc/ti-st/st_core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c index 01d2257deea4..389901276ce3 100644 --- a/drivers/misc/ti-st/st_core.c +++ b/drivers/misc/ti-st/st_core.c @@ -16,8 +16,6 @@ #include -extern void st_kim_recv(void *, const unsigned char *, long); -void st_int_recv(void *, const unsigned char *, long); /* * function pointer pointing to either, * st_kim_recv during registration to receive fw download responses @@ -225,7 +223,7 @@ static inline void st_wakeup_ack(struct st_data_s *st_gdata, * HCI-Events, ACL, SCO, 4 types of HCI-LL PM packets * CH-8 packets from FM, CH-9 packets from GPS cores. */ -void st_int_recv(void *disc_data, +static void st_int_recv(void *disc_data, const unsigned char *data, long count) { char *ptr; From patchwork Mon Jul 31 08:02:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jiri Slaby \(SUSE\)" X-Patchwork-Id: 709527 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F2C1C04A94 for ; Mon, 31 Jul 2023 08:06:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230399AbjGaIGY (ORCPT ); Mon, 31 Jul 2023 04:06:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231869AbjGaIEe (ORCPT ); Mon, 31 Jul 2023 04:04:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C409E1A6; Mon, 31 Jul 2023 01:03:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6170B60F33; Mon, 31 Jul 2023 08:03:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 882C2C433C9; Mon, 31 Jul 2023 08:03:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690790586; bh=+2+5Tnk3+q3dIP9/bYUXB3vDyW94Doym0JZK1jfkQpQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fkoKyimKveikThTww6CG4ac9bXEwuyUSo1neOBMVcQrK84SM2A80Qhb7TEr9ptBhX CWHxlZWvIp7ntSAIW1ifiJBHuY94tsuBJ/erROBMHJd1f8le+MAAh/raO9wBH1zmai RM2BDg0tDqzaFQtKpW4YrlCBtgCH3cmtygr8nb0uuISuKevTLvGELTzZSKh+VHXGJb cNHnXHIKHwJock1jDKepc5AbC+TIqW6gACjRUBwyTWs7IZMZdzkUN9wQee0a9dIdzs gHZVixrhMnnt3YoJX8wXFrMYG/cEAillAeHkFMjbIibhOTNJbrx9BIYGWJTmMO9qfP nEAYEA8ZmalTg== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Arnd Bergmann Subject: [PATCH 10/10] misc: ti-st: don't check for tty data == NULL Date: Mon, 31 Jul 2023 10:02:44 +0200 Message-ID: <20230731080244.2698-11-jirislaby@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230731080244.2698-1-jirislaby@kernel.org> References: <20230731080244.2698-1-jirislaby@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org tty data passed to tty_ldisc_ops::receive_buf() are never NULL. Remove this check. Signed-off-by: Jiri Slaby (SUSE) Cc: Arnd Bergmann --- drivers/misc/ti-st/st_core.c | 3 +-- drivers/misc/ti-st/st_kim.c | 5 ----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c index e2add50b191c..3b2145722bd7 100644 --- a/drivers/misc/ti-st/st_core.c +++ b/drivers/misc/ti-st/st_core.c @@ -234,8 +234,7 @@ static void st_int_recv(void *disc_data, struct st_data_s *st_gdata = (struct st_data_s *)disc_data; unsigned long flags; - /* tty_receive sent null ? */ - if (unlikely(ptr == NULL) || (st_gdata == NULL)) { + if (st_gdata == NULL) { pr_err(" received null from TTY "); return; } diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c index 8c801897ffa2..5431a89924aa 100644 --- a/drivers/misc/ti-st/st_kim.c +++ b/drivers/misc/ti-st/st_kim.c @@ -135,11 +135,6 @@ static void kim_int_recv(struct kim_data_s *kim_gdata, pr_debug("%s", __func__); /* Decode received bytes here */ - if (unlikely(ptr == NULL)) { - pr_err(" received null from TTY "); - return; - } - while (count) { if (kim_gdata->rx_count) { len = min_t(unsigned int, kim_gdata->rx_count, count);