Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1860464lqp; Mon, 15 Apr 2024 22:48:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXh8gkHcj9mzpQla5vSF2xlIs2DR4XQ/RPaxxr7WFDiDDapeF+UjwvlncJiR7Yl80J4qb7dXh8Q4Z8wxu0/lwXXrcUft0t/QkJRfP3OvQ== X-Google-Smtp-Source: AGHT+IErGD4rF5GedzWYLdBaRZig6RnE+PGT6aHzfJUPq7p7MAMFH0yAX00UGYBq/C45HHRFbDJY X-Received: by 2002:a05:620a:450f:b0:78b:ea82:5eb4 with SMTP id t15-20020a05620a450f00b0078bea825eb4mr2854299qkp.25.1713246520509; Mon, 15 Apr 2024 22:48:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713246520; cv=pass; d=google.com; s=arc-20160816; b=Iio+0rWZT3+HKyh8xXUibgRMhjE+KGqur/egRIlBsONhugYy8YUGpkM7j43f7/1gzY KtqlxQAguXexTYUdRQoE5LwyjkDbQ40HgxGLplBnQfMLeQJ2/alh4G0SzwCBmoGwdbVe nKvw3BBIzfS9ZNA98MlJKn3xqqFoVpA6b1ZxlASQ2lGP68LCnT1P0sfAJWVizIQ1WsWJ g6bbvWpMGUkBIjvEJt7EoXx3qC2bZ4QsQM4dp6bQtBa4TbTjltu3mGvEb9FGfcGIErCe WYM0KFZhCxOwXj8P7yJ6iVxQCx7JhU8FoshiZtSFJh2vGmA4theZeqRCZ5kuN++WXSxr Uojw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ikpDg+fAABWxQhsKMGZ/dGRZkMn+FRrhxiXK4v8QwCs=; fh=GfSU5s7znTqDmr7z9H/UsIC8nWsjsR3rYcWIPBTzm/s=; b=sudGWh3m0AJD1nFrkCnXxdyYzKVg6zgekhBMSbJs/DzVPW96gLUnSpkUR6In/QPg0a Y5hXZtcuP94pL6rG3vkgRaHwgt6alb74SNJKD1nEYs4lJQMj0QgacQXImn1C6tmzbjar FX70VrSbbQWplbcdrb7a/o0nLqZfayK4kXGc1Cz4Km26VPVv62s2krl9CXzXuvNzMJHo BiKQ+fDt6O16fs3Q5XI/I2qfkhEjJ6SF/UnwgfUrFM+xmmrnogdj6Emt7MVbwrUC4BhI kTxmucqOY2Q9f3UlA1o7u5Xgi4wPugzVK9yNCiUakaPOUYgLQpVFWx06Rrp1mIenphPz AICQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZbER8nYL; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-146288-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146288-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id w23-20020a05620a095700b0078d66ffcb03si11636920qkw.263.2024.04.15.22.48.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 22:48:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-146288-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZbER8nYL; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-146288-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146288-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 3628E1C21141 for ; Tue, 16 Apr 2024 05:48:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8544A3BB27; Tue, 16 Apr 2024 05:48:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZbER8nYL" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8B7A3539C; Tue, 16 Apr 2024 05:48:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713246512; cv=none; b=Tw48Rx4DFH3FliS4a4gpTNYknqT3ynBp3ZLz1DUNv10aW3v/oh+TOZPhSRb3q2fCUqjoinSbNqQsikTjPkxREIUJAY6WQoYlzjXiHEB66Dl4y4cU+3js0n7a2uEF7R+k/cESXArkBAuTI9lSASL7VimRHWNmY7rr/h0e8EhSVW8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713246512; c=relaxed/simple; bh=TenS7osWv9s/9Jh6uxGzY8R47mJAGgM3ek3C2c2/Yho=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EQrv0sLJXvc6xCDy6cBgiJRFEzmjokfbCFl80B/qDP0pkSgRhC4k0cOqQwt3mlDui8etkZr1zi5nM6QoLeAfygQaKx7LYBWfIexdGSIseWnvzQTPZO679a+tS38o4YTiDe5hPjl16cKvUa0t4qp1GCzWaCYp/VGvQqYFFVKJAig= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZbER8nYL; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EC4AC113CE; Tue, 16 Apr 2024 05:48:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713246510; bh=TenS7osWv9s/9Jh6uxGzY8R47mJAGgM3ek3C2c2/Yho=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZbER8nYLUIIjS30NXjJqeds3Ul9G382K+Go27g16/LkqOliUU2PcQbgsZ7IwVvPQB AvpNaz1cli8oqhHZWJJnULv7FWqPsLzHGW/ntcCQTkCP87G4atKjmkVRZok/QHp07I R65Of2LEoRmDC0O/0gSeiMm7/PJUX0jIikO6fvjaVMeXb0oD2UZxMBacBGXuPpGOL/ XuKWsqTFXsNO6SESO2ZjELkmC2A0GgsJCCRtO42v0FglZEN7LSM8VhPfrPDOj98Viy Ikxqi9XqxbXNGjNGLvnL536ZmKVPxi+imFyZWeeLasK+K2+Jz2Qs+Fpd6WihkgMQt3 yJGntA62YB6Rg== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Marek Szyprowski , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-arm-msm@vger.kernel.org Subject: [PATCH] serial: meson+qcom: don't advance the kfifo twice Date: Tue, 16 Apr 2024 07:48:25 +0200 Message-ID: <20240416054825.6211-1-jirislaby@kernel.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <1dd9e3a1-29d0-4628-9b6a-b7e9fc09bf0f@samsung.com> References: <1dd9e3a1-29d0-4628-9b6a-b7e9fc09bf0f@samsung.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Marek reports, that the -next commit 1788cf6a91d9 (tty: serial: switch from circ_buf to kfifo) broke meson_uart and qcom_geni_serial. The commit mistakenly advanced the kfifo twice: once by uart_fifo_get()/kfifo_out() and second time by uart_xmit_advance(). To advance the fifo only once, drop the superfluous uart_xmit_advance() from both. To count the TX statistics properly, use uart_fifo_out() in qcom_geni_serial (meson_uart_start_tx() already uses that). I checked all other uses of uart_xmit_advance() and they appear correct: either they are finishing DMA transfers or are after peek/linear_ptr (i.e. they do not advance fifo). Signed-off-by: Jiri Slaby (SUSE) Reported-by: Marek Szyprowski Cc: Neil Armstrong Cc: Kevin Hilman Cc: Jerome Brunet Cc: Martin Blumenstingl --- Cc: linux-arm-kernel@lists.infradead.org Cc: linux-amlogic@lists.infradead.org Cc: linux-arm-msm@vger.kernel.org --- drivers/tty/serial/meson_uart.c | 1 - drivers/tty/serial/qcom_geni_serial.c | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c index 4587ed4d4d5d..8eb586ac3b0d 100644 --- a/drivers/tty/serial/meson_uart.c +++ b/drivers/tty/serial/meson_uart.c @@ -162,7 +162,6 @@ static void meson_uart_start_tx(struct uart_port *port) break; writel(ch, port->membase + AML_UART_WFIFO); - uart_xmit_advance(port, 1); } if (!kfifo_is_empty(&tport->xmit_fifo)) { diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 7814982f1921..2bd25afe0d92 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -855,7 +855,6 @@ static void qcom_geni_serial_send_chunk_fifo(struct uart_port *uport, unsigned int chunk) { struct qcom_geni_serial_port *port = to_dev_port(uport); - struct tty_port *tport = &uport->state->port; unsigned int tx_bytes, remaining = chunk; u8 buf[BYTES_PER_FIFO_WORD]; @@ -863,8 +862,7 @@ static void qcom_geni_serial_send_chunk_fifo(struct uart_port *uport, memset(buf, 0, sizeof(buf)); tx_bytes = min(remaining, BYTES_PER_FIFO_WORD); - tx_bytes = kfifo_out(&tport->xmit_fifo, buf, tx_bytes); - uart_xmit_advance(uport, tx_bytes); + tx_bytes = uart_fifo_out(uport, buf, tx_bytes); iowrite32_rep(uport->membase + SE_GENI_TX_FIFOn, buf, 1); -- 2.44.0