From nobody Wed Dec 17 12:19:18 2025 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E14092FE570; Wed, 24 Sep 2025 15:37:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758728278; cv=none; b=RTUzFBVpoQlR7I4ljWhC/RRiKhfKd55d8G0tEdyPwrH8GK4QdbGVszzeagob0HlDWcy6qkegTCWtlr6j5BHS1OaqeStL9OZscSGe9hWObAf1J0Foilbk2eQBoEgqBLQIGOqEnZbmtWy7n4mmr1we6mBWEFsP03jomoVay5WflM8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758728278; c=relaxed/simple; bh=VQ4K3mbYDF7RCOQuQTRrICrxJ9EawHCBs0QoYZtZhZ4=; h=From:To:Cc:Date:Message-Id:In-Reply-To:References:MIME-Version: Subject; b=HUyldvlmZ/Rt0b0s2+r5cp0LOiqxaZBEykz59ROFqu0vFIL72N8c9IqF/LM8NQ6jKGankH9TcgmCKNCFUPxMt5GgXIkHLGt88z7NQINFjoLDJPImeSxJsZoxZQhwWI3rzkIEjonrwmmt0CGOw6qttPaR6/JNDP9673JBCXiwra8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=Zk3UtJK2; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="Zk3UtJK2" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=SI53DqfwOlhDf1zYe8DxLPZIvnq90SSUoK0E9Zs7Q4Q=; b=Zk3UtJK2CZZ2CyChO0DC2umTV5 Gk49CIMJ5bszcPsgPKSthIGPgsGetGOltwCfNxipOpGPmHdUcQsNmXE8ZaojNZ3fMN7yhqItMnjpP NN6EQrdDAgL9u8nVPFlPM1UJkKFk12XyS2AG8d8O4xP1z+pwDCuF/OOaxVM1T8Jof01A=; Received: from modemcable061.19-161-184.mc.videotron.ca ([184.161.19.61]:51978 helo=localhost.localdomain) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1v1RYx-0000RT-U2; Wed, 24 Sep 2025 11:37:48 -0400 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, fvallee@eukrea.fr Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve , stable@vger.kernel.org Date: Wed, 24 Sep 2025 11:37:26 -0400 Message-Id: <20250924153740.806444-2-hugo@hugovil.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250924153740.806444-1-hugo@hugovil.com> References: <20250924153740.806444-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 184.161.19.61 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP Subject: [PATCH 01/15] serial: sc16is7xx: remove useless enable of enhanced features X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Content-Type: text/plain; charset="utf-8" From: Hugo Villeneuve Commit 43c51bb573aa ("sc16is7xx: make sure device is in suspend once probed") permanently enabled access to the enhanced features in sc16is7xx_probe(), and it is never disabled after that. Therefore, remove useless re-enable of enhanced features in sc16is7xx_set_baud(). Fixes: 43c51bb573aa ("sc16is7xx: make sure device is in suspend once probed= ") Cc: stable@vger.kernel.org Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 1a2c4c14f6aac..c7435595dce13 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -588,13 +588,6 @@ static int sc16is7xx_set_baud(struct uart_port *port, = int baud) div /=3D prescaler; } =20 - /* Enable enhanced features */ - sc16is7xx_efr_lock(port); - sc16is7xx_port_update(port, SC16IS7XX_EFR_REG, - SC16IS7XX_EFR_ENABLE_BIT, - SC16IS7XX_EFR_ENABLE_BIT); - sc16is7xx_efr_unlock(port); - /* If bit MCR_CLKSEL is set, the divide by 4 prescaler is activated. */ sc16is7xx_port_update(port, SC16IS7XX_MCR_REG, SC16IS7XX_MCR_CLKSEL_BIT, --=20 2.39.5 From nobody Wed Dec 17 12:19:18 2025 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC825195FE8; Wed, 24 Sep 2025 15:37:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758728279; cv=none; b=Wgh9DDqLgg5e2fqXoNNqBshurifpjhG/Ve2OVwSv/RL7AMpr3beMgAT5MUcsohzuztkp5mEtiW7YQQz+x35pRbEzVq+CWW5KjV+L8SvCWtd44W/EwPCKBlsuwF3X1+BZH4Rnm8eXAkD9RdMi0gQU4JDhumw0BpJZNKqdupA6YG0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758728279; c=relaxed/simple; bh=vRBGm9s/dyL+mafpUYppZ1yooY3Npezr9ZaoASLiS50=; h=From:To:Cc:Date:Message-Id:In-Reply-To:References:MIME-Version: Subject; b=ppAbLkHgqIpKDU9J2Fc9M5AaaCZPONx0g9XvanFyeRANrZEfhxyUrnvmdODzoq++HY5DfNHkaRhdl3YDPfyVNQv5f61bsvUKLJ0L75HZh4E5ImxBdkeYvMxtKC+VZMh9X3I4wo5dcyLutE3bDmVUGh+dETH4sGmwlsBCPj62lEM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=BMYn6OoY; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="BMYn6OoY" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=9stedbZ0oenGDNSu79soTv0x9oOzbagK1AmdZRDf5wY=; b=BMYn6OoY6Qt/32ngxI7AiQCDmF ovYryixkD0QK9lncWW7PxJ4g8bOMUQKdN7mV9foxhftshZiwd2R5lYGZ1xp2xKRVV8mdxM0gZZ110 cLaeTYJiNgH/OsSFRp/I2oIteKWlOPRksc9sUHTSPqr5y+IykeviWUdbTO3XNIr8YtZY=; Received: from modemcable061.19-161-184.mc.videotron.ca ([184.161.19.61]:51978 helo=localhost.localdomain) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1v1RYy-0000RT-Md; Wed, 24 Sep 2025 11:37:49 -0400 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, fvallee@eukrea.fr Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve Date: Wed, 24 Sep 2025 11:37:27 -0400 Message-Id: <20250924153740.806444-3-hugo@hugovil.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250924153740.806444-1-hugo@hugovil.com> References: <20250924153740.806444-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 184.161.19.61 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP Subject: [PATCH 02/15] serial: sc16is7xx: rename LCR macros to better reflect usage X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Content-Type: text/plain; charset="utf-8" From: Hugo Villeneuve There is no reference to CONF_MODE_A or CONF_MODE_B in the manufacturer's datasheet. Rename register set configuration macros for the LCR register, to better show their intended usage to select either the Special register set, or the Enhanced register set. Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index c7435595dce13..330d95446f1d7 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -149,10 +149,12 @@ #define SC16IS7XX_LCR_WORD_LEN_6 (0x01) #define SC16IS7XX_LCR_WORD_LEN_7 (0x02) #define SC16IS7XX_LCR_WORD_LEN_8 (0x03) -#define SC16IS7XX_LCR_CONF_MODE_A SC16IS7XX_LCR_DLAB_BIT /* Special - * reg set */ -#define SC16IS7XX_LCR_CONF_MODE_B 0xBF /* Enhanced - * reg set */ +#define SC16IS7XX_LCR_REG_SET_SPECIAL SC16IS7XX_LCR_DLAB_BIT /* Special + * reg set + */ +#define SC16IS7XX_LCR_REG_SET_ENHANCED 0xBF /* Enhanced + * reg set + */ =20 /* MCR register bits */ #define SC16IS7XX_MCR_DTR_BIT BIT(0) /* DTR complement @@ -442,7 +444,7 @@ static void sc16is7xx_efr_lock(struct uart_port *port) one->old_lcr =3D sc16is7xx_port_read(port, SC16IS7XX_LCR_REG); =20 /* Enable access to Enhanced register set */ - sc16is7xx_port_write(port, SC16IS7XX_LCR_REG, SC16IS7XX_LCR_CONF_MODE_B); + sc16is7xx_port_write(port, SC16IS7XX_LCR_REG, SC16IS7XX_LCR_REG_SET_ENHAN= CED); =20 /* Disable cache updates when writing to EFR registers */ regcache_cache_bypass(one->regmap, true); @@ -598,7 +600,7 @@ static int sc16is7xx_set_baud(struct uart_port *port, i= nt baud) /* Backup LCR and access special register set (DLL/DLH) */ lcr =3D sc16is7xx_port_read(port, SC16IS7XX_LCR_REG); sc16is7xx_port_write(port, SC16IS7XX_LCR_REG, - SC16IS7XX_LCR_CONF_MODE_A); + SC16IS7XX_LCR_REG_SET_SPECIAL); =20 /* Write the new divisor */ regcache_cache_bypass(one->regmap, true); @@ -1650,7 +1652,7 @@ int sc16is7xx_probe(struct device *dev, const struct = sc16is7xx_devtype *devtype, =20 /* Enable EFR */ sc16is7xx_port_write(&s->p[i].port, SC16IS7XX_LCR_REG, - SC16IS7XX_LCR_CONF_MODE_B); + SC16IS7XX_LCR_REG_SET_ENHANCED); =20 regcache_cache_bypass(regmaps[i], true); =20 --=20 2.39.5 From nobody Wed Dec 17 12:19:18 2025 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E138F2FC860; Wed, 24 Sep 2025 15:37:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758728278; cv=none; b=r+WCFpNBlqleFcP7RtY5PgFJkcPsXgKj0Rx15ITsz7gdvv5OH4+omKh2rmhxTZ/kUhjeHc6tJIW0SiH7rqw/J72uV90xqW1yaktbgf9CG62gdKx9xwnqWqgvg355J84QbybuDagthZxwTcs3RTUe7bDWzt3HzYYS7N/KX4fLq0Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758728278; c=relaxed/simple; bh=3GSup+pKaTPRC904bUvLbtEi8OPatrZ73gmCrwgiD90=; h=From:To:Cc:Date:Message-Id:In-Reply-To:References:MIME-Version: Subject; b=c/a3cXD6FJ5U4DyzTY8cQ7spt0Ye0yLBevBQoGDy2fvv5qqOvGnh0vi9z9BTJ1Y1HDAzVakb3nyNGekxOfPv2j7aXTLdRNSbgKjwNKvPkdcIHsVcrw8v1rCnNnbhhpNFPPC+2PZnTOgI8gKOCE6YJ+2sjFtk0h8m6DrRAIvL2Sg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=OSxNsUTc; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="OSxNsUTc" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=aJMlqD2Q484a3VTqtujlReqh/fkDfF327hDpwcyhVMY=; b=OSxNsUTcAm1SWe8HXcknjpOV23 hoD0T2DDq9iXFL0n6qp6l+tz8vuYBV6Tn/5OuEeW4xfAX1xVeXVCTJwmmmJQlIS4HzXJ8D2LCg/M7 ZLj6EZzNQobOIYdtpiMW5+VMClA0Kk6dkszsvQUlGIwubIzLjIBS16aeVD+LE4VWShKA=; Received: from modemcable061.19-161-184.mc.videotron.ca ([184.161.19.61]:51978 helo=localhost.localdomain) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1v1RYz-0000RT-Lk; Wed, 24 Sep 2025 11:37:49 -0400 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, fvallee@eukrea.fr Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve Date: Wed, 24 Sep 2025 11:37:28 -0400 Message-Id: <20250924153740.806444-4-hugo@hugovil.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250924153740.806444-1-hugo@hugovil.com> References: <20250924153740.806444-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 184.161.19.61 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP Subject: [PATCH 03/15] serial: sc16is7xx: rename EFR mutex with generic name X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Content-Type: text/plain; charset="utf-8" From: Hugo Villeneuve This mutex is used as a lock when accessing registers that share the same address space, not necessarily EFR registers. For example, address 0x06 is shared by MSR, TCR and XOFF1 registers, independently of EFR. Rename the mutex with a more generic name to avoid misinterpreting its usage. Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 330d95446f1d7..26b34f23ed5fe 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -330,7 +330,7 @@ struct sc16is7xx_one_config { struct sc16is7xx_one { struct uart_port port; struct regmap *regmap; - struct mutex efr_lock; /* EFR registers access */ + struct mutex lock; /* For registers sharing same address space. */ struct kthread_work tx_work; struct kthread_work reg_work; struct kthread_delayed_work ms_work; @@ -438,7 +438,7 @@ static void sc16is7xx_efr_lock(struct uart_port *port) { struct sc16is7xx_one *one =3D to_sc16is7xx_one(port, port); =20 - mutex_lock(&one->efr_lock); + mutex_lock(&one->lock); =20 /* Backup content of LCR. */ one->old_lcr =3D sc16is7xx_port_read(port, SC16IS7XX_LCR_REG); @@ -460,7 +460,7 @@ static void sc16is7xx_efr_unlock(struct uart_port *port) /* Restore original content of LCR */ sc16is7xx_port_write(port, SC16IS7XX_LCR_REG, one->old_lcr); =20 - mutex_unlock(&one->efr_lock); + mutex_unlock(&one->lock); } =20 static void sc16is7xx_ier_clear(struct uart_port *port, u8 bit) @@ -595,7 +595,7 @@ static int sc16is7xx_set_baud(struct uart_port *port, i= nt baud) SC16IS7XX_MCR_CLKSEL_BIT, prescaler =3D=3D 1 ? 0 : SC16IS7XX_MCR_CLKSEL_BIT); =20 - mutex_lock(&one->efr_lock); + mutex_lock(&one->lock); =20 /* Backup LCR and access special register set (DLL/DLH) */ lcr =3D sc16is7xx_port_read(port, SC16IS7XX_LCR_REG); @@ -611,7 +611,7 @@ static int sc16is7xx_set_baud(struct uart_port *port, i= nt baud) /* Restore LCR and access to general register set */ sc16is7xx_port_write(port, SC16IS7XX_LCR_REG, lcr); =20 - mutex_unlock(&one->efr_lock); + mutex_unlock(&one->lock); =20 return DIV_ROUND_CLOSEST((clk / prescaler) / 16, div); } @@ -758,7 +758,7 @@ static void sc16is7xx_update_mlines(struct sc16is7xx_on= e *one) unsigned long flags; unsigned int status, changed; =20 - lockdep_assert_held_once(&one->efr_lock); + lockdep_assert_held_once(&one->lock); =20 status =3D sc16is7xx_get_hwmctrl(port); changed =3D status ^ one->old_mctrl; @@ -789,7 +789,7 @@ static bool sc16is7xx_port_irq(struct sc16is7xx_port *s= , int portno) struct uart_port *port =3D &s->p[portno].port; struct sc16is7xx_one *one =3D to_sc16is7xx_one(port, port); =20 - mutex_lock(&one->efr_lock); + mutex_lock(&one->lock); =20 iir =3D sc16is7xx_port_read(port, SC16IS7XX_IIR_REG); if (iir & SC16IS7XX_IIR_NO_INT_BIT) { @@ -836,7 +836,7 @@ static bool sc16is7xx_port_irq(struct sc16is7xx_port *s= , int portno) } =20 out_port_irq: - mutex_unlock(&one->efr_lock); + mutex_unlock(&one->lock); =20 return rc; } @@ -880,9 +880,9 @@ static void sc16is7xx_tx_proc(struct kthread_work *ws) (port->rs485.delay_rts_before_send > 0)) msleep(port->rs485.delay_rts_before_send); =20 - mutex_lock(&one->efr_lock); + mutex_lock(&one->lock); sc16is7xx_handle_tx(port); - mutex_unlock(&one->efr_lock); + mutex_unlock(&one->lock); } =20 static void sc16is7xx_reconf_rs485(struct uart_port *port) @@ -949,9 +949,9 @@ static void sc16is7xx_ms_proc(struct kthread_work *ws) struct sc16is7xx_port *s =3D dev_get_drvdata(one->port.dev); =20 if (one->port.state) { - mutex_lock(&one->efr_lock); + mutex_lock(&one->lock); sc16is7xx_update_mlines(one); - mutex_unlock(&one->efr_lock); + mutex_unlock(&one->lock); =20 kthread_queue_delayed_work(&s->kworker, &one->ms_work, HZ); } @@ -1625,7 +1625,7 @@ int sc16is7xx_probe(struct device *dev, const struct = sc16is7xx_devtype *devtype, s->p[i].old_mctrl =3D 0; s->p[i].regmap =3D regmaps[i]; =20 - mutex_init(&s->p[i].efr_lock); + mutex_init(&s->p[i].lock); =20 ret =3D uart_get_rs485_mode(&s->p[i].port); if (ret) --=20 2.39.5 From nobody Wed Dec 17 12:19:18 2025 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F1D8330F7F2; Wed, 24 Sep 2025 15:37:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758728279; cv=none; b=deGqHMZ9Urq5Lx90pq5IoV2etNZvJD90+Zb2yXJTXjS5P9OVZTZa+vzNdi4yoCpKt+wna09b/hafkQvubWqvBMaoB/2oJ45d7nItbfm9XzXdyKAZrxpPDZsrtGwYA1Fg86DqtbUj0RuUtD0rhEL6Z0oAwbvKIQWnU26lvfefaPY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758728279; c=relaxed/simple; bh=7Ha/GqIua9/ChaOBE549z8GD/x5rObpIWEV80xKeEI8=; h=From:To:Cc:Date:Message-Id:In-Reply-To:References:MIME-Version: Subject; b=Y3zSVXfa8mAGMRSf44oOzyQYJSBb0ir4Rq3EBKTEya6BItT4RTtOIUES53HKKUIzndICR7IvoHq93yncTH6YYXoAQw//541ZfTyg1X10eKPrJwX53uz7PAgn43vuq6RzAzYR5xJZUa4Suq9yvKJpF15oOAiDZwwUumihzPr+LyE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=ztKidnXP; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="ztKidnXP" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=8jMeiYcJ4IAwPEnHXSKqmQcGOw+ff5KoMj+tTxq4440=; b=ztKidnXPK+awpM0kFEny8u7NPV UF7JJTBCCpbKN3tU7kIyqoXuZGdpDYCaL82/UWT8SznKZ0JamIGIPsuefqvgW2hbFOkfa1XVoY9cG vGXxN8vfxlVvp9/W2UVQnSLKTVjVLo/NhRIkZp5DNpTVVN6VMmVAMakXr/xOPb3CHzXE=; Received: from modemcable061.19-161-184.mc.videotron.ca ([184.161.19.61]:51978 helo=localhost.localdomain) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1v1RZ0-0000RT-Ka; Wed, 24 Sep 2025 11:37:51 -0400 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, fvallee@eukrea.fr Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve Date: Wed, 24 Sep 2025 11:37:29 -0400 Message-Id: <20250924153740.806444-5-hugo@hugovil.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250924153740.806444-1-hugo@hugovil.com> References: <20250924153740.806444-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 184.161.19.61 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP Subject: [PATCH 04/15] serial: sc16is7xx: define common register access function X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Content-Type: text/plain; charset="utf-8" From: Hugo Villeneuve Rename lock/unlock functions to make it more generic and applicable to both the Enhanced register set and the Special register set. Use this new generic function when accessing the Special register set in sc16is7xx_set_baud(), and when accessing the Enhanced register set in sc16is7xx_set_termios() and sc16is7xx_probe(). This helps readability and also avoid to make future mistakes when accessing these obfuscated registers. Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 74 ++++++++++++++-------------------- 1 file changed, 31 insertions(+), 43 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 26b34f23ed5fe..72e4c4f80f7f5 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -421,20 +421,24 @@ static void sc16is7xx_power(struct uart_port *port, i= nt on) } =20 /* - * In an amazing feat of design, the Enhanced Features Register (EFR) - * shares the address of the Interrupt Identification Register (IIR). - * Access to EFR is switched on by writing a magic value (0xbf) to the - * Line Control Register (LCR). Any interrupt firing during this time will - * see the EFR where it expects the IIR to be, leading to + * In an amazing feat of design, the enhanced register set shares the + * addresses 0x02 and 0x04-0x07 with the general register set. + * The special register set also shares the addresses 0x00-0x01 with the + * general register set. + * + * Access to the enhanced or special register set is enabled by writing a = magic + * value to the Line Control Register (LCR). When enhanced register set ac= cess + * is enabled, for example, any interrupt firing during this time will see= the + * EFR where it expects the IIR to be, leading to * "Unexpected interrupt" messages. * - * Prevent this possibility by claiming a mutex while accessing the EFR, - * and claiming the same mutex from within the interrupt handler. This is - * similar to disabling the interrupt, but that doesn't work because the - * bulk of the interrupt processing is run as a workqueue job in thread - * context. + * Prevent this possibility by claiming a mutex when access to the enhanced + * or special register set is enabled, and claiming the same mutex from wi= thin + * the interrupt handler. This is similar to disabling the interrupt, but = that + * doesn't work because the bulk of the interrupt processing is run as a + * workqueue job in thread context. */ -static void sc16is7xx_efr_lock(struct uart_port *port) +static void sc16is7xx_regs_lock(struct uart_port *port, u8 register_set) { struct sc16is7xx_one *one =3D to_sc16is7xx_one(port, port); =20 @@ -443,18 +447,18 @@ static void sc16is7xx_efr_lock(struct uart_port *port) /* Backup content of LCR. */ one->old_lcr =3D sc16is7xx_port_read(port, SC16IS7XX_LCR_REG); =20 - /* Enable access to Enhanced register set */ - sc16is7xx_port_write(port, SC16IS7XX_LCR_REG, SC16IS7XX_LCR_REG_SET_ENHAN= CED); + /* Enable access to the desired register set */ + sc16is7xx_port_write(port, SC16IS7XX_LCR_REG, register_set); =20 - /* Disable cache updates when writing to EFR registers */ + /* Disable cache updates when writing to non-general registers */ regcache_cache_bypass(one->regmap, true); } =20 -static void sc16is7xx_efr_unlock(struct uart_port *port) +static void sc16is7xx_regs_unlock(struct uart_port *port) { struct sc16is7xx_one *one =3D to_sc16is7xx_one(port, port); =20 - /* Re-enable cache updates when writing to normal registers */ + /* Re-enable cache updates when writing to general registers */ regcache_cache_bypass(one->regmap, false); =20 /* Restore original content of LCR */ @@ -580,8 +584,6 @@ static bool sc16is7xx_regmap_noinc(struct device *dev, = unsigned int reg) */ static int sc16is7xx_set_baud(struct uart_port *port, int baud) { - struct sc16is7xx_one *one =3D to_sc16is7xx_one(port, port); - u8 lcr; unsigned int prescaler =3D 1; unsigned long clk =3D port->uartclk, div =3D clk / 16 / baud; =20 @@ -595,23 +597,15 @@ static int sc16is7xx_set_baud(struct uart_port *port,= int baud) SC16IS7XX_MCR_CLKSEL_BIT, prescaler =3D=3D 1 ? 0 : SC16IS7XX_MCR_CLKSEL_BIT); =20 - mutex_lock(&one->lock); - - /* Backup LCR and access special register set (DLL/DLH) */ - lcr =3D sc16is7xx_port_read(port, SC16IS7XX_LCR_REG); - sc16is7xx_port_write(port, SC16IS7XX_LCR_REG, - SC16IS7XX_LCR_REG_SET_SPECIAL); + /* Access special register set (DLL/DLH) */ + sc16is7xx_regs_lock(port, SC16IS7XX_LCR_REG_SET_SPECIAL); =20 /* Write the new divisor */ - regcache_cache_bypass(one->regmap, true); sc16is7xx_port_write(port, SC16IS7XX_DLH_REG, div / 256); sc16is7xx_port_write(port, SC16IS7XX_DLL_REG, div % 256); - regcache_cache_bypass(one->regmap, false); =20 - /* Restore LCR and access to general register set */ - sc16is7xx_port_write(port, SC16IS7XX_LCR_REG, lcr); - - mutex_unlock(&one->lock); + /* Restore access to general register set */ + sc16is7xx_regs_unlock(port); =20 return DIV_ROUND_CLOSEST((clk / prescaler) / 16, div); } @@ -1108,12 +1102,12 @@ static void sc16is7xx_set_termios(struct uart_port = *port, sc16is7xx_port_write(port, SC16IS7XX_LCR_REG, lcr); =20 /* Update EFR registers */ - sc16is7xx_efr_lock(port); + sc16is7xx_regs_lock(port, SC16IS7XX_LCR_REG_SET_ENHANCED); sc16is7xx_port_write(port, SC16IS7XX_XON1_REG, termios->c_cc[VSTART]); sc16is7xx_port_write(port, SC16IS7XX_XOFF1_REG, termios->c_cc[VSTOP]); sc16is7xx_port_update(port, SC16IS7XX_EFR_REG, SC16IS7XX_EFR_FLOWCTRL_BITS, flow); - sc16is7xx_efr_unlock(port); + sc16is7xx_regs_unlock(port); =20 /* Get baud rate generator configuration */ baud =3D uart_get_baud_rate(port, termios, old, @@ -1631,6 +1625,9 @@ int sc16is7xx_probe(struct device *dev, const struct = sc16is7xx_devtype *devtype, if (ret) goto out_ports; =20 + /* Enable access to general register set */ + sc16is7xx_port_write(&s->p[i].port, SC16IS7XX_LCR_REG, 0x00); + /* Disable all interrupts */ sc16is7xx_port_write(&s->p[i].port, SC16IS7XX_IER_REG, 0); /* Disable TX/RX */ @@ -1650,20 +1647,11 @@ int sc16is7xx_probe(struct device *dev, const struc= t sc16is7xx_devtype *devtype, =20 port_registered[i] =3D true; =20 - /* Enable EFR */ - sc16is7xx_port_write(&s->p[i].port, SC16IS7XX_LCR_REG, - SC16IS7XX_LCR_REG_SET_ENHANCED); - - regcache_cache_bypass(regmaps[i], true); - + sc16is7xx_regs_lock(&s->p[i].port, SC16IS7XX_LCR_REG_SET_ENHANCED); /* Enable write access to enhanced features */ sc16is7xx_port_write(&s->p[i].port, SC16IS7XX_EFR_REG, SC16IS7XX_EFR_ENABLE_BIT); - - regcache_cache_bypass(regmaps[i], false); - - /* Restore access to general registers */ - sc16is7xx_port_write(&s->p[i].port, SC16IS7XX_LCR_REG, 0x00); + sc16is7xx_regs_unlock(&s->p[i].port); =20 /* Go to suspend mode */ sc16is7xx_power(&s->p[i].port, 0); --=20 2.39.5 From nobody Wed Dec 17 12:19:18 2025 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D11D63101B5; Wed, 24 Sep 2025 15:37:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758728281; cv=none; b=G1RyNlcgqJ9dF//rX29RJRgnSQ9UI750+V98SYUa1Zb87689mCsp+OEVa1iFWz4cqMvV0XcVevDwJKFoIVWTQev3I/WRXvwP7y7mudj9Ipn98zjJLhm90/ji0ESIU8F0o0NcgJredNuBbdgtV1mn6S2F0P5OuqpGZ8TtnJKbNhQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758728281; c=relaxed/simple; bh=3ftqvKqq7q6e7O0TPKo+0TG2tqZME1C8OVxRtTXixMI=; h=From:To:Cc:Date:Message-Id:In-Reply-To:References:MIME-Version: Subject; b=ugbxZzvxOTEURD/pPkLZPVFL/TwzfQy3w0Px1airgRHAFTxdpM3KRY3JTg90yjMgQOdT94xLb0m1RxOJ1CNq45jUJUSxrcYDp796MTP9Y6WSOChg4f1tfSHtRkVQrjWqBzCQp9W6qR21eUtKQUDwrbN+SFFkfw41ceY6SYpc7wo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=BBPvHPEj; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="BBPvHPEj" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=g6rITN11GQ2tLx4IWN346Ob6yiOj9oDme1YNRmSi1nY=; b=BBPvHPEjsPIvgmKL8gaF9dZmz+ NmwssiCLXfLuk1RU21n4zeYaOotW6hm29qeFQowSW69xFBcHyNqvnXGtF0nLGki1Vy23dhSKbTSNI 11VstGpZeYiSt3zbUAm8Qik8T4kt6hcJ8t6Of1LnwAz/ukZnr2+gdKKgNyFu4ggcOmPc=; Received: from modemcable061.19-161-184.mc.videotron.ca ([184.161.19.61]:51978 helo=localhost.localdomain) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1v1RZ1-0000RT-Nf; Wed, 24 Sep 2025 11:37:52 -0400 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, fvallee@eukrea.fr Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve Date: Wed, 24 Sep 2025 11:37:30 -0400 Message-Id: <20250924153740.806444-6-hugo@hugovil.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250924153740.806444-1-hugo@hugovil.com> References: <20250924153740.806444-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 184.161.19.61 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP Subject: [PATCH 05/15] serial: sc16is7xx: use guards for simple mutex locks X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Content-Type: text/plain; charset="utf-8" From: Hugo Villeneuve Guards can help to make the code more readable, so use them wherever they do so. In many places, labels and 'ret' locals are eliminated completely. Signed-off-by: Hugo Villeneuve --- Based on patch by Jiri Slaby (SUSE) : commit("serial: use guards for simple mutex locks") --- drivers/tty/serial/sc16is7xx.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 72e4c4f80f7f5..7af09535a1563 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -783,13 +783,11 @@ static bool sc16is7xx_port_irq(struct sc16is7xx_port = *s, int portno) struct uart_port *port =3D &s->p[portno].port; struct sc16is7xx_one *one =3D to_sc16is7xx_one(port, port); =20 - mutex_lock(&one->lock); + guard(mutex)(&one->lock); =20 iir =3D sc16is7xx_port_read(port, SC16IS7XX_IIR_REG); - if (iir & SC16IS7XX_IIR_NO_INT_BIT) { - rc =3D false; - goto out_port_irq; - } + if (iir & SC16IS7XX_IIR_NO_INT_BIT) + return false; =20 iir &=3D SC16IS7XX_IIR_ID_MASK; =20 @@ -829,9 +827,6 @@ static bool sc16is7xx_port_irq(struct sc16is7xx_port *s= , int portno) break; } =20 -out_port_irq: - mutex_unlock(&one->lock); - return rc; } =20 @@ -874,9 +869,8 @@ static void sc16is7xx_tx_proc(struct kthread_work *ws) (port->rs485.delay_rts_before_send > 0)) msleep(port->rs485.delay_rts_before_send); =20 - mutex_lock(&one->lock); + guard(mutex)(&one->lock); sc16is7xx_handle_tx(port); - mutex_unlock(&one->lock); } =20 static void sc16is7xx_reconf_rs485(struct uart_port *port) @@ -943,9 +937,8 @@ static void sc16is7xx_ms_proc(struct kthread_work *ws) struct sc16is7xx_port *s =3D dev_get_drvdata(one->port.dev); =20 if (one->port.state) { - mutex_lock(&one->lock); + guard(mutex)(&one->lock); sc16is7xx_update_mlines(one); - mutex_unlock(&one->lock); =20 kthread_queue_delayed_work(&s->kworker, &one->ms_work, HZ); } --=20 2.39.5 From nobody Wed Dec 17 12:19:18 2025 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 08EBE311C0C; Wed, 24 Sep 2025 15:37:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758728282; cv=none; b=ADwjpztBZqed8qCaulvOvOgob/El0+M+jmDjim9SbAsHPgjGpsuyi5rwoG98gKwif2yxbp0n62vg+8beqjyw4AVtWQUh5ENkM2J5Twlwo4hd8Da086pmGuok+zj6ynxVL+fUaqiCnTx8HjKkepuZAttPnsjU6Nn3rjl4PUoV9bw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758728282; c=relaxed/simple; bh=Nh7aBr5KYkQBsAqKOi50IdV/Xi0XD+m/VjeNMRt6v7U=; h=From:To:Cc:Date:Message-Id:In-Reply-To:References:MIME-Version: Subject; b=jqBhu43a0ZPJrY7cN2oYNmWOtgP+R1Q5fT7nl+vOn6g34KYkUClEwqKu9joXYU4Gif938uJHq5p5n+o/8GMz+YqtH0iYtMtRw8Y/ldj8Io20UfXl+bqY1ORYjwdlhKCXmszWVDICMX08K3bqYddOKeUVzq4LA2UcvvRZDggUIJ8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=QykmPj/x; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="QykmPj/x" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=Lljoat6sYacBPvhSLf9rEDVbXVSpJG4w9X7ZqtrWvYk=; b=QykmPj/xj6AGzk3irdM6SDET8v JwokjD7ojlnPf7EhjHHotAdH+frKH/KpoVN2b7FriemI1tR9qfG9jOFfbAlrrUo4POc4c5IPGSrc9 bFELSP/KBVeOCM0Bn6LzY3MUdh5jxYsz141VN8o0Xz5o/x5Nvh0NQgwHf4dcv9HL/8uE=; Received: from modemcable061.19-161-184.mc.videotron.ca ([184.161.19.61]:51978 helo=localhost.localdomain) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1v1RZ2-0000RT-Iw; Wed, 24 Sep 2025 11:37:52 -0400 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, fvallee@eukrea.fr Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve Date: Wed, 24 Sep 2025 11:37:31 -0400 Message-Id: <20250924153740.806444-7-hugo@hugovil.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250924153740.806444-1-hugo@hugovil.com> References: <20250924153740.806444-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 184.161.19.61 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP Subject: [PATCH 06/15] serial: sc16is7xx: use dev_err_probe() instead of dev_err() X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Content-Type: text/plain; charset="utf-8" From: Hugo Villeneuve This simplifies code and standardizes the error output. Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 7af09535a1563..4384804a4e228 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -1528,10 +1528,9 @@ int sc16is7xx_probe(struct device *dev, const struct= sc16is7xx_devtype *devtype, =20 /* Alloc port structure */ s =3D devm_kzalloc(dev, struct_size(s, p, devtype->nr_uart), GFP_KERNEL); - if (!s) { - dev_err(dev, "Error allocating port structure\n"); - return -ENOMEM; - } + if (!s) + return dev_err_probe(dev, -ENOMEM, + "Error allocating port structure\n"); =20 /* Always ask for fixed clock rate from a property. */ device_property_read_u32(dev, "clock-frequency", &uartclk); --=20 2.39.5 From nobody Wed Dec 17 12:19:18 2025 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 92366312817; Wed, 24 Sep 2025 15:38:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758728282; cv=none; b=IT3Ux45uyb28Fen8DvK7LwKWHmxss0Ipa0H1sHQRDlZe6zwVSaxFTR1U+Io+UuROXInwIG7V7jRG2Hy5Ls/CT5CjlAfoMJwIR3uTNv7P8uNBW3//nOP5akQyjhZqvkIOixFkJ8Qt/rj6GfGDzRgrrEjUL1gHuZyxRd3dxh8kMh8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758728282; c=relaxed/simple; bh=+3u4GT7ho/fVnLlm9Fb0g30Tpf6refpWMMmq6XbmcbE=; h=From:To:Cc:Date:Message-Id:In-Reply-To:References:MIME-Version: Subject; b=D2nUAgsaDVkUtnWkzJtynOJS0S0OrInfBd4l+iv+Jq/AvqoLs1jaIgVg3dWX0OgWgxzsU2VNjjbQ3ferI92bA3MyBzYi6sn347NvIRY2E1a0sAwggkKWmVYdeKMfRInj4Qhbtrw8H5UsYRML7Hp2YNKWkfPZce/brRRHgtBOdgc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=xqZ0Vi9z; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="xqZ0Vi9z" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=qoaY+ZoNwdZMOnb1nwaF8EXSI8+/WdKyXHOeBl5C7Fo=; b=xqZ0Vi9zNDKH+uNGDTbD0EM9Mz /Vnqly+ju8dhQuEmnLQEKsP8ICCODT34g4MRAx3NcFgtNU7OzCaduUKCN9BaIRXIxOmyPMaR/usRV 5kY4bOUWgTJoeJoYqVwnCMRXi8o1ighu2DyOTdBUyYXoMZWuplI1Z6EHofQr/ZhNKTKs=; Received: from modemcable061.19-161-184.mc.videotron.ca ([184.161.19.61]:51978 helo=localhost.localdomain) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1v1RZ3-0000RT-EY; Wed, 24 Sep 2025 11:37:53 -0400 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, fvallee@eukrea.fr Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve Date: Wed, 24 Sep 2025 11:37:32 -0400 Message-Id: <20250924153740.806444-8-hugo@hugovil.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250924153740.806444-1-hugo@hugovil.com> References: <20250924153740.806444-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 184.161.19.61 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP Subject: [PATCH 07/15] serial: sc16is7xx: declare SPR/TLR/XOFF2 register as volatile X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Content-Type: text/plain; charset="utf-8" From: Hugo Villeneuve SPR shares the same address space as TLR and XOFF2. If SPR or TLR were to be used eventually, this could lead to incorrect read value from the cache. Prevent this potential bug by declaring SPR/TLR/XOFF2 as volatile. Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 4384804a4e228..96ea308013912 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -545,6 +545,7 @@ static bool sc16is7xx_regmap_volatile(struct device *de= v, unsigned int reg) case SC16IS7XX_IIR_REG: case SC16IS7XX_LSR_REG: case SC16IS7XX_MSR_REG: + case SC16IS7XX_SPR_REG: /* Shared address space with TLR & XOFF2 */ case SC16IS7XX_TXLVL_REG: case SC16IS7XX_RXLVL_REG: case SC16IS7XX_IOSTATE_REG: --=20 2.39.5 From nobody Wed Dec 17 12:19:18 2025 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C5A92E0920; Wed, 24 Sep 2025 15:37:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758728277; cv=none; b=B0k/Sze7092TFQKsv3T2SeuBC7L86NEh9eMoCnvULmYTJng3PsGmQuThFzb9S0V1DSmsNGzOcwbYaSIA5Y9PXGnm0+7s0lDNRB8tZyDqGdwaqaIQbqpvWxp+KtD7xPovRhzBX/VWHGSbg9U2yXkiWfD22W6R8sM6Tf2n35s5Sxs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758728277; c=relaxed/simple; bh=iZkfVEU3+OooimxKpFJ2Zt7d0qEsUMEIdBI9IDQhxBU=; h=From:To:Cc:Date:Message-Id:In-Reply-To:References:MIME-Version: Subject; b=KSd4jUX9qORqG6SWiB9BzhhtJUNrnoi1Rn3IHrr7Z7f9e/TsG7IV0lzvrEyQjQ/cWns0F+0R6l7tZpt1dA7FaSe1A3Nrs30GDy0rDAHM3zh87Nn/2uam1NQFyz9tW2+rUrLkTcOKMs3ABjJoJ6G34+tvjcVtjnrfazbfCKHuZJU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=wF1SyL7w; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="wF1SyL7w" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=BNaDoEFqyb7ZUUq5PDNXdbqYLOkdDNNy4L8MLwu8cSo=; b=wF1SyL7wYMShjdJNpTr6ZW6Wfx qSPrc9+l+pQ7XRonqBLZEez9gpKNWgufJyh9xTIP9RcOmkQjLKPHg1m4UyhvgJMtFnv6HO8V9ADxS 7YuOjwE2ojecOlgJ0mtLdkXXSDFtVhwzeaKGF+Ry7Vtyc5ghCcwFPuuRW3rpdmz7oYyE=; Received: from modemcable061.19-161-184.mc.videotron.ca ([184.161.19.61]:51978 helo=localhost.localdomain) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1v1RZ4-0000RT-FY; Wed, 24 Sep 2025 11:37:54 -0400 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, fvallee@eukrea.fr Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve Date: Wed, 24 Sep 2025 11:37:33 -0400 Message-Id: <20250924153740.806444-9-hugo@hugovil.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250924153740.806444-1-hugo@hugovil.com> References: <20250924153740.806444-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 184.161.19.61 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP Subject: [PATCH 08/15] serial: sc16is7xx: move port/channel init to separate function X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Content-Type: text/plain; charset="utf-8" From: Hugo Villeneuve The sc16is7xx_probe() function is very long. To improve readability, move port/channel initialization to a separate function. No functional change intended. Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 127 ++++++++++++++++++--------------- 1 file changed, 70 insertions(+), 57 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 96ea308013912..406dd7cf81fe3 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -1500,6 +1500,75 @@ static int sc16is7xx_reset(struct device *dev, struc= t regmap *regmap) return 0; } =20 +static int sc16is7xx_setup_channel(struct sc16is7xx_one *one, int i, + bool *port_registered) +{ + struct uart_port *port =3D &one->port; + int ret; + + ret =3D ida_alloc_max(&sc16is7xx_lines, SC16IS7XX_MAX_DEVS - 1, GFP_KERNE= L); + if (ret < 0) + return ret; + + port->line =3D ret; + + /* Initialize port data */ + port->type =3D PORT_SC16IS7XX; + port->fifosize =3D SC16IS7XX_FIFO_SIZE; + port->flags =3D UPF_FIXED_TYPE | UPF_LOW_LATENCY; + port->iobase =3D i; + /* + * Use all ones as membase to make sure uart_configure_port() in + * serial_core.c does not abort for SPI/I2C devices where the + * membase address is not applicable. + */ + port->membase =3D (void __iomem *)~0; + port->iotype =3D UPIO_PORT; + port->rs485_config =3D sc16is7xx_config_rs485; + port->rs485_supported =3D sc16is7xx_rs485_supported; + port->ops =3D &sc16is7xx_ops; + one->old_mctrl =3D 0; + + mutex_init(&one->lock); + + ret =3D uart_get_rs485_mode(port); + if (ret) + return ret; + + /* Enable access to general register set */ + sc16is7xx_port_write(port, SC16IS7XX_LCR_REG, 0x00); + + /* Disable all interrupts */ + sc16is7xx_port_write(port, SC16IS7XX_IER_REG, 0); + /* Disable TX/RX */ + sc16is7xx_port_write(port, SC16IS7XX_EFCR_REG, + SC16IS7XX_EFCR_RXDISABLE_BIT | + SC16IS7XX_EFCR_TXDISABLE_BIT); + + /* Initialize kthread work structs */ + kthread_init_work(&one->tx_work, sc16is7xx_tx_proc); + kthread_init_work(&one->reg_work, sc16is7xx_reg_proc); + kthread_init_delayed_work(&one->ms_work, sc16is7xx_ms_proc); + + /* Register port */ + ret =3D uart_add_one_port(&sc16is7xx_uart, port); + if (ret) + return ret; + + *port_registered =3D true; + + sc16is7xx_regs_lock(port, SC16IS7XX_LCR_REG_SET_ENHANCED); + /* Enable write access to enhanced features */ + sc16is7xx_port_write(port, SC16IS7XX_EFR_REG, + SC16IS7XX_EFR_ENABLE_BIT); + sc16is7xx_regs_unlock(port); + + /* Go to suspend mode */ + sc16is7xx_power(port, 0); + + return 0; +} + int sc16is7xx_probe(struct device *dev, const struct sc16is7xx_devtype *de= vtype, struct regmap *regmaps[], int irq) { @@ -1584,70 +1653,14 @@ int sc16is7xx_probe(struct device *dev, const struc= t sc16is7xx_devtype *devtype, } =20 for (i =3D 0; i < devtype->nr_uart; ++i) { - ret =3D ida_alloc_max(&sc16is7xx_lines, - SC16IS7XX_MAX_DEVS - 1, GFP_KERNEL); - if (ret < 0) - goto out_ports; - - s->p[i].port.line =3D ret; - - /* Initialize port data */ s->p[i].port.dev =3D dev; s->p[i].port.irq =3D irq; - s->p[i].port.type =3D PORT_SC16IS7XX; - s->p[i].port.fifosize =3D SC16IS7XX_FIFO_SIZE; - s->p[i].port.flags =3D UPF_FIXED_TYPE | UPF_LOW_LATENCY; - s->p[i].port.iobase =3D i; - /* - * Use all ones as membase to make sure uart_configure_port() in - * serial_core.c does not abort for SPI/I2C devices where the - * membase address is not applicable. - */ - s->p[i].port.membase =3D (void __iomem *)~0; - s->p[i].port.iotype =3D UPIO_PORT; s->p[i].port.uartclk =3D freq; - s->p[i].port.rs485_config =3D sc16is7xx_config_rs485; - s->p[i].port.rs485_supported =3D sc16is7xx_rs485_supported; - s->p[i].port.ops =3D &sc16is7xx_ops; - s->p[i].old_mctrl =3D 0; s->p[i].regmap =3D regmaps[i]; =20 - mutex_init(&s->p[i].lock); - - ret =3D uart_get_rs485_mode(&s->p[i].port); + ret =3D sc16is7xx_setup_channel(&s->p[i], i, &port_registered[i]); if (ret) goto out_ports; - - /* Enable access to general register set */ - sc16is7xx_port_write(&s->p[i].port, SC16IS7XX_LCR_REG, 0x00); - - /* Disable all interrupts */ - sc16is7xx_port_write(&s->p[i].port, SC16IS7XX_IER_REG, 0); - /* Disable TX/RX */ - sc16is7xx_port_write(&s->p[i].port, SC16IS7XX_EFCR_REG, - SC16IS7XX_EFCR_RXDISABLE_BIT | - SC16IS7XX_EFCR_TXDISABLE_BIT); - - /* Initialize kthread work structs */ - kthread_init_work(&s->p[i].tx_work, sc16is7xx_tx_proc); - kthread_init_work(&s->p[i].reg_work, sc16is7xx_reg_proc); - kthread_init_delayed_work(&s->p[i].ms_work, sc16is7xx_ms_proc); - - /* Register port */ - ret =3D uart_add_one_port(&sc16is7xx_uart, &s->p[i].port); - if (ret) - goto out_ports; - - port_registered[i] =3D true; - - sc16is7xx_regs_lock(&s->p[i].port, SC16IS7XX_LCR_REG_SET_ENHANCED); - /* Enable write access to enhanced features */ - sc16is7xx_port_write(&s->p[i].port, SC16IS7XX_EFR_REG, - SC16IS7XX_EFR_ENABLE_BIT); - sc16is7xx_regs_unlock(&s->p[i].port); - - /* Go to suspend mode */ - sc16is7xx_power(&s->p[i].port, 0); } =20 sc16is7xx_setup_irda_ports(s); --=20 2.39.5 From nobody Wed Dec 17 12:19:18 2025 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E72C630E830; Wed, 24 Sep 2025 15:37:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758728283; cv=none; b=iiruuuLk05hAUDtrQeCcQa/qUUa3WlN4Fx8OhG5QRAa0TvMFU4gYalbeMY3H+BIQV/yYXhBRSL8Ixb8iw9ERRNRqQlBGlOk5qOwobY9dzT98FNBhuztP+NWxGl0Wi7mcYAQuyldXxTglnrrOYypce2Z3kbY1oIVzdukNAI6ePGs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758728283; c=relaxed/simple; bh=/59pzaIpo3hxjYrwoqRQB9pU18sg+2ce7TE+GucMtQ4=; h=From:To:Cc:Date:Message-Id:In-Reply-To:References:MIME-Version: Subject; b=ZmlxloSSo81ljd6lJhVnTf/YaWQrs3f+Odg/vGR4yCE1ySYAF3b2E2kKcCHEP4IWA5OTIgzHpuCOj4v0JVy9INVQLJWJqOybO1ZAhCNkFFXDl1o5O6+C9m/LCpc/C4R4F74YZSdUYIxyzwqYpbtFIGAwKYsbgBXTISwqTTc0qv8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=dJlGUf0U; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="dJlGUf0U" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=N0EipVfeJiCRsPTWh7G7K2zw8aa4aDpHL9PXk/Hc5Xg=; b=dJlGUf0UhdoXZ/VF19weBMimb3 qK4AymDpvnffe259uRkL+U48N6ijHwESoirt9oO96v7gikyAxMhfQ1oEbYm0HYHOK9g3dDceXmoWq ePTKwhEkKbpXp9T6BHiW/HHlPGNrKh0HSODPUfRNH1YTWyqEGYRcllUt4rb4VU9XprB0=; Received: from modemcable061.19-161-184.mc.videotron.ca ([184.161.19.61]:51978 helo=localhost.localdomain) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1v1RZ5-0000RT-DW; Wed, 24 Sep 2025 11:37:55 -0400 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, fvallee@eukrea.fr Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve , Geert Uytterhoeven Date: Wed, 24 Sep 2025 11:37:34 -0400 Message-Id: <20250924153740.806444-10-hugo@hugovil.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250924153740.806444-1-hugo@hugovil.com> References: <20250924153740.806444-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 184.161.19.61 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP Subject: [PATCH 09/15] serial: sc16is7xx: Kconfig: allow building with COMPILE_TEST X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Content-Type: text/plain; charset="utf-8" From: Hugo Villeneuve Add COMPILE_TEST as an option to allow test building the driver. Suggested-by: Geert Uytterhoeven Link: https://lore.kernel.org/all/20240604083159.d984dd08741396ea4ca46418@h= ugovil.com/raw Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index 8523ccfb364dd..9a90654dccd78 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig @@ -1044,7 +1044,7 @@ config SERIAL_SCCNXP_CONSOLE =20 config SERIAL_SC16IS7XX tristate "NXP SC16IS7xx UART support" - depends on SPI_MASTER || I2C + depends on SPI_MASTER || I2C || COMPILE_TEST select SERIAL_CORE select SERIAL_SC16IS7XX_SPI if SPI_MASTER select SERIAL_SC16IS7XX_I2C if I2C --=20 2.39.5 From nobody Wed Dec 17 12:19:18 2025 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1CF973002A9; Wed, 24 Sep 2025 15:37:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758728281; cv=none; b=JrluzxmodAt54nORlycO6Qxp7kbRM6PiAIcKLRog5eQ5xpNrrjLRVTC/QWbALOG11Xf/k0+/ClcE/haolujGkkp7hCyJQj3zVY2/sCuNXOOiz5EJx7It+Z1wKFN3oWC0X3VJdbycODNNzGjzMM26owKvxREYIK9W+xggYAJo6As= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758728281; c=relaxed/simple; bh=tHqGA1GDVcSmHIm41vaYG0ksf7PJlfQfkkuq3ezPPh8=; h=From:To:Cc:Date:Message-Id:In-Reply-To:References:MIME-Version: Subject; b=FLhqCKz7E0NTGQg4YErC9sc1WegRxCr6N2lHLugQlfRoIVZtMoLp0Zhsw7FNGyMMg+uxxalvgG1JNCOFuhQ1k/iWGiCjiDlQWzhSQuKmubGU4QYkbOTd3/e5ubXkx2YNmshqDzl+b+7vrIx9VAmQIUMPdF/cWdiXnKX+M/A5RWk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=LSvnmykJ; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="LSvnmykJ" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=iti813zpcSxmyVlX1x5X73HdGQLNLqDsHQY26dzysMw=; b=LSvnmykJVxpi8gfo+CsSK81jME qNm6tCgjNcos6L4WJh6uBZprzmyGPSFESOS6PWEn3Yi61Oldt579J1rmhE4abrXghYnhLY2g0Bar3 zftEj2/BuARhl7Cah3vMuF255nZauhdba3u69/Opg7UlYPAdP22RZzEi6LVNVR0koZXY=; Received: from modemcable061.19-161-184.mc.videotron.ca ([184.161.19.61]:51978 helo=localhost.localdomain) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1v1RZ6-0000RT-PX; Wed, 24 Sep 2025 11:37:57 -0400 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, fvallee@eukrea.fr Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve Date: Wed, 24 Sep 2025 11:37:35 -0400 Message-Id: <20250924153740.806444-11-hugo@hugovil.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250924153740.806444-1-hugo@hugovil.com> References: <20250924153740.806444-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 184.161.19.61 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP Subject: [PATCH 10/15] serial: sc16is7xx: use KBUILD_MODNAME X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Content-Type: text/plain; charset="utf-8" From: Hugo Villeneuve There is no need to redefine the driver name. Use KBUILD_MODNAME and get rid of DRV_NAME altogether. Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 4 ++-- drivers/tty/serial/sc16is7xx.h | 1 - drivers/tty/serial/sc16is7xx_i2c.c | 4 ++-- drivers/tty/serial/sc16is7xx_spi.c | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 406dd7cf81fe3..d1a9fa26e9bdb 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -360,7 +360,7 @@ static DEFINE_IDA(sc16is7xx_lines); =20 static struct uart_driver sc16is7xx_uart =3D { .owner =3D THIS_MODULE, - .driver_name =3D SC16IS7XX_NAME, + .driver_name =3D KBUILD_MODNAME, .dev_name =3D "ttySC", .nr =3D SC16IS7XX_MAX_DEVS, }; @@ -1810,4 +1810,4 @@ module_exit(sc16is7xx_exit); =20 MODULE_LICENSE("GPL"); MODULE_AUTHOR("Jon Ringle "); -MODULE_DESCRIPTION("SC16IS7xx tty serial core driver"); +MODULE_DESCRIPTION(KBUILD_MODNAME " tty serial core driver"); diff --git a/drivers/tty/serial/sc16is7xx.h b/drivers/tty/serial/sc16is7xx.h index afb784eaee45b..9c584d6d35932 100644 --- a/drivers/tty/serial/sc16is7xx.h +++ b/drivers/tty/serial/sc16is7xx.h @@ -8,7 +8,6 @@ #include #include =20 -#define SC16IS7XX_NAME "sc16is7xx" #define SC16IS7XX_MAX_PORTS 2 /* Maximum number of UART ports per IC. */ =20 struct device; diff --git a/drivers/tty/serial/sc16is7xx_i2c.c b/drivers/tty/serial/sc16is= 7xx_i2c.c index cd7de9e057b85..699376c3b3a54 100644 --- a/drivers/tty/serial/sc16is7xx_i2c.c +++ b/drivers/tty/serial/sc16is7xx_i2c.c @@ -52,7 +52,7 @@ MODULE_DEVICE_TABLE(i2c, sc16is7xx_i2c_id_table); =20 static struct i2c_driver sc16is7xx_i2c_driver =3D { .driver =3D { - .name =3D SC16IS7XX_NAME, + .name =3D KBUILD_MODNAME, .of_match_table =3D sc16is7xx_dt_ids, }, .probe =3D sc16is7xx_i2c_probe, @@ -63,5 +63,5 @@ static struct i2c_driver sc16is7xx_i2c_driver =3D { module_i2c_driver(sc16is7xx_i2c_driver); =20 MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("SC16IS7xx I2C interface driver"); +MODULE_DESCRIPTION(KBUILD_MODNAME " interface driver"); MODULE_IMPORT_NS("SERIAL_NXP_SC16IS7XX"); diff --git a/drivers/tty/serial/sc16is7xx_spi.c b/drivers/tty/serial/sc16is= 7xx_spi.c index 20d736b657b17..7e76d0e38da7d 100644 --- a/drivers/tty/serial/sc16is7xx_spi.c +++ b/drivers/tty/serial/sc16is7xx_spi.c @@ -75,7 +75,7 @@ MODULE_DEVICE_TABLE(spi, sc16is7xx_spi_id_table); =20 static struct spi_driver sc16is7xx_spi_driver =3D { .driver =3D { - .name =3D SC16IS7XX_NAME, + .name =3D KBUILD_MODNAME, .of_match_table =3D sc16is7xx_dt_ids, }, .probe =3D sc16is7xx_spi_probe, @@ -86,5 +86,5 @@ static struct spi_driver sc16is7xx_spi_driver =3D { module_spi_driver(sc16is7xx_spi_driver); =20 MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("SC16IS7xx SPI interface driver"); +MODULE_DESCRIPTION(KBUILD_MODNAME " interface driver"); MODULE_IMPORT_NS("SERIAL_NXP_SC16IS7XX"); --=20 2.39.5 From nobody Wed Dec 17 12:19:18 2025 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0B14311C21; Wed, 24 Sep 2025 15:37:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758728281; cv=none; b=cmW+Y/l4V2cUlDhVxrmN3z/mzb9Xk0ZztCKIvuYsy0yDlTe2oucR1xRh0Nuc6ksg8FApsFteCowsm7DU4X+RfQQw5A/4jqQXiQPGj32sWNm46ZnSuBrR94bbZ2mY6VzKcgkNdSHVvEDWp9LNcUSf6KEsJuKbFz8DoTMSsw5a1pI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758728281; c=relaxed/simple; bh=YOxbARnHKi+YR7TPmZakIQ7broJCGgGzgpN+9ltjhnI=; h=From:To:Cc:Date:Message-Id:In-Reply-To:References:MIME-Version: Subject; b=BWO/7CwhftvT8x/FSmhqWVOzmI8L5yMlJzUdt/Nt/mOyJZMangMcv6xRgCriw+AXIRp6hzKUZfT7cAHT8WgTe5hLu2ccQhD8l/A7ZbsjGPiW6VeCp/yJ9USBMoRhyxoJJyNFvKg2x87QhJCzbtsERb359eN6aOFaZUwMUcZ3qE4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=FIBZ7e5c; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="FIBZ7e5c" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=xjNEZuUrgC4c7iseOVbtKtXxfPTu9XyKtO4Uq7U9UnY=; b=FIBZ7e5c7IB9BJaInOHCrt/7my vbKiH1SBSOUXFic7KeTPty/2yquK2JChmE4CdMue0X+kKtBVemnfmvI5V3HSN+6ErDHJuMVfpvu8x 93DFUHTnGyCSSDGqaWK2Eo4F886aSzjE4wIIa8A2/QY2Z2fjb0vWS/GkzFw7qVsbOX4s=; Received: from modemcable061.19-161-184.mc.videotron.ca ([184.161.19.61]:51978 helo=localhost.localdomain) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1v1RZ7-0000RT-Qw; Wed, 24 Sep 2025 11:37:58 -0400 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, fvallee@eukrea.fr Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve Date: Wed, 24 Sep 2025 11:37:36 -0400 Message-Id: <20250924153740.806444-12-hugo@hugovil.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250924153740.806444-1-hugo@hugovil.com> References: <20250924153740.806444-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 184.161.19.61 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP Subject: [PATCH 11/15] serial: sc16is7xx: remove empty line X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Content-Type: text/plain; charset="utf-8" From: Hugo Villeneuve Remove empty line inavertently added in commit d5078509c8b0 ("serial: sc16is7xx: improve do/while loop in sc16is7xx_irq()"). Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index d1a9fa26e9bdb..a05be92f7e776 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -834,7 +834,6 @@ static bool sc16is7xx_port_irq(struct sc16is7xx_port *s= , int portno) static irqreturn_t sc16is7xx_irq(int irq, void *dev_id) { bool keep_polling; - struct sc16is7xx_port *s =3D (struct sc16is7xx_port *)dev_id; =20 do { --=20 2.39.5 From nobody Wed Dec 17 12:19:18 2025 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7F513312812; Wed, 24 Sep 2025 15:38:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758728283; cv=none; b=JzeDKfAf+VWglTJPUTQh7+Tg8byFMya6IhfrSYW279rJwOqBYYTj+3/JV4VYn/NHWh3S1MauuRNQ/ihx7s42ohE79igaS9JkJw8XZg5giaINSdl3ed4uKU9Ml4fYzzPNaWW+cN3/nxzfTuWtGKjNL17gcvkyQDDLh0fV19Larzc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758728283; c=relaxed/simple; bh=EiHkljC9QU3UQx5Q0Xp7xpqJC6W8tI5E/JbkJFZsgFc=; h=From:To:Cc:Date:Message-Id:In-Reply-To:References:MIME-Version: Subject; b=q624XIB1nsbehDwAo8ieqpTL+yZLwO4twa/qLBnHMF8IUOE+TKLIO8hhoHiSlF6C/qbiTuU4vigp2789oE2cy8J7DMax4ZTxEAjzQBK3JI8iUah9SH0pPRBYrBd+TGxi4Wy1jJwQhBAQJzd9V0iYkYwueWdeBEMasvuDGdgdQX0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=yOJGmxMN; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="yOJGmxMN" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=wfqEx0e56u3qVbZT8ZufXWs8gMjtToIcof8Yh3RTjFg=; b=yOJGmxMNGEtMGm1jxhyvUySnta w8D6dcoXaQ5CvheqJuwC0UwCAeRl9PH0cDQLYicrEuWXFW9ljIw6AvrV9Qg+lUGyiBcFS5M4x3fdV tBzmqG2o2pHml4AUbkjGE4CDcedspSxvVUtirBtOWMf1Ej1ILIA99waaRe1OhnIZKdaA=; Received: from modemcable061.19-161-184.mc.videotron.ca ([184.161.19.61]:51978 helo=localhost.localdomain) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1v1RZ8-0000RT-OK; Wed, 24 Sep 2025 11:37:58 -0400 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, fvallee@eukrea.fr Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve Date: Wed, 24 Sep 2025 11:37:37 -0400 Message-Id: <20250924153740.806444-13-hugo@hugovil.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250924153740.806444-1-hugo@hugovil.com> References: <20250924153740.806444-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 184.161.19.61 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP Subject: [PATCH 12/15] serial: sc16is7xx: add missing space between macro args (checkpatch) X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Content-Type: text/plain; charset="utf-8" From: Hugo Villeneuve Fix the following checkpatch error: ERROR: space required after that ',' (ctx:VxV) +#define to_sc16is7xx_one(p,e)... Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index a05be92f7e776..9d04d665ec9ab 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -365,7 +365,7 @@ static struct uart_driver sc16is7xx_uart =3D { .nr =3D SC16IS7XX_MAX_DEVS, }; =20 -#define to_sc16is7xx_one(p,e) ((container_of((p), struct sc16is7xx_one, e)= )) +#define to_sc16is7xx_one(p, e) ((container_of((p), struct sc16is7xx_one, e= ))) =20 static u8 sc16is7xx_port_read(struct uart_port *port, u8 reg) { --=20 2.39.5 From nobody Wed Dec 17 12:19:18 2025 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F5D43128C4; Wed, 24 Sep 2025 15:38:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758728283; cv=none; b=RyFDrTWdMvGWVcO2joxItyK/RTjk10pkXa6+sz/uZandWBU5gD3tjVddor6wrzuaa1pcWIERyEBM3qxKEkFNPy+FtkIux20olEk55BZEDejcMmcPacstAznmAw4t4CXYG+b/Ul7qvzOtaBqtMoYKoMKpb5OvLnrJ8I5wPlZbNhI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758728283; c=relaxed/simple; bh=N7We2kb2VuhXFVH+zyKTRWZpX4UXSxbXlzPJw38tSx4=; h=From:To:Cc:Date:Message-Id:In-Reply-To:References:MIME-Version: Subject; b=IjAt1fRlFnRBe/dx0izJWfi2053jo8DRGrcM630xw1iBDFiVlAdIUQEdMFofZicyVL9bLuNqUAQehjL6RJsIGXOkvoPi2aHTn9nt4WB3PMpYNKu4kjoLCwhE38GyeeXypw+HSFxwM6PPKAM7Me6AKhMUkw8E/w2airUTq4T6Hlg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=eX0Dmqgg; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="eX0Dmqgg" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=RwrrQfNlnhkN7H5MSrcN8Hn+U5qwYA1ZOtzfaRM276I=; b=eX0DmqggDrBG4COUNoyzDI0NSd VjX5lrUn5EqvOVUUPeSHIs4MM000HL3roB/qNxpfq6zjjKjHo1HqKoy5En6V3K+FqLCI0zQgb15EM Ti37F+vS7OceqNzBRAjJCDW05dsN1TZbotN01JnNvTZMkedI1qsU53q0gMXfcVoJILG4=; Received: from modemcable061.19-161-184.mc.videotron.ca ([184.161.19.61]:51978 helo=localhost.localdomain) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1v1RZ9-0000RT-HI; Wed, 24 Sep 2025 11:37:59 -0400 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, fvallee@eukrea.fr Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve Date: Wed, 24 Sep 2025 11:37:38 -0400 Message-Id: <20250924153740.806444-14-hugo@hugovil.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250924153740.806444-1-hugo@hugovil.com> References: <20250924153740.806444-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 184.161.19.61 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP Subject: [PATCH 13/15] serial: sc16is7xx: change incorrect indentation X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Content-Type: text/plain; charset="utf-8" From: Hugo Villeneuve Change incorrect indentation level introduced in commit 9eb90d57b55a ("sc16is7xx: Add flag to activate IrDA mode"). Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 9d04d665ec9ab..31d43fc857187 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -1181,7 +1181,7 @@ static int sc16is7xx_startup(struct uart_port *port) sc16is7xx_port_update(port, SC16IS7XX_MCR_REG, SC16IS7XX_MCR_IRDA_BIT, one->irda_mode ? - SC16IS7XX_MCR_IRDA_BIT : 0); + SC16IS7XX_MCR_IRDA_BIT : 0); =20 /* Enable the Rx and Tx FIFO */ sc16is7xx_port_update(port, SC16IS7XX_EFCR_REG, --=20 2.39.5 From nobody Wed Dec 17 12:19:18 2025 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 451E531354A; Wed, 24 Sep 2025 15:38:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758728284; cv=none; b=cjjrHaQsBoLSSyk1E73ECCsPSr1ebwEd2Bc9wBWLEPUiRWvQnqpKeXZDUMMBqHGRaEtbRLQb+SYXEB6wMxfoMJ/IkD37OCPQoRPIPMYzcgxB3iY78VzKWj4Hi7GfAT0QZyWBJiHOfJJIITUeS3GfhOb/zdl0XS8FLr6CwMrrlyA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758728284; c=relaxed/simple; bh=SQ4z9EPm96qEBIOicpn/DdoWhzOW5wag7UA6am4b/4I=; h=From:To:Cc:Date:Message-Id:In-Reply-To:References:MIME-Version: Subject; b=OJ5WHVjv9LEjg2P/0iTAIXsJJp2DUAwd13cZOBhTvVg7sUu1taQmgkQUxku2rGLaaY34dBvkbReylIjcptN+YsF2rM8T3OI+Y8I2seg5MMIWvKAUBJMCX6flUtPicE9PObkYyjcwhhZj/XjIV9FpbhOmflYr0CuEqyfMH+1onQM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=p6Z8v25R; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="p6Z8v25R" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=Qd+syP+sQg2giLSEgfszdvf82H1TmQUOBeAKHYRGVLw=; b=p6Z8v25R4oJ3RfU3LFhMPgVvcg cP4sVgsorC2ES9w+VV7mJywnKt9kI+FOpTItCW79tAPwbJe4Qgv6tgaX6kWvqMtKfbbHIH0Gg/nPm 65mi5/ApbF85OUU3u+hjP0T0n5uASAxxIEE/qKn4aRKC8ZjcrGJhDGGbkyblIksN1jrQ=; Received: from modemcable061.19-161-184.mc.videotron.ca ([184.161.19.61]:51978 helo=localhost.localdomain) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1v1RZA-0000RT-E3; Wed, 24 Sep 2025 11:38:00 -0400 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, fvallee@eukrea.fr Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve Date: Wed, 24 Sep 2025 11:37:39 -0400 Message-Id: <20250924153740.806444-15-hugo@hugovil.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250924153740.806444-1-hugo@hugovil.com> References: <20250924153740.806444-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 184.161.19.61 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP Subject: [PATCH 14/15] serial: sc16is7xx: reformat comments X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Content-Type: text/plain; charset="utf-8" From: Hugo Villeneuve Add missing space at end of comments and reformat to have uniform style. Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 31d43fc857187..b3fbe9459303a 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -81,11 +81,14 @@ /* IER register bits */ #define SC16IS7XX_IER_RDI_BIT BIT(0) /* Enable RX data interrupt */ #define SC16IS7XX_IER_THRI_BIT BIT(1) /* Enable TX holding register - * interrupt */ + * interrupt + */ #define SC16IS7XX_IER_RLSI_BIT BIT(2) /* Enable RX line status - * interrupt */ + * interrupt + */ #define SC16IS7XX_IER_MSI_BIT BIT(3) /* Enable Modem status - * interrupt */ + * interrupt + */ =20 /* IER register bits - write only if (EFR[4] =3D=3D 1) */ #define SC16IS7XX_IER_SLEEP_BIT BIT(4) /* Enable Sleep mode */ @@ -255,7 +258,8 @@ =20 /* EFCR register bits */ #define SC16IS7XX_EFCR_9BIT_MODE_BIT BIT(0) /* Enable 9-bit or Multidrop - * mode (RS485) */ + * mode (RS485) + */ #define SC16IS7XX_EFCR_RXDISABLE_BIT BIT(1) /* Disable receiver */ #define SC16IS7XX_EFCR_TXDISABLE_BIT BIT(2) /* Disable transmitter */ #define SC16IS7XX_EFCR_AUTO_RS485_BIT BIT(4) /* Auto RS485 RTS direction= */ @@ -1152,7 +1156,7 @@ static int sc16is7xx_startup(struct uart_port *port) =20 sc16is7xx_power(port, 1); =20 - /* Reset FIFOs*/ + /* Reset FIFOs */ val =3D SC16IS7XX_FCR_RXRESET_BIT | SC16IS7XX_FCR_TXRESET_BIT; sc16is7xx_port_write(port, SC16IS7XX_FCR_REG, val); udelay(5); --=20 2.39.5 From nobody Wed Dec 17 12:19:18 2025 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 082593148AF; Wed, 24 Sep 2025 15:38:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758728285; cv=none; b=crO5MX4ZVhgxN4GuUUqKTXC4autEJIacc5VNdkHKrGii8YP7Cf/vbSM0ZWocYs8pcTk40oRc3Uz08CKLP3WtXBXaN3EIMifhLS7J3lhhJgvJtA6KRfyoBbCI22a/XGZoVdWRnIlYvtfJXAFxR31niuep9uatMQa5UQLjQkZwhwU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758728285; c=relaxed/simple; bh=YbWJgC67kyN9zpskAusizW5T9F9lBZcWEV+qLGl9EwI=; h=From:To:Cc:Date:Message-Id:In-Reply-To:References:MIME-Version: Subject; b=rvLLKCnsk6z8ssVnE5OGkXkMvC0yhzaEZXZb1ICrqXnqU5EmHhdw6x6H3n5C5iLTkAEa3jyY04g/YGm13gV/d2HwBeb38G8ygx5x7+tvZA0gllBVlciCs6delnF/E8jgjSymstlXBO2KI3WJqWB1l528VGFTY/lgAITXd+DLHfc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=rwXZ522d; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="rwXZ522d" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=uSpLHXat2jMGBVLTbF5QQfMKAVtoAVNqQ3YP6QhxNYc=; b=rwXZ522deZwQlLT3/mc86qVPkS GNLeAATsU16xcQMYVHymgJc2HTt4Uj6p/ZnoRExZcdEAzBu5ZRw1/9tRRldpaMIUaGNfZ9h/2aPaM O40QG6Wg4OANldXqvPwcXsogxTeGpUkHjbQwzJkeJ0n8s7lPJDtE/rbiAYJdOYxBDFvc=; Received: from modemcable061.19-161-184.mc.videotron.ca ([184.161.19.61]:51978 helo=localhost.localdomain) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1v1RZB-0000RT-7O; Wed, 24 Sep 2025 11:38:01 -0400 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, fvallee@eukrea.fr Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve Date: Wed, 24 Sep 2025 11:37:40 -0400 Message-Id: <20250924153740.806444-16-hugo@hugovil.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250924153740.806444-1-hugo@hugovil.com> References: <20250924153740.806444-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 184.161.19.61 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP Subject: [PATCH 15/15] serial: sc16is7xx: add/improve comments X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Content-Type: text/plain; charset="utf-8" From: Hugo Villeneuve Indicate why lock needs to be asserted when accessing MSR register, as this is not immediately obvious when looking at this register in the device datasheet. Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index b3fbe9459303a..09f03edf0e5cb 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -164,7 +164,7 @@ * - only on 75x/76x */ #define SC16IS7XX_MCR_RTS_BIT BIT(1) /* RTS complement */ -#define SC16IS7XX_MCR_TCRTLR_BIT BIT(2) /* TCR/TLR register enable */ +#define SC16IS7XX_MCR_TCRTLR_BIT BIT(2) /* TCR/TLR registers enable */ #define SC16IS7XX_MCR_LOOP_BIT BIT(4) /* Enable loopback test mode */ #define SC16IS7XX_MCR_XONANY_BIT BIT(5) /* Enable Xon Any * - write enabled @@ -545,10 +545,10 @@ EXPORT_SYMBOL_GPL(sc16is762_devtype); static bool sc16is7xx_regmap_volatile(struct device *dev, unsigned int reg) { switch (reg) { - case SC16IS7XX_RHR_REG: - case SC16IS7XX_IIR_REG: - case SC16IS7XX_LSR_REG: - case SC16IS7XX_MSR_REG: + case SC16IS7XX_RHR_REG: /* Shared address space with THR & DLL */ + case SC16IS7XX_IIR_REG: /* Shared address space with FCR & EFR */ + case SC16IS7XX_LSR_REG: /* Shared address space with XON2 */ + case SC16IS7XX_MSR_REG: /* Shared address space with TCR & XOFF1 */ case SC16IS7XX_SPR_REG: /* Shared address space with TLR & XOFF2 */ case SC16IS7XX_TXLVL_REG: case SC16IS7XX_RXLVL_REG: @@ -757,6 +757,7 @@ static void sc16is7xx_update_mlines(struct sc16is7xx_on= e *one) unsigned long flags; unsigned int status, changed; =20 + /* Lock required as MSR address is shared with TCR and XOFF1. */ lockdep_assert_held_once(&one->lock); =20 status =3D sc16is7xx_get_hwmctrl(port); --=20 2.39.5