From patchwork Thu Dec 21 23:18:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 182481 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp743668dyi; Thu, 21 Dec 2023 15:22:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IF16LT9/woIhqy70RQLL7exEukGRYZq0EKJ2Tuup163lXDZQacbiUvkwe6ZGjQGZx7nL+AZ X-Received: by 2002:a17:906:8a49:b0:a26:9584:49d0 with SMTP id gx9-20020a1709068a4900b00a26958449d0mr285479ejc.105.1703200952978; Thu, 21 Dec 2023 15:22:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703200952; cv=none; d=google.com; s=arc-20160816; b=NJUOOMRtlxJAVa7dDptn8HsHpYc6VtX+6w63cEyUknjmwMQ8XNnN8O4G+CaOIb/Ka2 r70+37XLL2tvCSg8oprK2wUGe4j2Q0Hu+UtT+8I5fJEk/r5X0tFdJpELB6/bwivF/CF/ xd9DFw2UCAEuJWq3y2kP8NoMkW7sTSTucH3k8qrMomtCgOjW8KZOyfhzplLcWOKjRh1F h86Hafv9UzmoAXqEjX4oPlhzuYUqbcPYBDUMWEwB0MZJTcj7Gz2MKPtjWNRqvGVkH6C8 3OVlTzFH2onSrjEzWUW0If4/aM2Lmh/qnOXn68eC4hKfElaHIXOtTvtoyk+XilcPgZj1 J7yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:cc:to:from:dkim-signature; bh=O33SuElMyMhi7Xm2MmazMXI7ODmF5cXxahS2czWEZzU=; fh=Ycbn6ef12HpHqEFiWziTSDbqSWr2f8qbHtf8sJuk8ZI=; b=nzP41BSDtawDdiyQAkA4DRVktfBRaYuVhjw0tVz9XsCiKrHJqKSUex7maUbYGabSEr vIUysOQC+JdRGqJ63W+Aotd1XzLSw45CwcjhW/vLCuLrGZLXdED0R00p9XxKZrZbTqgk eN1JsKJig9KQKc72XaUManVOKXcqlbTO96dfVqbowvTJXVW3HSDK3/YwQenoAwaVd4g6 q33dKoksojuHa6ca5xxR629xefIEL5UaNAdIAsvKdpQDIMWkrpumAGAIrPVJyj13YzRO qpKlx5F4om22gmnsaUrm5g0sv0lubrWGuy8UB2pvbQsSRfEgJYXM8u6nZVm0R0pR3n8U qExw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=GPwbhRva; spf=pass (google.com: domain of linux-kernel+bounces-9170-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9170-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id l16-20020a170906079000b00a236414d522si1321517ejc.489.2023.12.21.15.22.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 15:22:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9170-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=GPwbhRva; spf=pass (google.com: domain of linux-kernel+bounces-9170-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9170-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 989681F2289E for ; Thu, 21 Dec 2023 23:22:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B10FC7D8B6; Thu, 21 Dec 2023 23:18:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="GPwbhRva" X-Original-To: linux-kernel@vger.kernel.org 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 B0D507B3A5; Thu, 21 Dec 2023 23:18:53 +0000 (UTC) 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 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=O33SuElMyMhi7Xm2MmazMXI7ODmF5cXxahS2czWEZzU=; b=GPwbhRvaUzMuoWnaZkDd7JvGNZ 29SV8uLnekInKZ3LQvCrFUKzqmiiJyhbUEKWqGvIhs6wxlLHBD4CVfWx4QFckTczqxTTV+NEI6zui sJgh2DBE7TBt64hkbIT83h+2VMStSL7sL5adGywKiSCc3MAdKDTJ83bVDc+j8AAjugro=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:52484 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rGSJU-00025W-Ue; Thu, 21 Dec 2023 18:18:49 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, kubakici@wp.pl, indrakanti_ram@hotmail.com, phil@raspberrypi.org Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve Date: Thu, 21 Dec 2023 18:18:21 -0500 Message-Id: <20231221231823.2327894-15-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231221231823.2327894-1-hugo@hugovil.com> References: <20231221231823.2327894-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 70.80.174.168 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 * -0.0 T_SCC_BODY_TEXT_LINE No description available. Subject: [PATCH v2 14/16] serial: sc16is7xx: refactor FIFO access functions to increase commonality 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) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785935642424799293 X-GMAIL-MSGID: 1785935642424799293 From: Hugo Villeneuve Simplify FIFO access functions by avoiding to declare a struct sc16is7xx_port *s variable within each function. This is mainly done to have more commonality between the max310x and sc16is7xx drivers. Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 1037a2802360..26bc595a6ca7 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -379,17 +379,15 @@ static void sc16is7xx_port_write(struct uart_port *port, u8 reg, u8 val) regmap_write(one->regmap, reg, val); } -static void sc16is7xx_fifo_read(struct uart_port *port, unsigned int rxlen) +static void sc16is7xx_fifo_read(struct uart_port *port, u8 *rxbuf, unsigned int rxlen) { - struct sc16is7xx_port *s = dev_get_drvdata(port->dev); struct sc16is7xx_one *one = to_sc16is7xx_one(port, port); - regmap_noinc_read(one->regmap, SC16IS7XX_RHR_REG, s->buf, rxlen); + regmap_noinc_read(one->regmap, SC16IS7XX_RHR_REG, rxbuf, rxlen); } -static void sc16is7xx_fifo_write(struct uart_port *port, u8 to_send) +static void sc16is7xx_fifo_write(struct uart_port *port, u8 *txbuf, u8 to_send) { - struct sc16is7xx_port *s = dev_get_drvdata(port->dev); struct sc16is7xx_one *one = to_sc16is7xx_one(port, port); /* @@ -399,7 +397,7 @@ static void sc16is7xx_fifo_write(struct uart_port *port, u8 to_send) if (unlikely(!to_send)) return; - regmap_noinc_write(one->regmap, SC16IS7XX_THR_REG, s->buf, to_send); + regmap_noinc_write(one->regmap, SC16IS7XX_THR_REG, txbuf, to_send); } static void sc16is7xx_port_update(struct uart_port *port, u8 reg, @@ -575,7 +573,7 @@ static void sc16is7xx_handle_rx(struct uart_port *port, unsigned int rxlen, s->buf[0] = sc16is7xx_port_read(port, SC16IS7XX_RHR_REG); bytes_read = 1; } else { - sc16is7xx_fifo_read(port, rxlen); + sc16is7xx_fifo_read(port, s->buf, rxlen); bytes_read = rxlen; } @@ -664,7 +662,7 @@ static void sc16is7xx_handle_tx(struct uart_port *port) uart_xmit_advance(port, 1); } - sc16is7xx_fifo_write(port, to_send); + sc16is7xx_fifo_write(port, s->buf, to_send); } uart_port_lock_irqsave(port, &flags);