public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	"Andy Shevchenko" <andy.shevchenko@gmail.com>,
	stable <stable@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Subject: [PATCH 4.19 50/58] serial: Create uart_xmit_advance()
Date: Mon, 26 Sep 2022 12:12:09 +0200	[thread overview]
Message-ID: <20220926100743.282052924@linuxfoundation.org> (raw)
In-Reply-To: <20220926100741.430882406@linuxfoundation.org>

From: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

commit e77cab77f2cb3a1ca2ba8df4af45bb35617ac16d upstream.

A very common pattern in the drivers is to advance xmit tail
index and do bookkeeping of Tx'ed characters. Create
uart_xmit_advance() to handle it.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20220901143934.8850-2-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 include/linux/serial_core.h |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -306,6 +306,23 @@ struct uart_state {
 /* number of characters left in xmit buffer before we ask for more */
 #define WAKEUP_CHARS		256
 
+/**
+ * uart_xmit_advance - Advance xmit buffer and account Tx'ed chars
+ * @up: uart_port structure describing the port
+ * @chars: number of characters sent
+ *
+ * This function advances the tail of circular xmit buffer by the number of
+ * @chars transmitted and handles accounting of transmitted bytes (into
+ * @up's icount.tx).
+ */
+static inline void uart_xmit_advance(struct uart_port *up, unsigned int chars)
+{
+	struct circ_buf *xmit = &up->state->xmit;
+
+	xmit->tail = (xmit->tail + chars) & (UART_XMIT_SIZE - 1);
+	up->icount.tx += chars;
+}
+
 struct module;
 struct tty_driver;
 



  parent reply	other threads:[~2022-09-26 10:33 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-26 10:11 [PATCH 4.19 00/58] 4.19.260-rc1 review Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 01/58] of: fdt: fix off-by-one error in unflatten_dt_nodes() Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 02/58] gpio: mpc8xxx: Fix support for IRQ_TYPE_LEVEL_LOW flow_type in mpc85xx Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 03/58] drm/meson: Correct OSD1 global alpha value Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 04/58] parisc: ccio-dma: Add missing iounmap in error path in ccio_probe() Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 05/58] efi/libstub: Disable Shadow Call Stack Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 06/58] efi: libstub: Disable struct randomization Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 07/58] nvmet: fix a use-after-free Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 08/58] mvpp2: no need to check return value of debugfs_create functions Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 09/58] cifs: dont send down the destination address to sendmsg for a SOCK_STREAM Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 10/58] ASoC: nau8824: Fix semaphore unbalance at error paths Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 11/58] regulator: pfuze100: Fix the global-out-of-bounds access in pfuze100_regulator_probe() Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 12/58] rxrpc: Fix local destruction being repeated Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 13/58] ALSA: hda/sigmatel: Keep power up while beep is enabled Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 14/58] net: usb: qmi_wwan: add Quectel RM520N Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 15/58] MIPS: OCTEON: irq: Fix octeon_irq_force_ciu_mapping() Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 16/58] mksysmap: Fix the mismatch of L0 symbols in System.map Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 17/58] video: fbdev: pxa3xx-gcu: Fix integer overflow in pxa3xx_gcu_write Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 18/58] ALSA: hda/sigmatel: Fix unused variable warning for beep power change Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 19/58] usb: dwc3: pci: Add Support for Intel Elkhart Lake Devices Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 20/58] usb: dwc3: pci: add support for TigerLake Devices Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 21/58] usb: dwc3: pci: add support for the Intel Tiger Lake PCH -H variant Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 22/58] usb: dwc3: pci: add support for the Intel Jasper Lake Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 23/58] usb: dwc3: pci: add support for the Intel Alder Lake-S Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 24/58] wifi: mac80211: Fix UAF in ieee80211_scan_rx() Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 25/58] USB: core: Fix RST error in hub.c Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 26/58] USB: serial: option: add Quectel BG95 0x0203 composition Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 27/58] USB: serial: option: add Quectel RM520N Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 28/58] ALSA: hda/tegra: set depop delay for tegra Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 29/58] ALSA: hda: add Intel 5 Series / 3400 PCI DID Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 30/58] ALSA: hda/realtek: Enable 4-speaker output Dell Precision 5530 laptop Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 31/58] efi: libstub: check Shim mode using MokSBStateRT Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 32/58] riscv: fix a nasty sigreturn bug Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 33/58] mm/slub: fix to return errno if kmalloc() fails Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 34/58] arm64: dts: rockchip: Set RK3399-Gru PCLK_EDP to 24 MHz Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 35/58] arm64: dts: rockchip: Remove enable-active-low from rk3399-puma Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 36/58] netfilter: nf_conntrack_sip: fix ct_sip_walk_headers Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 37/58] netfilter: nf_conntrack_irc: Tighten matching on DCC message Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 38/58] iavf: Fix cached head and tail value for iavf_get_tx_pending Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 39/58] ipvlan: Fix out-of-bound bugs caused by unset skb->mac_header Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.19 40/58] net: team: Unsync device addresses on ndo_stop Greg Kroah-Hartman
