From: Magnus Damm <magnus.damm@gmail.com>
To: linux-sh@vger.kernel.org
Subject: [PATCH 03/05] serial: sh-sci: Use sg_dma_len() and sg_dma_address()
Date: Fri, 19 Mar 2010 04:47:01 +0000 [thread overview]
Message-ID: <20100319044701.17051.77755.sendpatchset@t400s> (raw)
From: Magnus Damm <damm@opensource.se>
Convert the dmaengine code in sh-sci.c from
directly accessing the struct scatterlist members
length, dma_length and dma_address to using the
macros sg_dma_len() and sg_dma_address().
Makes the code build for ARM.
Signed-off-by: Magnus Damm <damm@opensource.se>
---
drivers/serial/sh-sci.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
--- 0003/drivers/serial/sh-sci.c
+++ work/drivers/serial/sh-sci.c 2010-03-18 23:21:13.000000000 +0900
@@ -917,10 +917,10 @@ static void sci_dma_tx_complete(void *ar
spin_lock_irqsave(&port->lock, flags);
- xmit->tail += s->sg_tx.length;
+ xmit->tail += sg_dma_len(&s->sg_tx);
xmit->tail &= UART_XMIT_SIZE - 1;
- port->icount.tx += s->sg_tx.length;
+ port->icount.tx += sg_dma_len(&s->sg_tx);
async_tx_ack(s->desc_tx);
s->cookie_tx = -EINVAL;
@@ -1135,14 +1135,13 @@ static void work_fn_tx(struct work_struc
*/
spin_lock_irq(&port->lock);
sg->offset = xmit->tail & (UART_XMIT_SIZE - 1);
- sg->dma_address = (sg_dma_address(sg) & ~(UART_XMIT_SIZE - 1)) +
+ sg_dma_address(sg) = (sg_dma_address(sg) & ~(UART_XMIT_SIZE - 1)) +
sg->offset;
- sg->length = min((int)CIRC_CNT(xmit->head, xmit->tail, UART_XMIT_SIZE),
+ sg_dma_len(sg) = min((int)CIRC_CNT(xmit->head, xmit->tail, UART_XMIT_SIZE),
CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE));
- sg->dma_length = sg->length;
spin_unlock_irq(&port->lock);
- BUG_ON(!sg->length);
+ BUG_ON(!sg_dma_len(sg));
desc = chan->device->device_prep_slave_sg(chan,
sg, s->sg_len_tx, DMA_TO_DEVICE,
@@ -1343,8 +1342,7 @@ static void sci_request_dma(struct uart_
sg_init_table(sg, 1);
sg_set_page(sg, virt_to_page(buf[i]), s->buf_len_rx,
(int)buf[i] & ~PAGE_MASK);
- sg->dma_address = dma[i];
- sg->dma_length = sg->length;
+ sg_dma_address(sg) = dma[i];
}
INIT_WORK(&s->work_rx, work_fn_rx);
next reply other threads:[~2010-03-19 4:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-19 4:47 Magnus Damm [this message]
2010-03-19 7:37 ` [PATCH 03/05] serial: sh-sci: Use sg_dma_len() and sg_dma_address() Guennadi Liakhovetski
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=20100319044701.17051.77755.sendpatchset@t400s \
--to=magnus.damm@gmail.com \
--cc=linux-sh@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