Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp499866lqp; Thu, 4 Apr 2024 23:08:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVX6kqsLknLMOkZm7XqKn6u9BRkomKYQHkNV9cLGi7cnZ2fKPKR1gOAW11/GDbgTKwu9jJKvLXv36uzZ+NoqnOQt3nG/3fCnpv8XhkauA== X-Google-Smtp-Source: AGHT+IEQhEyhHgdjLdJdkQx3wTtMnGUc/pZCzZp/0lakuCAJMDRGHhKqDrIpAzYS5aisu09VZEcB X-Received: by 2002:a05:6a00:2283:b0:6ec:f5cf:2bb1 with SMTP id f3-20020a056a00228300b006ecf5cf2bb1mr685379pfe.6.1712297328335; Thu, 04 Apr 2024 23:08:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712297328; cv=pass; d=google.com; s=arc-20160816; b=ACRCbcS93zN4p3S4Ni0zNinEYQ2rV0UTUtvAWleH1DRz2hbHLrxe0MaOMvOUx1nAt7 4ez68rZ+XC+r/lrY5hB9LrrqeigyDHHoZwDhV8tmEff5K7hFBCcSUOKps7vysEAQpCul pEgNQ1XKCV21Wp2s5qiVKE82fiVfvRekOtPcoRG8G0nTtL6ZhnaUloaXK+Nw6mkiqb9t SZYC4Q8bM1tfJK274CFeb3kcbA9zPezkEzaWek8icw97LYDH3aR7kfmSopae6wYvSi0+ KyVuvSi5fH/5y8k0VmkevTVp6sEMbxLHN2VBYNUSuIXdY/gDnmTp1ISBM1Q1GVdTIDZn CDhA== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=b/IFmWZLS/nHbF1G89zcS3BzcSvamn393lVgXh8ku0Y=; fh=SS+PZn3t70Ky3y2RrdKci9PK27wsHc1ziIJgDIjx/Aw=; b=NuO9hkCxi0hYaJ7F/nhJX6sKrpTQ1TjCRdvYxc0O0MiN3hhahZ+01EOuDKj0gWGn5G W/jdLtSF6fy0Tw7KuCZ/MVMOLm3nQVnTz5FgMW+QR1CCVSjITpADNfkDYdJ1UBWHBBhP ojmOfzASLOWYhM0ux2KC+9CwHEyjyyTiod5nmUh2La6Y5FfpU/1dKdSI3ln4diZw2PjX T3TYZQi2SnKBgChb48ygmYpAqQhIt2vtM2JjZNJr6iruJzk587lswF+FDRsIi6cFlRjo rAXQhWho/CbAzn+tM+XWGTnpFVpNLA1+y2YNRANETaovP5bj0Es8f+0dzFdSkdsthf10 q5ag==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gpGfKh6n; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-132436-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132436-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id lb8-20020a056a004f0800b006e69b4fa495si794264pfb.175.2024.04.04.23.08.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 23:08:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-132436-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gpGfKh6n; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-132436-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132436-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id EC653285636 for ; Fri, 5 Apr 2024 06:08:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 713482262B; Fri, 5 Apr 2024 06:08:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gpGfKh6n" 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 499271EB2B; Fri, 5 Apr 2024 06:08:39 +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=1712297319; cv=none; b=PeSTkjlIbXAb9P3gup/1+F9WfW+n5FsTtKhjOo3IAYc9RAiRlgK/N9gG+OxXBzRgOtrfOADp7cHN6BJ+fPAeIJ2ZxjMVy4EB95upu9brdn0Y1Y59rk8DaJRGFsloaUGvjMPaSfC5lnSZsAecZYGzNNWO97+njFu0UOE5GIy2ANI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712297319; c=relaxed/simple; bh=3a2D8FLQ+zRKWr+dT+h2iE0Z2sanm7uNODeFnm2l0+Y=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=BZqJI5J8BfqGhXCWnjpQbma41TgAAp+qYteLANOYl3MPvvqVp5R2wo0G8IaRK86Wph9ucVJSlMVp6t2BJ7uzwiqZENiCNvS8wkYyLzLkD0tia+i5zbtJNwcizpcny9tm1DTCk/SBgbzNKv/bIYAlg0e0a2gurBqRPOLIFSIC/3c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gpGfKh6n; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AEF8C433F1; Fri, 5 Apr 2024 06:08:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712297319; bh=3a2D8FLQ+zRKWr+dT+h2iE0Z2sanm7uNODeFnm2l0+Y=; h=From:To:Cc:Subject:Date:From; b=gpGfKh6nDc7tcL07n3W/XO8V28YegkSc6XbhqFudjoYAoEcSCW65UXjShFQohkTxJ NkiOqw/nDvbB/7Wp8V++4rR754zLEnQCcGMJRDCQZkS6sXlochANSJ2qkSpvu3MJ8f y4pEho6HNQUYBnegAqqNlAWtWmwqqthP7t4QvOrj9dvOwHufEauqpiADXvX44F5c0y ++d/E1f7AGfsF1/fvL7o4l72BK0/4NRsWrn9Ypb09dKMMkBEfhBmAElQHZArl2523F A9gXXuQqCULLb5f/umebextqlEBfVsOgazcNMvjXfsBfITmLHpDWCKZMxCYz9u2VDC py2I1SMgou3Pw== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Al Cooper , Alexander Shiyan , Alexandre Belloni , Alexandre Torgue , Alim Akhtar , Andrew Morton , "Aneesh Kumar K.V" , AngeloGioacchino Del Regno , Baolin Wang , Baruch Siach , Bjorn Andersson , Claudiu Beznea , "David S. Miller" , Fabio Estevam , Hammer Hsieh , =?UTF-8?q?Christian=20K=C3=B6nig?= , Christophe Leroy , Chunyan Zhang , Jerome Brunet , Jonathan Hunter , Kevin Hilman , Konrad Dybcio , Krzysztof Kozlowski , Kumaravel Thiagarajan , Laxman Dewangan , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, "Maciej W. Rozycki" , Manivannan Sadhasivam , Martin Blumenstingl , Matthias Brugger , Maxime Coquelin , Michael Ellerman , Michal Simek , "Naveen N. Rao" , Neil Armstrong , Nicolas Ferre , Nicholas Piggin , Orson Zhai , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Patrice Chotard , Peter Korsgaard , Richard Genoud , Russell King , Sascha Hauer , Shawn Guo , Stefani Seibold , Sumit Semwal , Taichi Sugaya , Takao Orito , Tharun Kumar P , Thierry Reding , Timur Tabi , Vineet Gupta Subject: [PATCH 00/15] tty: serial: switch from circ_buf to kfifo Date: Fri, 5 Apr 2024 08:08:11 +0200 Message-ID: <20240405060826.2521-1-jirislaby@kernel.org> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This series switches tty serial layer to use kfifo instead of circ_buf. The reasoning can be found in the switching patch in this series: """ Switch from struct circ_buf to proper kfifo. kfifo provides much better API, esp. when wrap-around of the buffer needs to be taken into account. Look at pl011_dma_tx_refill() or cpm_uart_tx_pump() changes for example. Kfifo API can also fill in scatter-gather DMA structures, so it easier for that use case too. Look at lpuart_dma_tx() for example. Note that not all drivers can be converted to that (like atmel_serial), they handle DMA specially. Note that usb-serial uses kfifo for TX for ages. """ Cc: Al Cooper Cc: Alexander Shiyan Cc: Alexandre Belloni Cc: Alexandre Torgue Cc: Alim Akhtar Cc: Andrew Morton Cc: "Aneesh Kumar K.V" Cc: AngeloGioacchino Del Regno Cc: Baolin Wang Cc: Baruch Siach Cc: Bjorn Andersson Cc: Claudiu Beznea Cc: "David S. Miller" Cc: Fabio Estevam Cc: Hammer Hsieh Cc: "Christian König" Cc: Christophe Leroy Cc: Chunyan Zhang Cc: Jerome Brunet Cc: Jonathan Hunter Cc: Kevin Hilman Cc: Konrad Dybcio Cc: Krzysztof Kozlowski Cc: Kumaravel Thiagarajan Cc: Laxman Dewangan Cc: linux-arm-kernel@lists.infradead.org Cc: linux-arm-msm@vger.kernel.org Cc: "Maciej W. Rozycki" Cc: Manivannan Sadhasivam Cc: Martin Blumenstingl Cc: Matthias Brugger Cc: Maxime Coquelin Cc: Michael Ellerman Cc: Michal Simek Cc: "Naveen N. Rao" Cc: Neil Armstrong Cc: Nicolas Ferre Cc: Nicholas Piggin Cc: Orson Zhai Cc: "Pali Rohár" Cc: Patrice Chotard Cc: Peter Korsgaard Cc: Richard Genoud Cc: Russell King Cc: Sascha Hauer Cc: Shawn Guo Cc: Stefani Seibold Cc: Sumit Semwal Cc: Taichi Sugaya Cc: Takao Orito Cc: Tharun Kumar P Cc: Thierry Reding Cc: Timur Tabi Cc: Vineet Gupta Jiri Slaby (SUSE) (15): kfifo: drop __kfifo_dma_out_finish_r() kfifo: introduce and use kfifo_skip_count() kfifo: add kfifo_out_linear{,_ptr}() kfifo: remove support for physically non-contiguous memory kfifo: rename l to len_to_end in setup_sgl() kfifo: pass offset to setup_sgl_buf() instead of a pointer kfifo: add kfifo_dma_out_prepare_mapped() kfifo: fix typos in kernel-doc tty: 8250_dma: use dmaengine_prep_slave_sg() tty: 8250_omap: use dmaengine_prep_slave_sg() tty: msm_serial: use dmaengine_prep_slave_sg() tty: serial: switch from circ_buf to kfifo tty: atmel_serial: use single DMA mapping for TX tty: atmel_serial: define macro for RX size tty: atmel_serial: use single DMA mapping for RX drivers/tty/serial/8250/8250_bcm7271.c | 14 +-- drivers/tty/serial/8250/8250_core.c | 3 +- drivers/tty/serial/8250/8250_dma.c | 31 +++-- drivers/tty/serial/8250/8250_exar.c | 5 +- drivers/tty/serial/8250/8250_mtk.c | 2 +- drivers/tty/serial/8250/8250_omap.c | 48 +++++--- drivers/tty/serial/8250/8250_pci1xxxx.c | 50 ++++---- drivers/tty/serial/8250/8250_port.c | 22 ++-- drivers/tty/serial/amba-pl011.c | 46 +++----- drivers/tty/serial/ar933x_uart.c | 15 ++- drivers/tty/serial/arc_uart.c | 8 +- drivers/tty/serial/atmel_serial.c | 150 +++++++++++------------- drivers/tty/serial/clps711x.c | 12 +- drivers/tty/serial/cpm_uart.c | 20 ++-- drivers/tty/serial/digicolor-usart.c | 12 +- drivers/tty/serial/dz.c | 13 +- drivers/tty/serial/fsl_linflexuart.c | 17 +-- drivers/tty/serial/fsl_lpuart.c | 39 +++--- drivers/tty/serial/icom.c | 25 +--- drivers/tty/serial/imx.c | 54 ++++----- drivers/tty/serial/ip22zilog.c | 26 ++-- drivers/tty/serial/jsm/jsm_cls.c | 29 ++--- drivers/tty/serial/jsm/jsm_neo.c | 38 ++---- drivers/tty/serial/max3100.c | 14 +-- drivers/tty/serial/max310x.c | 35 +++--- drivers/tty/serial/men_z135_uart.c | 26 ++-- drivers/tty/serial/meson_uart.c | 11 +- drivers/tty/serial/milbeaut_usio.c | 15 +-- drivers/tty/serial/msm_serial.c | 114 +++++++++--------- drivers/tty/serial/mvebu-uart.c | 8 +- drivers/tty/serial/mxs-auart.c | 23 +--- drivers/tty/serial/pch_uart.c | 21 ++-- drivers/tty/serial/pic32_uart.c | 15 ++- drivers/tty/serial/pmac_zilog.c | 24 ++-- drivers/tty/serial/qcom_geni_serial.c | 36 +++--- drivers/tty/serial/rda-uart.c | 17 +-- drivers/tty/serial/samsung_tty.c | 54 +++++---- drivers/tty/serial/sb1250-duart.c | 13 +- drivers/tty/serial/sc16is7xx.c | 40 +++---- drivers/tty/serial/sccnxp.c | 16 ++- drivers/tty/serial/serial-tegra.c | 43 ++++--- drivers/tty/serial/serial_core.c | 56 ++++----- drivers/tty/serial/serial_port.c | 2 +- drivers/tty/serial/sh-sci.c | 51 ++++---- drivers/tty/serial/sprd_serial.c | 20 ++-- drivers/tty/serial/st-asc.c | 4 +- drivers/tty/serial/stm32-usart.c | 52 ++++---- drivers/tty/serial/sunhv.c | 35 +++--- drivers/tty/serial/sunplus-uart.c | 16 +-- drivers/tty/serial/sunsab.c | 30 ++--- drivers/tty/serial/sunsu.c | 15 +-- drivers/tty/serial/sunzilog.c | 27 ++--- drivers/tty/serial/tegra-tcu.c | 10 +- drivers/tty/serial/timbuart.c | 17 ++- drivers/tty/serial/uartlite.c | 13 +- drivers/tty/serial/ucc_uart.c | 20 ++-- drivers/tty/serial/xilinx_uartps.c | 20 ++-- drivers/tty/serial/zs.c | 13 +- include/linux/kfifo.h | 143 ++++++++++++++++------ include/linux/serial_core.h | 49 +++++--- lib/kfifo.c | 107 +++++++++-------- 61 files changed, 944 insertions(+), 960 deletions(-) -- 2.44.0