mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Frank.Li@oss.nxp.com
To: "Russell King" <linux@armlinux.org.uk>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Jiri Slaby" <jirislaby@kernel.org>,
	"Kartik Rajput" <kkartik@nvidia.com>,
	"Frank Li" <Frank.Li@nxp.com>, "Fan Wu" <fanwu01@zju.edu.cn>,
	"Nicolai Buchwitz" <nb@tipi-net.de>,
	"Karl Mehltretter" <kmehltretter@gmail.com>,
	"Stefan Dösinger" <stefandoesinger@gmail.com>,
	linux-kernel@vger.kernel.org (open list:TTY LAYER AND SERIAL
	DRIVERS),
	linux-serial@vger.kernel.org (open list:TTY LAYER AND SERIAL
	DRIVERS)
Cc: imx@lists.linux.dev
Subject: [PATCH 1/1] tty: serial: amba-pl011: use dmaengine accessor API functions
Date: Wed, 11 Nov 2026 15:18:22 -0500	[thread overview]
Message-ID: <20261111201835.3846654-1-Frank.Li@oss.nxp.com> (raw)

From: Frank Li <Frank.Li@nxp.com>

Use dmaengine_get_dma_device() and dmaengine_get_copy_align() accessors
instead of directly accessing chan->device struct members. This follows
the dmaengine API convention of using accessor helpers to decouple
drivers from internal dmaengine structures.

Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
 drivers/tty/serial/amba-pl011.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 1e04e6398c973..7acccb096ab57 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -655,9 +655,10 @@ static int pl011_dma_tx_refill(struct uart_amba_port *uap)
 {
 	struct pl011_dmatx_data *dmatx = &uap->dmatx;
 	struct dma_chan *chan = dmatx->chan;
-	struct dma_device *dma_dev = chan->device;
+	struct device *dma_dev = dmaengine_get_dma_device(chan);
 	struct dma_async_tx_descriptor *desc;
 	struct tty_port *tport = &uap->port.state->port;
+	enum dmaengine_alignment copy_align;
 	unsigned int count;
 
 	/*
@@ -689,13 +690,14 @@ static int pl011_dma_tx_refill(struct uart_amba_port *uap)
 	 * requirements. Some DMA controllers (e.g., Tegra GPC DMA) require
 	 * word-aligned transfers. Unaligned bytes will be sent via PIO.
 	 */
-	if (chan->device->copy_align)
-		count = ALIGN_DOWN(count, 1 << chan->device->copy_align);
+	copy_align = dmaengine_get_copy_align(chan);
+	if (copy_align)
+		count = ALIGN_DOWN(count, 1 << copy_align);
 
 	dmatx->len = count;
-	dmatx->dma = dma_map_single(dma_dev->dev, dmatx->buf, count,
+	dmatx->dma = dma_map_single(dma_dev, dmatx->buf, count,
 				    DMA_TO_DEVICE);
-	if (dma_mapping_error(dma_dev->dev, dmatx->dma)) {
+	if (dma_mapping_error(dma_dev, dmatx->dma)) {
 		uap->dmatx.queued = false;
 		dev_dbg(uap->port.dev, "unable to map TX DMA\n");
 		return -EBUSY;
@@ -704,7 +706,7 @@ static int pl011_dma_tx_refill(struct uart_amba_port *uap)
 	desc = dmaengine_prep_slave_single(chan, dmatx->dma, dmatx->len, DMA_MEM_TO_DEV,
 					   DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	if (!desc) {
-		dma_unmap_single(dma_dev->dev, dmatx->dma, dmatx->len, DMA_TO_DEVICE);
+		dma_unmap_single(dma_dev, dmatx->dma, dmatx->len, DMA_TO_DEVICE);
 		uap->dmatx.queued = false;
 		/*
 		 * If DMA cannot be used right now, we complete this
-- 
2.43.0


                 reply	other threads:[~2026-11-11 20:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261111201835.3846654-1-Frank.Li@oss.nxp.com \
    --to=frank.li@oss.nxp.com \
    --cc=Frank.Li@nxp.com \
    --cc=fanwu01@zju.edu.cn \
    --cc=gregkh@linuxfoundation.org \
    --cc=imx@lists.linux.dev \
    --cc=jirislaby@kernel.org \
    --cc=kkartik@nvidia.com \
    --cc=kmehltretter@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=nb@tipi-net.de \
    --cc=stefandoesinger@gmail.com \
    /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

all inboxes | Powered by JetHome®