serial: sh-sci: Use sg_dma_len() and sg_dma_address()
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> Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:
@@ -916,10 +916,10 @@ static void sci_dma_tx_complete(void *arg)
|
|||||||
|
|
||||||
spin_lock_irqsave(&port->lock, flags);
|
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;
|
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);
|
async_tx_ack(s->desc_tx);
|
||||||
s->cookie_tx = -EINVAL;
|
s->cookie_tx = -EINVAL;
|
||||||
@@ -1134,14 +1134,13 @@ static void work_fn_tx(struct work_struct *work)
|
|||||||
*/
|
*/
|
||||||
spin_lock_irq(&port->lock);
|
spin_lock_irq(&port->lock);
|
||||||
sg->offset = xmit->tail & (UART_XMIT_SIZE - 1);
|
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->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));
|
CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE));
|
||||||
sg->dma_length = sg->length;
|
|
||||||
spin_unlock_irq(&port->lock);
|
spin_unlock_irq(&port->lock);
|
||||||
|
|
||||||
BUG_ON(!sg->length);
|
BUG_ON(!sg_dma_len(sg));
|
||||||
|
|
||||||
desc = chan->device->device_prep_slave_sg(chan,
|
desc = chan->device->device_prep_slave_sg(chan,
|
||||||
sg, s->sg_len_tx, DMA_TO_DEVICE,
|
sg, s->sg_len_tx, DMA_TO_DEVICE,
|
||||||
@@ -1342,8 +1341,7 @@ static void sci_request_dma(struct uart_port *port)
|
|||||||
sg_init_table(sg, 1);
|
sg_init_table(sg, 1);
|
||||||
sg_set_page(sg, virt_to_page(buf[i]), s->buf_len_rx,
|
sg_set_page(sg, virt_to_page(buf[i]), s->buf_len_rx,
|
||||||
(int)buf[i] & ~PAGE_MASK);
|
(int)buf[i] & ~PAGE_MASK);
|
||||||
sg->dma_address = dma[i];
|
sg_dma_address(sg) = dma[i];
|
||||||
sg->dma_length = sg->length;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
INIT_WORK(&s->work_rx, work_fn_rx);
|
INIT_WORK(&s->work_rx, work_fn_rx);
|
||||||
|
Reference in New Issue
Block a user