mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] tty: serial: amba-pl011: use dmaengine accessor API functions
@ 2026-11-11 20:18 Frank.Li
  0 siblings, 0 replies; only message in thread
From: Frank.Li @ 2026-11-11 20:18 UTC (permalink / raw)
  To: Russell King, Greg Kroah-Hartman, Jiri Slaby, Kartik Rajput,
	Frank Li, Fan Wu, Nicolai Buchwitz, Karl Mehltretter,
	Stefan Dösinger, open list:TTY LAYER AND SERIAL DRIVERS,
	open list:TTY LAYER AND SERIAL DRIVERS
  Cc: imx

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-11 20:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-11 20:18 [PATCH 1/1] tty: serial: amba-pl011: use dmaengine accessor API functions Frank.Li

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®