2022-09-26 10:12 ` [PATCH 4.19 41/58] MIPS: lantiq: export clk_get_io() for lantiq_wdt.ko Greg Kroah-Hartman
2022-09-26 10:12 ` [PATCH 4.19 42/58] i40e: Fix VF set max MTU size Greg Kroah-Hartman
2022-09-26 10:12 ` [PATCH 4.19 43/58] i40e: Fix set max_tx_rate when it is lower than 1 Mbps Greg Kroah-Hartman
2022-09-26 10:12 ` [PATCH 4.19 44/58] of: mdio: Add of_node_put() when breaking out of for_each_xx Greg Kroah-Hartman
2022-09-26 10:12 ` [PATCH 4.19 45/58] netfilter: ebtables: fix memory leak when blob is malformed Greg Kroah-Hartman
2022-09-26 10:12 ` [PATCH 4.19 46/58] can: gs_usb: gs_can_open(): fix race dev->can.state condition Greg Kroah-Hartman
2022-09-26 10:12 ` [PATCH 4.19 47/58] perf jit: Include program header in ELF files Greg Kroah-Hartman
2022-09-26 10:12 ` [PATCH 4.19 48/58] perf kcore_copy: Do not check /proc/modules is unchanged Greg Kroah-Hartman
2022-09-26 10:12 ` [PATCH 4.19 49/58] net: sunhme: Fix packet reception for len < RX_COPY_THRESHOLD Greg Kroah-Hartman
2022-09-26 10:12 ` Greg Kroah-Hartman [this message]
2022-09-26 10:12 ` [PATCH 4.19 51/58] serial: tegra: Use uart_xmit_advance(), fixes icount.tx accounting Greg Kroah-Hartman
2022-09-26 10:12 ` [PATCH 4.19 52/58] s390/dasd: fix Oops in dasd_alias_get_start_dev due to missing pavgroup Greg Kroah-Hartman
2022-09-26 10:12 ` [PATCH 4.19 53/58] Drivers: hv: Never allocate anything besides framebuffer from framebuffer memory region Greg Kroah-Hartman
2022-09-26 10:12 ` [PATCH 4.19 54/58] drm/amd/display: Limit user regamma to a valid value Greg Kroah-Hartman
2022-09-26 10:12 ` [PATCH 4.19 55/58] drm/rockchip: Fix return type of cdn_dp_connector_mode_valid Greg Kroah-Hartman
2022-09-26 10:12 ` [PATCH 4.19 56/58] workqueue: dont skip lockdep work dependency in cancel_work_sync() Greg Kroah-Hartman
2022-09-26 10:12 ` [PATCH 4.19 57/58] ext4: make directory inode spreading reflect flexbg size Greg Kroah-Hartman
2022-09-26 10:12 ` [PATCH 4.19 58/58] usb: dwc3: pci: Allow Elkhart Lake to utilize DSM method for PM functionality Greg Kroah-Hartman
2022-09-26 13:36 ` [PATCH 4.19 00/58] 4.19.260-rc1 review Pavel Machek
2022-09-26 13:40 ` Guenter Roeck
2022-09-26 16:20   ` Greg Kroah-Hartman
2022-09-27  0:59 ` Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220926100743.282052924@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox