From nobody Sun May 10 14:15:40 2026 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 56EACC433EF for ; Tue, 3 May 2022 06:31:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229991AbiECGfJ (ORCPT ); Tue, 3 May 2022 02:35:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229877AbiECGe7 (ORCPT ); Tue, 3 May 2022 02:34:59 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0449381A9; Mon, 2 May 2022 23:31:27 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 6BA8C1F749; Tue, 3 May 2022 06:31:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1651559486; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=K6zhqS+OE857bgyVkpTOjrIk8kxIdlUspbbn6zOUB9c=; b=lBt7Xr8O5pCsy0iSq/ngYd38mYHr7xe3NgenR6O7d1kg/tWQ2/hinAlqusRsXz9kSAsEEF RTljGQCe38po09Rx4mCcEjS0rQDfqXmu+Ls/V446ekYLbpuHole9vkemRto917JZ9XeT8n c3QoJh7Q9MCi+DATLOHW/EzqWz6RaLU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1651559486; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=K6zhqS+OE857bgyVkpTOjrIk8kxIdlUspbbn6zOUB9c=; b=DQM1/RFOlE35XhjiIcZihVfiL7BopipiN0lcD1fKGgZf93xpPcgKubyueeVLy5+NgBKY4w Zj1hdQbBWnA2bjBA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 3621B2C143; Tue, 3 May 2022 06:31:26 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 01/11] serial: pic32: remove unused items from the header Date: Tue, 3 May 2022 08:31:12 +0200 Message-Id: <20220503063122.20957-2-jslaby@suse.cz> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220503063122.20957-1-jslaby@suse.cz> References: <20220503063122.20957-1-jslaby@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" struct pic32_console_opt and its support are unused in pic32. So remove all that. Signed-off-by: Jiri Slaby --- drivers/tty/serial/pic32_uart.h | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/tty/serial/pic32_uart.h b/drivers/tty/serial/pic32_uar= t.h index b15639cc336b..a7dba1d57236 100644 --- a/drivers/tty/serial/pic32_uart.h +++ b/drivers/tty/serial/pic32_uart.h @@ -20,13 +20,6 @@ #define PIC32_UART_RX 0x30 #define PIC32_UART_BRG 0x40 =20 -struct pic32_console_opt { - int baud; - int parity; - int bits; - int flow; -}; - /* struct pic32_sport - pic32 serial port descriptor * @port: uart port descriptor * @idx: port index @@ -44,7 +37,6 @@ struct pic32_console_opt { **/ struct pic32_sport { struct uart_port port; - struct pic32_console_opt opt; int idx; =20 int irq_fault; @@ -68,7 +60,6 @@ struct pic32_sport { }; #define to_pic32_sport(c) container_of(c, struct pic32_sport, port) #define pic32_get_port(sport) (&sport->port) -#define pic32_get_opt(sport) (&sport->opt) #define tx_irq_enabled(sport) (sport->enable_tx_irq) =20 static inline void pic32_uart_writel(struct pic32_sport *sport, --=20 2.36.0 From nobody Sun May 10 14:15:40 2026 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 F21BCC433EF for ; Tue, 3 May 2022 06:32:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230202AbiECGgM (ORCPT ); Tue, 3 May 2022 02:36:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229902AbiECGfA (ORCPT ); Tue, 3 May 2022 02:35:00 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56C82381AE; Mon, 2 May 2022 23:31:28 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id B99B6210ED; Tue, 3 May 2022 06:31:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1651559486; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UKMK+E1QOVMkS/+uRvdxjLGkgBWRpnWs4hXt5Uwgx3c=; b=Z2fTcPW4dTYMvC1fzMXVCph/bxUKQU+bHPtiMlrUyCvsn3znUe/1yWkhV9TeQJxs746FP6 SX1F1PyahdGc1J6sLz4QMvaOki9WFjkveBICRZhesvngWyLgv1JcNe88H7yvDKvTdwN3rG szvJQpDRgfk+noeF2h3CNVmfFxoaa0w= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1651559486; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UKMK+E1QOVMkS/+uRvdxjLGkgBWRpnWs4hXt5Uwgx3c=; b=BV7G0c5/c6RE5e7w1NTcDWdG8/B9vRfEd1ILebOMr/8omMIjAArVfJmQOJ70qkoln/azf4 kGtHo5a2ApJ/WDCg== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 7EA2F2C141; Tue, 3 May 2022 06:31:26 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 02/11] serial: pic32: move header content to .c Date: Tue, 3 May 2022 08:31:13 +0200 Message-Id: <20220503063122.20957-3-jslaby@suse.cz> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220503063122.20957-1-jslaby@suse.cz> References: <20220503063122.20957-1-jslaby@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" There is no point keeping the header content separated. So move the content to the appropriate source file. Signed-off-by: Jiri Slaby --- drivers/tty/serial/pic32_uart.c | 104 +++++++++++++++++++++++++++- drivers/tty/serial/pic32_uart.h | 116 -------------------------------- 2 files changed, 103 insertions(+), 117 deletions(-) delete mode 100644 drivers/tty/serial/pic32_uart.h diff --git a/drivers/tty/serial/pic32_uart.c b/drivers/tty/serial/pic32_uar= t.c index b7a3a1b959b1..a1b8c05f3d46 100644 --- a/drivers/tty/serial/pic32_uart.c +++ b/drivers/tty/serial/pic32_uart.c @@ -25,13 +25,115 @@ #include =20 #include -#include "pic32_uart.h" =20 /* UART name and device definitions */ #define PIC32_DEV_NAME "pic32-uart" #define PIC32_MAX_UARTS 6 #define PIC32_SDEV_NAME "ttyPIC" =20 +#define PIC32_UART_DFLT_BRATE 9600 +#define PIC32_UART_TX_FIFO_DEPTH 8 +#define PIC32_UART_RX_FIFO_DEPTH 8 + +#define PIC32_UART_MODE 0x00 +#define PIC32_UART_STA 0x10 +#define PIC32_UART_TX 0x20 +#define PIC32_UART_RX 0x30 +#define PIC32_UART_BRG 0x40 + +/* struct pic32_sport - pic32 serial port descriptor + * @port: uart port descriptor + * @idx: port index + * @irq_fault: virtual fault interrupt number + * @irqflags_fault: flags related to fault irq + * @irq_fault_name: irq fault name + * @irq_rx: virtual rx interrupt number + * @irqflags_rx: flags related to rx irq + * @irq_rx_name: irq rx name + * @irq_tx: virtual tx interrupt number + * @irqflags_tx: : flags related to tx irq + * @irq_tx_name: irq tx name + * @cts_gpio: clear to send gpio + * @dev: device descriptor + **/ +struct pic32_sport { + struct uart_port port; + int idx; + + int irq_fault; + int irqflags_fault; + const char *irq_fault_name; + int irq_rx; + int irqflags_rx; + const char *irq_rx_name; + int irq_tx; + int irqflags_tx; + const char *irq_tx_name; + u8 enable_tx_irq; + + bool hw_flow_ctrl; + int cts_gpio; + + int ref_clk; + struct clk *clk; + + struct device *dev; +}; +#define to_pic32_sport(c) container_of(c, struct pic32_sport, port) +#define pic32_get_port(sport) (&sport->port) +#define tx_irq_enabled(sport) (sport->enable_tx_irq) + +static inline void pic32_uart_writel(struct pic32_sport *sport, + u32 reg, u32 val) +{ + struct uart_port *port =3D pic32_get_port(sport); + + __raw_writel(val, port->membase + reg); +} + +static inline u32 pic32_uart_readl(struct pic32_sport *sport, u32 reg) +{ + struct uart_port *port =3D pic32_get_port(sport); + + return __raw_readl(port->membase + reg); +} + +/* pic32 uart mode register bits */ +#define PIC32_UART_MODE_ON BIT(15) +#define PIC32_UART_MODE_FRZ BIT(14) +#define PIC32_UART_MODE_SIDL BIT(13) +#define PIC32_UART_MODE_IREN BIT(12) +#define PIC32_UART_MODE_RTSMD BIT(11) +#define PIC32_UART_MODE_RESV1 BIT(10) +#define PIC32_UART_MODE_UEN1 BIT(9) +#define PIC32_UART_MODE_UEN0 BIT(8) +#define PIC32_UART_MODE_WAKE BIT(7) +#define PIC32_UART_MODE_LPBK BIT(6) +#define PIC32_UART_MODE_ABAUD BIT(5) +#define PIC32_UART_MODE_RXINV BIT(4) +#define PIC32_UART_MODE_BRGH BIT(3) +#define PIC32_UART_MODE_PDSEL1 BIT(2) +#define PIC32_UART_MODE_PDSEL0 BIT(1) +#define PIC32_UART_MODE_STSEL BIT(0) + +/* pic32 uart status register bits */ +#define PIC32_UART_STA_UTXISEL1 BIT(15) +#define PIC32_UART_STA_UTXISEL0 BIT(14) +#define PIC32_UART_STA_UTXINV BIT(13) +#define PIC32_UART_STA_URXEN BIT(12) +#define PIC32_UART_STA_UTXBRK BIT(11) +#define PIC32_UART_STA_UTXEN BIT(10) +#define PIC32_UART_STA_UTXBF BIT(9) +#define PIC32_UART_STA_TRMT BIT(8) +#define PIC32_UART_STA_URXISEL1 BIT(7) +#define PIC32_UART_STA_URXISEL0 BIT(6) +#define PIC32_UART_STA_ADDEN BIT(5) +#define PIC32_UART_STA_RIDLE BIT(4) +#define PIC32_UART_STA_PERR BIT(3) +#define PIC32_UART_STA_FERR BIT(2) +#define PIC32_UART_STA_OERR BIT(1) +#define PIC32_UART_STA_URXDA BIT(0) + /* pic32_sport pointer for console use */ static struct pic32_sport *pic32_sports[PIC32_MAX_UARTS]; =20 diff --git a/drivers/tty/serial/pic32_uart.h b/drivers/tty/serial/pic32_uar= t.h deleted file mode 100644 index a7dba1d57236..000000000000 --- a/drivers/tty/serial/pic32_uart.h +++ /dev/null @@ -1,116 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * PIC32 Integrated Serial Driver. - * - * Copyright (C) 2015 Microchip Technology, Inc. - * - * Authors: - * Sorin-Andrei Pistirica - */ -#ifndef __DT_PIC32_UART_H__ -#define __DT_PIC32_UART_H__ - -#define PIC32_UART_DFLT_BRATE (9600) -#define PIC32_UART_TX_FIFO_DEPTH (8) -#define PIC32_UART_RX_FIFO_DEPTH (8) - -#define PIC32_UART_MODE 0x00 -#define PIC32_UART_STA 0x10 -#define PIC32_UART_TX 0x20 -#define PIC32_UART_RX 0x30 -#define PIC32_UART_BRG 0x40 - -/* struct pic32_sport - pic32 serial port descriptor - * @port: uart port descriptor - * @idx: port index - * @irq_fault: virtual fault interrupt number - * @irqflags_fault: flags related to fault irq - * @irq_fault_name: irq fault name - * @irq_rx: virtual rx interrupt number - * @irqflags_rx: flags related to rx irq - * @irq_rx_name: irq rx name - * @irq_tx: virtual tx interrupt number - * @irqflags_tx: : flags related to tx irq - * @irq_tx_name: irq tx name - * @cts_gpio: clear to send gpio - * @dev: device descriptor - **/ -struct pic32_sport { - struct uart_port port; - int idx; - - int irq_fault; - int irqflags_fault; - const char *irq_fault_name; - int irq_rx; - int irqflags_rx; - const char *irq_rx_name; - int irq_tx; - int irqflags_tx; - const char *irq_tx_name; - u8 enable_tx_irq; - - bool hw_flow_ctrl; - int cts_gpio; - - int ref_clk; - struct clk *clk; - - struct device *dev; -}; -#define to_pic32_sport(c) container_of(c, struct pic32_sport, port) -#define pic32_get_port(sport) (&sport->port) -#define tx_irq_enabled(sport) (sport->enable_tx_irq) - -static inline void pic32_uart_writel(struct pic32_sport *sport, - u32 reg, u32 val) -{ - struct uart_port *port =3D pic32_get_port(sport); - - __raw_writel(val, port->membase + reg); -} - -static inline u32 pic32_uart_readl(struct pic32_sport *sport, u32 reg) -{ - struct uart_port *port =3D pic32_get_port(sport); - - return __raw_readl(port->membase + reg); -} - -/* pic32 uart mode register bits */ -#define PIC32_UART_MODE_ON BIT(15) -#define PIC32_UART_MODE_FRZ BIT(14) -#define PIC32_UART_MODE_SIDL BIT(13) -#define PIC32_UART_MODE_IREN BIT(12) -#define PIC32_UART_MODE_RTSMD BIT(11) -#define PIC32_UART_MODE_RESV1 BIT(10) -#define PIC32_UART_MODE_UEN1 BIT(9) -#define PIC32_UART_MODE_UEN0 BIT(8) -#define PIC32_UART_MODE_WAKE BIT(7) -#define PIC32_UART_MODE_LPBK BIT(6) -#define PIC32_UART_MODE_ABAUD BIT(5) -#define PIC32_UART_MODE_RXINV BIT(4) -#define PIC32_UART_MODE_BRGH BIT(3) -#define PIC32_UART_MODE_PDSEL1 BIT(2) -#define PIC32_UART_MODE_PDSEL0 BIT(1) -#define PIC32_UART_MODE_STSEL BIT(0) - -/* pic32 uart status register bits */ -#define PIC32_UART_STA_UTXISEL1 BIT(15) -#define PIC32_UART_STA_UTXISEL0 BIT(14) -#define PIC32_UART_STA_UTXINV BIT(13) -#define PIC32_UART_STA_URXEN BIT(12) -#define PIC32_UART_STA_UTXBRK BIT(11) -#define PIC32_UART_STA_UTXEN BIT(10) -#define PIC32_UART_STA_UTXBF BIT(9) -#define PIC32_UART_STA_TRMT BIT(8) -#define PIC32_UART_STA_URXISEL1 BIT(7) -#define PIC32_UART_STA_URXISEL0 BIT(6) -#define PIC32_UART_STA_ADDEN BIT(5) -#define PIC32_UART_STA_RIDLE BIT(4) -#define PIC32_UART_STA_PERR BIT(3) -#define PIC32_UART_STA_FERR BIT(2) -#define PIC32_UART_STA_OERR BIT(1) -#define PIC32_UART_STA_URXDA BIT(0) - -#endif /* __DT_PIC32_UART_H__ */ --=20 2.36.0 From nobody Sun May 10 14:15:40 2026 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 57999C433F5 for ; Tue, 3 May 2022 06:31:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230026AbiECGfM (ORCPT ); Tue, 3 May 2022 02:35:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229884AbiECGe7 (ORCPT ); Tue, 3 May 2022 02:34:59 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57159381AF; Mon, 2 May 2022 23:31:28 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id EFB92210EE; Tue, 3 May 2022 06:31:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1651559486; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7ytM5kTlhfOQM6IG3OcCbjJmaCYay4pn3Lo26jfdHWE=; b=nRidPY8mC0MDHLS4HCFIYDsJYXv8fCSaTj0BWC5AVOU43vPcu6L2R1xy1aOuyPfKaVT/fA rXZcS4v0pm4pM5VADGVQmPigdpdvVQHqHpbcMKPxmN7SJGAQmVyGpjl5xVZacJQOEWR+ZM olCykiczgjscDYXB4AgaYxwRIS2r7gM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1651559486; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7ytM5kTlhfOQM6IG3OcCbjJmaCYay4pn3Lo26jfdHWE=; b=3cA9kMxo9F4eQVSxgHQm3qqmzr5En3M/kY/cxRfcDNfBJQgsT68W879fHDDtYUrSvFFrK3 c68PZlbS/JS+ynCw== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id C56172C143; Tue, 3 May 2022 06:31:26 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 03/11] serial: pic32: remove constants from struct pic32_sport Date: Tue, 3 May 2022 08:31:14 +0200 Message-Id: <20220503063122.20957-4-jslaby@suse.cz> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220503063122.20957-1-jslaby@suse.cz> References: <20220503063122.20957-1-jslaby@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" All the irqflags_* in struct pic32_sport are set to IRQF_NO_THREAD and never updated. So remove pic32_sport::irqflags_* and use the flag directly. Signed-off-by: Jiri Slaby --- drivers/tty/serial/pic32_uart.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/tty/serial/pic32_uart.c b/drivers/tty/serial/pic32_uar= t.c index a1b8c05f3d46..1e8ff6004e8e 100644 --- a/drivers/tty/serial/pic32_uart.c +++ b/drivers/tty/serial/pic32_uart.c @@ -45,13 +45,10 @@ * @port: uart port descriptor * @idx: port index * @irq_fault: virtual fault interrupt number - * @irqflags_fault: flags related to fault irq * @irq_fault_name: irq fault name * @irq_rx: virtual rx interrupt number - * @irqflags_rx: flags related to rx irq * @irq_rx_name: irq rx name * @irq_tx: virtual tx interrupt number - * @irqflags_tx: : flags related to tx irq * @irq_tx_name: irq tx name * @cts_gpio: clear to send gpio * @dev: device descriptor @@ -61,13 +58,10 @@ struct pic32_sport { int idx; =20 int irq_fault; - int irqflags_fault; const char *irq_fault_name; int irq_rx; - int irqflags_rx; const char *irq_rx_name; int irq_tx; - int irqflags_tx; const char *irq_tx_name; u8 enable_tx_irq; =20 @@ -533,7 +527,7 @@ static int pic32_uart_startup(struct uart_port *port) } irq_set_status_flags(sport->irq_fault, IRQ_NOAUTOEN); ret =3D request_irq(sport->irq_fault, pic32_uart_fault_interrupt, - sport->irqflags_fault, sport->irq_fault_name, port); + IRQF_NO_THREAD, sport->irq_fault_name, port); if (ret) { dev_err(port->dev, "%s: request irq(%d) err! ret:%d name:%s\n", __func__, sport->irq_fault, ret, @@ -551,7 +545,7 @@ static int pic32_uart_startup(struct uart_port *port) } irq_set_status_flags(sport->irq_rx, IRQ_NOAUTOEN); ret =3D request_irq(sport->irq_rx, pic32_uart_rx_interrupt, - sport->irqflags_rx, sport->irq_rx_name, port); + IRQF_NO_THREAD, sport->irq_rx_name, port); if (ret) { dev_err(port->dev, "%s: request irq(%d) err! ret:%d name:%s\n", __func__, sport->irq_rx, ret, @@ -569,7 +563,7 @@ static int pic32_uart_startup(struct uart_port *port) } irq_set_status_flags(sport->irq_tx, IRQ_NOAUTOEN); ret =3D request_irq(sport->irq_tx, pic32_uart_tx_interrupt, - sport->irqflags_tx, sport->irq_tx_name, port); + IRQF_NO_THREAD, sport->irq_tx_name, port); if (ret) { dev_err(port->dev, "%s: request irq(%d) err! ret:%d name:%s\n", __func__, sport->irq_tx, ret, @@ -918,11 +912,8 @@ static int pic32_uart_probe(struct platform_device *pd= ev) =20 sport->idx =3D uart_idx; sport->irq_fault =3D irq_of_parse_and_map(np, 0); - sport->irqflags_fault =3D IRQF_NO_THREAD; sport->irq_rx =3D irq_of_parse_and_map(np, 1); - sport->irqflags_rx =3D IRQF_NO_THREAD; sport->irq_tx =3D irq_of_parse_and_map(np, 2); - sport->irqflags_tx =3D IRQF_NO_THREAD; sport->clk =3D devm_clk_get(&pdev->dev, NULL); sport->cts_gpio =3D -EINVAL; sport->dev =3D &pdev->dev; --=20 2.36.0 From nobody Sun May 10 14:15:40 2026 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 49233C433F5 for ; Tue, 3 May 2022 06:31:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230019AbiECGf0 (ORCPT ); Tue, 3 May 2022 02:35:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229895AbiECGfA (ORCPT ); Tue, 3 May 2022 02:35:00 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 960AF381B1; Mon, 2 May 2022 23:31:28 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 3B8CB1F74A; Tue, 3 May 2022 06:31:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1651559487; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mDGq2MehCOuWbouH8qY7t2f0w7/Wwz3YBeWZPEhcmus=; b=FKJ8qSQJInvQR3s5rJMHC9K+NJk9VbJ7/e4VvVXMP3P28/siEuTnY4Fy45CwsFsELW8RVJ wr1w5R7pF6/NLCYrtyRrdn7X5pW3I1iD1EYqMSun1NlWlVrgXW4g5P1KueJ0SyXCSrRPeI o7MctBUPzKFET8c1l/429EAQ+1XLyPY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1651559487; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mDGq2MehCOuWbouH8qY7t2f0w7/Wwz3YBeWZPEhcmus=; b=KDD3IkJ2LZ6OIyANkpCZUBsxLCPHiMTRkCgmpmhMnZP85FChGfQ/cBqTttbyvr6V2jaFPB d7Yl1bkS+hiOyUAg== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 0DD9A2C141; Tue, 3 May 2022 06:31:27 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 04/11] serial: pic32: simplify clk handling Date: Tue, 3 May 2022 08:31:15 +0200 Message-Id: <20220503063122.20957-5-jslaby@suse.cz> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220503063122.20957-1-jslaby@suse.cz> References: <20220503063122.20957-1-jslaby@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" struct pic32_sport::ref_clk is only set, but not read. That means we can remove it. And when we do so, pic32_enable_clock() and pic32_disable_clock() are simple wrappers around clk_prepare_enable() and clk_disable_unprepare() respectively. So we can remove the former two from the code and replace it by the latter two. Signed-off-by: Jiri Slaby --- drivers/tty/serial/pic32_uart.c | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/drivers/tty/serial/pic32_uart.c b/drivers/tty/serial/pic32_uar= t.c index 1e8ff6004e8e..42269e96b3f8 100644 --- a/drivers/tty/serial/pic32_uart.c +++ b/drivers/tty/serial/pic32_uart.c @@ -68,7 +68,6 @@ struct pic32_sport { bool hw_flow_ctrl; int cts_gpio; =20 - int ref_clk; struct clk *clk; =20 struct device *dev; @@ -138,23 +137,6 @@ static inline void pic32_wait_deplete_txbuf(struct pic= 32_sport *sport) udelay(1); } =20 -static inline int pic32_enable_clock(struct pic32_sport *sport) -{ - int ret =3D clk_prepare_enable(sport->clk); - - if (ret) - return ret; - - sport->ref_clk++; - return 0; -} - -static inline void pic32_disable_clock(struct pic32_sport *sport) -{ - sport->ref_clk--; - clk_disable_unprepare(sport->clk); -} - /* serial core request to check if uart tx buffer is empty */ static unsigned int pic32_uart_tx_empty(struct uart_port *port) { @@ -491,7 +473,7 @@ static int pic32_uart_startup(struct uart_port *port) =20 local_irq_save(flags); =20 - ret =3D pic32_enable_clock(sport); + ret =3D clk_prepare_enable(sport->clk); if (ret) { local_irq_restore(flags); goto out_done; @@ -611,7 +593,7 @@ static void pic32_uart_shutdown(struct uart_port *port) spin_lock_irqsave(&port->lock, flags); pic32_uart_dsbl_and_mask(port); spin_unlock_irqrestore(&port->lock, flags); - pic32_disable_clock(sport); + clk_disable_unprepare(sport->clk); =20 /* free all 3 interrupts for this UART */ free_irq(sport->irq_fault, port); @@ -835,7 +817,7 @@ static int pic32_console_setup(struct console *co, char= *options) return -ENODEV; port =3D pic32_get_port(sport); =20 - ret =3D pic32_enable_clock(sport); + ret =3D clk_prepare_enable(sport->clk); if (ret) return ret; =20 @@ -965,7 +947,7 @@ static int pic32_uart_probe(struct platform_device *pde= v) /* The peripheral clock has been enabled by console_setup, * so disable it till the port is used. */ - pic32_disable_clock(sport); + clk_disable_unprepare(sport->clk); } #endif =20 @@ -986,7 +968,7 @@ static int pic32_uart_remove(struct platform_device *pd= ev) struct pic32_sport *sport =3D to_pic32_sport(port); =20 uart_remove_one_port(&pic32_uart_driver, port); - pic32_disable_clock(sport); + clk_disable_unprepare(sport->clk); platform_set_drvdata(pdev, NULL); pic32_sports[sport->idx] =3D NULL; =20 --=20 2.36.0 From nobody Sun May 10 14:15:40 2026 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 59BEFC433F5 for ; Tue, 3 May 2022 06:31:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230034AbiECGfU (ORCPT ); Tue, 3 May 2022 02:35:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229892AbiECGfA (ORCPT ); Tue, 3 May 2022 02:35:00 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6B5B381A4; Mon, 2 May 2022 23:31:28 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 7AF231F74B; Tue, 3 May 2022 06:31:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1651559487; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3FwR3pXwiEOYd31NngXicEXAdD76ELJgZWCXDrPYOL0=; b=zRUcISbqM8NXpz3wFjJwzYVahoO/8aL9BJKXgLGyHjze0jqC6q287e39652ixdGFkS+qTN N566Cl+qTp8B+oGXcM4pUSpZXvkkitWuitFy/cyNK99oY/Qd1kLfiPSLE4j1g/mPVYj7uX 4pdRMjfIDlqNl2tvS0l/VJiA2csST/0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1651559487; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3FwR3pXwiEOYd31NngXicEXAdD76ELJgZWCXDrPYOL0=; b=pjbYBlwL4bWrTcQFCB5K1RFPfDbFqlCK85z+11pUFJ+TcwD+i6cgaQsApGAWat3Ik697L8 S71w6JJ0hMk/77DQ== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 507702C143; Tue, 3 May 2022 06:31:27 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 05/11] serial: pic32: simplify pic32_sport::enable_tx_irq handling Date: Tue, 3 May 2022 08:31:16 +0200 Message-Id: <20220503063122.20957-6-jslaby@suse.cz> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220503063122.20957-1-jslaby@suse.cz> References: <20220503063122.20957-1-jslaby@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Make it a bool, so use true+false. And remove the wrap-around macro -- i.e. access the member directly. It makes the code more obvious. BTW the macro did not have 'sport' in parentheses, so it was potentially problematic wrt expansion. Signed-off-by: Jiri Slaby --- drivers/tty/serial/pic32_uart.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/tty/serial/pic32_uart.c b/drivers/tty/serial/pic32_uar= t.c index 42269e96b3f8..a6d548d5833d 100644 --- a/drivers/tty/serial/pic32_uart.c +++ b/drivers/tty/serial/pic32_uart.c @@ -63,7 +63,7 @@ struct pic32_sport { const char *irq_rx_name; int irq_tx; const char *irq_tx_name; - u8 enable_tx_irq; + bool enable_tx_irq; =20 bool hw_flow_ctrl; int cts_gpio; @@ -74,7 +74,6 @@ struct pic32_sport { }; #define to_pic32_sport(c) container_of(c, struct pic32_sport, port) #define pic32_get_port(sport) (&sport->port) -#define tx_irq_enabled(sport) (sport->enable_tx_irq) =20 static inline void pic32_uart_writel(struct pic32_sport *sport, u32 reg, u32 val) @@ -195,16 +194,16 @@ static unsigned int pic32_uart_get_mctrl(struct uart_= port *port) */ static inline void pic32_uart_irqtxen(struct pic32_sport *sport, u8 en) { - if (en && !tx_irq_enabled(sport)) { + if (en && !sport->enable_tx_irq) { enable_irq(sport->irq_tx); - tx_irq_enabled(sport) =3D 1; - } else if (!en && tx_irq_enabled(sport)) { + sport->enable_tx_irq =3D true; + } else if (!en && sport->enable_tx_irq) { /* use disable_irq_nosync() and not disable_irq() to avoid self * imposed deadlock by not waiting for irq handler to end, * since this callback is called from interrupt context. */ disable_irq_nosync(sport->irq_tx); - tx_irq_enabled(sport) =3D 0; + sport->enable_tx_irq =3D false; } } =20 @@ -497,7 +496,7 @@ static int pic32_uart_startup(struct uart_port *port) * For each irq request_irq() is called with interrupt disabled. * And the irq is enabled as soon as we are ready to handle them. */ - tx_irq_enabled(sport) =3D 0; + sport->enable_tx_irq =3D false; =20 sport->irq_fault_name =3D kasprintf(GFP_KERNEL, "%s%d-fault", pic32_uart_type(port), --=20 2.36.0 From nobody Sun May 10 14:15:40 2026 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 9DE64C433FE for ; Tue, 3 May 2022 06:32:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230083AbiECGfa (ORCPT ); Tue, 3 May 2022 02:35:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229908AbiECGfA (ORCPT ); Tue, 3 May 2022 02:35:00 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05BEC381A6; Mon, 2 May 2022 23:31:29 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id B5692210EF; Tue, 3 May 2022 06:31:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1651559487; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=787qMRnXnKwsARPvMVRxSoTbi3ggYCHSeqiE7jrlomA=; b=nJzPI5SKW7Sw4ahlYb5HqqCgWNJ3yzOyT/7+RfXD23gW5pXNRh4kqjoDgTPaeEcy7Vircc cXIeFqvVHOh2BfjuMUEiJLTS3mh+l20FAqiaNe6xorXuz+8SLejpOGaKQ4qIdilaD6J5B9 RajEt6hha5/PEIZOTopRmj5HJINOi/M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1651559487; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=787qMRnXnKwsARPvMVRxSoTbi3ggYCHSeqiE7jrlomA=; b=nxLcKC+d7YnTr/ALUk3x9lg0RKV4jS5voIICcsK2Ih9Z+iOmfQEwY1TZez2+f2bxmVve++ +l9iNppvYwZibXCg== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 8C3492C141; Tue, 3 May 2022 06:31:27 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 06/11] serial: pic32: remove pic32_get_port() macro Date: Tue, 3 May 2022 08:31:17 +0200 Message-Id: <20220503063122.20957-7-jslaby@suse.cz> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220503063122.20957-1-jslaby@suse.cz> References: <20220503063122.20957-1-jslaby@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" It's just &sport->port. First, sport was not in parenthesis, so macro expansion could be an issue. Second, it's so simple, that we can expand the macro and make the code really straightforward. Signed-off-by: Jiri Slaby --- drivers/tty/serial/pic32_uart.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/tty/serial/pic32_uart.c b/drivers/tty/serial/pic32_uar= t.c index a6d548d5833d..32a86b12f203 100644 --- a/drivers/tty/serial/pic32_uart.c +++ b/drivers/tty/serial/pic32_uart.c @@ -73,21 +73,16 @@ struct pic32_sport { struct device *dev; }; #define to_pic32_sport(c) container_of(c, struct pic32_sport, port) -#define pic32_get_port(sport) (&sport->port) =20 static inline void pic32_uart_writel(struct pic32_sport *sport, u32 reg, u32 val) { - struct uart_port *port =3D pic32_get_port(sport); - - __raw_writel(val, port->membase + reg); + __raw_writel(val, sport->port.membase + reg); } =20 static inline u32 pic32_uart_readl(struct pic32_sport *sport, u32 reg) { - struct uart_port *port =3D pic32_get_port(sport); - - return __raw_readl(port->membase + reg); + return __raw_readl(sport->port.membase + reg); } =20 /* pic32 uart mode register bits */ @@ -789,10 +784,9 @@ static void pic32_console_write(struct console *co, co= nst char *s, unsigned int count) { struct pic32_sport *sport =3D pic32_sports[co->index]; - struct uart_port *port =3D pic32_get_port(sport); =20 /* call uart helper to deal with \r\n */ - uart_console_write(port, s, count, pic32_console_putchar); + uart_console_write(&sport->port, s, count, pic32_console_putchar); } =20 /* console core request to setup given console, find matching uart @@ -801,7 +795,6 @@ static void pic32_console_write(struct console *co, con= st char *s, static int pic32_console_setup(struct console *co, char *options) { struct pic32_sport *sport; - struct uart_port *port =3D NULL; int baud =3D 115200; int bits =3D 8; int parity =3D 'n'; @@ -814,7 +807,6 @@ static int pic32_console_setup(struct console *co, char= *options) sport =3D pic32_sports[co->index]; if (!sport) return -ENODEV; - port =3D pic32_get_port(sport); =20 ret =3D clk_prepare_enable(sport->clk); if (ret) @@ -823,7 +815,7 @@ static int pic32_console_setup(struct console *co, char= *options) if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); =20 - return uart_set_options(port, co, baud, parity, bits, flow); + return uart_set_options(&sport->port, co, baud, parity, bits, flow); } =20 static struct uart_driver pic32_uart_driver; --=20 2.36.0 From nobody Sun May 10 14:15:40 2026 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 C2272C433EF for ; Tue, 3 May 2022 06:32:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230129AbiECGfo (ORCPT ); Tue, 3 May 2022 02:35:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229914AbiECGfA (ORCPT ); Tue, 3 May 2022 02:35:00 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F34E381A9; Mon, 2 May 2022 23:31:29 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 0C2BC21871; Tue, 3 May 2022 06:31:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1651559488; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=45EEhDKBrjTEPmKWgbFN1jRDrFBIQdwsxAiwXS6CFHo=; b=fmnbuNyEScNKJYXEEdlTaXRVvArpltNJUc17ihA446Y6nxxAC7Qdye57UmtwBbJ18dBwIB FMJSXVaXJ4kBR3Pkqq/tNcTK92lapXXQlbg/oFD7mUVdAnA8Gnf8IPzfpbpRW7/Pw7NlIX rcL0jxu5q+MTuW/CT8VPnwOA4HmUA/8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1651559488; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=45EEhDKBrjTEPmKWgbFN1jRDrFBIQdwsxAiwXS6CFHo=; b=5uTrp28+Yh6K/1uS12DgnP6p32Xz4VjrFbfmGPBAcL0D8fIUSkeKVolWA/33GQwf0KuLtM Ls5MMCifhC6lRaAw== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id CA80B2C143; Tue, 3 May 2022 06:31:27 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 07/11] serial: pic32: convert to_pic32_sport() to an inline Date: Tue, 3 May 2022 08:31:18 +0200 Message-Id: <20220503063122.20957-8-jslaby@suse.cz> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220503063122.20957-1-jslaby@suse.cz> References: <20220503063122.20957-1-jslaby@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 'c' is not in wrapped in parentheses in the to_pic32_sport() macro, so it might be problematic wrt macro expansion. Using an inline is always safer in these cases. Both type-wise and macro-expansion-wise. So switch the macro to an inline. Signed-off-by: Jiri Slaby --- drivers/tty/serial/pic32_uart.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/pic32_uart.c b/drivers/tty/serial/pic32_uar= t.c index 32a86b12f203..c3b4fd0b5b76 100644 --- a/drivers/tty/serial/pic32_uart.c +++ b/drivers/tty/serial/pic32_uart.c @@ -72,7 +72,11 @@ struct pic32_sport { =20 struct device *dev; }; -#define to_pic32_sport(c) container_of(c, struct pic32_sport, port) + +static inline struct pic32_sport *to_pic32_sport(struct uart_port *port) +{ + return container_of(port, struct pic32_sport, port); +} =20 static inline void pic32_uart_writel(struct pic32_sport *sport, u32 reg, u32 val) --=20 2.36.0 From nobody Sun May 10 14:15:40 2026 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 4850BC433EF for ; Tue, 3 May 2022 06:32:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230110AbiECGfy (ORCPT ); Tue, 3 May 2022 02:35:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229921AbiECGfC (ORCPT ); Tue, 3 May 2022 02:35:02 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B83F381B2; Mon, 2 May 2022 23:31:29 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 562DB1F74C; Tue, 3 May 2022 06:31:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1651559488; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tSVRncgXdxhSPnVu1HuIPNNJumIspe/QnB20qz/St8A=; b=livOX+eqi0gqvVmRuIoSMusLlBiZsQJe79CErg/SCugI6OfWuMX39YzG98FzqW0zWQldFk MRrH57oXVUw7ZHCQHnL6nIAeOjHep/yuG65lsZvREaP5FGZnKzcirGpOXUV0kN0deqCewU xQC+oDAk211IIhDrB0RXRBxBxaHKwu0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1651559488; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tSVRncgXdxhSPnVu1HuIPNNJumIspe/QnB20qz/St8A=; b=iy/H9Iu8/5AC8ky2uJdj5hCRPtHFsk/ianeeCPqclSW6ijOcXHI/oERBEz2bRJzcfCWieY kunN/D42qT4fJaDw== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 216502C141; Tue, 3 May 2022 06:31:28 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 08/11] serial: pic32: don't assign pic32_sport::cts_gpio twice Date: Tue, 3 May 2022 08:31:19 +0200 Message-Id: <20220503063122.20957-9-jslaby@suse.cz> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220503063122.20957-1-jslaby@suse.cz> References: <20220503063122.20957-1-jslaby@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" sport->cts_gpio is first assigned -EINVAL and few lines below using of_get_named_gpio(). Remove the first (useless) assignment. Signed-off-by: Jiri Slaby --- drivers/tty/serial/pic32_uart.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/tty/serial/pic32_uart.c b/drivers/tty/serial/pic32_uar= t.c index c3b4fd0b5b76..08e79d7f34f7 100644 --- a/drivers/tty/serial/pic32_uart.c +++ b/drivers/tty/serial/pic32_uart.c @@ -892,7 +892,6 @@ static int pic32_uart_probe(struct platform_device *pde= v) sport->irq_rx =3D irq_of_parse_and_map(np, 1); sport->irq_tx =3D irq_of_parse_and_map(np, 2); sport->clk =3D devm_clk_get(&pdev->dev, NULL); - sport->cts_gpio =3D -EINVAL; sport->dev =3D &pdev->dev; =20 /* Hardware flow control: gpios --=20 2.36.0 From nobody Sun May 10 14:15:40 2026 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 D0808C433F5 for ; Tue, 3 May 2022 06:32:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230159AbiECGfh (ORCPT ); Tue, 3 May 2022 02:35:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229920AbiECGfC (ORCPT ); Tue, 3 May 2022 02:35:02 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E005A381B7; Mon, 2 May 2022 23:31:29 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 9C70A21872; Tue, 3 May 2022 06:31:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1651559488; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UG/G8r1uCWHszZ/IvDqONfY3WDPVaGaRQxk6wngLySk=; b=OSPynr1u15u5yOyv1jfUUPpuj0OZuawxO0leMQdaIRmlY/140fy4+R6Xe1V9PbyXJK0r7m 5vU9Hsa05zdPpYtErr3MmI/zMrtHJNfxnfJyjbdD4Z8RQZ8nzBPwW8f4aaCzp7f5PZ76wV 5q62Q9adDVRi0pzMW2Tul96GgFLmF/o= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1651559488; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UG/G8r1uCWHszZ/IvDqONfY3WDPVaGaRQxk6wngLySk=; b=cHvR6udnaIXGXx0SVJ+SW9CRnDo9NA9KZU+WrszBIc0AR0X34kKQ31PmgO/QZexRWzkyPB 1N+iuFZzVq30CNCA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 6829C2C143; Tue, 3 May 2022 06:31:28 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 09/11] serial: pic32: don't zero members of kzalloc-ated structure Date: Tue, 3 May 2022 08:31:20 +0200 Message-Id: <20220503063122.20957-10-jslaby@suse.cz> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220503063122.20957-1-jslaby@suse.cz> References: <20220503063122.20957-1-jslaby@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" struct pic32_sport (sport) has just been kzallocated. So there is no need to zero its member (sport->port) now. Signed-off-by: Jiri Slaby --- drivers/tty/serial/pic32_uart.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/tty/serial/pic32_uart.c b/drivers/tty/serial/pic32_uar= t.c index 08e79d7f34f7..990603fe8a8d 100644 --- a/drivers/tty/serial/pic32_uart.c +++ b/drivers/tty/serial/pic32_uart.c @@ -919,7 +919,6 @@ static int pic32_uart_probe(struct platform_device *pde= v) =20 pic32_sports[uart_idx] =3D sport; port =3D &sport->port; - memset(port, 0, sizeof(*port)); port->iotype =3D UPIO_MEM; port->mapbase =3D res_mem->start; port->ops =3D &pic32_uart_ops; --=20 2.36.0 From nobody Sun May 10 14:15:40 2026 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 87C22C433F5 for ; Tue, 3 May 2022 06:32:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230128AbiECGgA (ORCPT ); Tue, 3 May 2022 02:36:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229927AbiECGfC (ORCPT ); Tue, 3 May 2022 02:35:02 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B7F2381B9; Mon, 2 May 2022 23:31:30 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id DCB041F747; Tue, 3 May 2022 06:31:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1651559488; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kglfxKG8tOeOX0Y7XjujhzV++vy+pMPUwg+1PazJyZA=; b=fu+k0L0lbktlDQMhsGobm0GybDiRtyawngc3BfVZGH+Pay8xZK9HFACmzMTR4IH/dQS+Q8 lLldzCGZZzpWkDxYHMf42yxtTtIZPe6cEvkGgrCqbVSSbcnVz7KZbdV4ys3I/ttbV0bDJb c5SVBIa5ULbc/85AFKDe71CVzM9t5FE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1651559488; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kglfxKG8tOeOX0Y7XjujhzV++vy+pMPUwg+1PazJyZA=; b=MUHdNmBrGDdkFUrm72yoGJX8ErNImRxRpNdiwPihjoTRAnyX20PPcp53moOpxH501//RV1 +HVrWVp104M9NuDA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id B37FB2C141; Tue, 3 May 2022 06:31:28 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 10/11] serial: pic32: free up irq names correctly Date: Tue, 3 May 2022 08:31:21 +0200 Message-Id: <20220503063122.20957-11-jslaby@suse.cz> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220503063122.20957-1-jslaby@suse.cz> References: <20220503063122.20957-1-jslaby@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" struct pic32_sport contains built-up names for irqs. These are freed only in error path of pic32_uart_startup(). And even there, the freeing happens before free_irq(). So fix this by: * moving frees after free_irq(), and * add frees to pic32_uart_shutdown() -- the opposite of pic32_uart_startup(). Signed-off-by: Jiri Slaby --- drivers/tty/serial/pic32_uart.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/pic32_uart.c b/drivers/tty/serial/pic32_uar= t.c index 990603fe8a8d..c5584628f8c4 100644 --- a/drivers/tty/serial/pic32_uart.c +++ b/drivers/tty/serial/pic32_uart.c @@ -569,14 +569,14 @@ static int pic32_uart_startup(struct uart_port *port) return 0; =20 out_t: - kfree(sport->irq_tx_name); free_irq(sport->irq_tx, port); + kfree(sport->irq_tx_name); out_r: - kfree(sport->irq_rx_name); free_irq(sport->irq_rx, port); + kfree(sport->irq_rx_name); out_f: - kfree(sport->irq_fault_name); free_irq(sport->irq_fault, port); + kfree(sport->irq_fault_name); out_done: return ret; } @@ -595,8 +595,11 @@ static void pic32_uart_shutdown(struct uart_port *port) =20 /* free all 3 interrupts for this UART */ free_irq(sport->irq_fault, port); + kfree(sport->irq_fault_name); free_irq(sport->irq_tx, port); + kfree(sport->irq_tx_name); free_irq(sport->irq_rx, port); + kfree(sport->irq_rx_name); } =20 /* serial core request to change current uart setting */ --=20 2.36.0 From nobody Sun May 10 14:15:40 2026 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 8D66DC433EF for ; Tue, 3 May 2022 06:32:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230183AbiECGgH (ORCPT ); Tue, 3 May 2022 02:36:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229928AbiECGfC (ORCPT ); Tue, 3 May 2022 02:35:02 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98935381BC; Mon, 2 May 2022 23:31:30 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 55CAA210EE; Tue, 3 May 2022 06:31:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1651559489; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v8MmPzwl2lp0qT4RRcx9jpE3gXaEx+C80zfCSbZItmk=; b=yZZZ1Yhj6WFqcOB3T+dFkHRx2YoQ5v/uB+PvpARHCw993viZeYyyhq3xz4jhtE04+2uN7n El/xQlhJrrLYAag7oux4z4LwaVTcDCpATDil6UwNU5eMlIvy60sgUfo4Jmu5X6UGcSx98d 2yGhv9HZyl43GG0APYfF9Xu8+XtBCaY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1651559489; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v8MmPzwl2lp0qT4RRcx9jpE3gXaEx+C80zfCSbZItmk=; b=CU0X0MZaKwV/xK5wQtV1xuEyVMoMa27yyHT1O9L2exNLpphfc/eEeZScW/lrIJJ+P1ZGIA 4mGTJesrWn1SyCCA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id F3BD22C149; Tue, 3 May 2022 06:31:28 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby , Andrei Pistirica Subject: [PATCH 11/11] serial: pic32: restore disabled irqs in pic32_uart_startup() Date: Tue, 3 May 2022 08:31:22 +0200 Message-Id: <20220503063122.20957-12-jslaby@suse.cz> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220503063122.20957-1-jslaby@suse.cz> References: <20220503063122.20957-1-jslaby@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" pic32_uart_startup() disables interrupts by local_irq_save(). But the function never enables them. The serial core only holds a mutex, so irqs are not restored. So how could this driver work? This irq handling was already present in the driver's initial commit 157b9394709ed (serial: pic32_uart: Add PIC32 UART driver). So is it a candidate for removal? Anyone has a contact to the author: Andrei Pistirica (I believe the one below -- @microchip.com -- will bounce)? Or to someone else @microchip.com? Cc: Andrei Pistirica Signed-off-by: Jiri Slaby --- drivers/tty/serial/pic32_uart.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/tty/serial/pic32_uart.c b/drivers/tty/serial/pic32_uar= t.c index c5584628f8c4..b399aac530fe 100644 --- a/drivers/tty/serial/pic32_uart.c +++ b/drivers/tty/serial/pic32_uart.c @@ -564,6 +564,8 @@ static int pic32_uart_startup(struct uart_port *port) /* enable all interrupts and eanable uart */ pic32_uart_en_and_unmask(port); =20 + local_irq_restore(flags); + enable_irq(sport->irq_rx); =20 return 0; --=20 2.36.0