* [PATCH 5/8] serial: sh-sci: Use offset_in_page() helper instead of open coding
@ 2015-05-20 18:06 Geert Uytterhoeven
2015-05-23 19:13 ` Laurent Pinchart
0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2015-05-20 18:06 UTC (permalink / raw)
To: linux-sh
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
drivers/tty/serial/sh-sci.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 73f4115159a7fbbc..d2734e13b17bf720 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1715,10 +1715,10 @@ static void sci_request_dma(struct uart_port *port)
s->chan_tx = chan;
sg_init_table(&s->sg_tx, 1);
/* UART circular tx buffer is an aligned page. */
- BUG_ON((uintptr_t)port->state->xmit.buf & ~PAGE_MASK);
+ BUG_ON(offset_in_page(port->state->xmit.buf));
sg_set_page(&s->sg_tx, virt_to_page(port->state->xmit.buf),
UART_XMIT_SIZE,
- (uintptr_t)port->state->xmit.buf & ~PAGE_MASK);
+ offset_in_page(port->state->xmit.buf));
nent = dma_map_sg(chan->device->dev, &s->sg_tx, 1,
DMA_TO_DEVICE);
if (!nent)
@@ -1768,7 +1768,7 @@ static void sci_request_dma(struct uart_port *port)
sg_init_table(sg, 1);
sg_set_page(sg, virt_to_page(buf[i]), s->buf_len_rx,
- (uintptr_t)buf[i] & ~PAGE_MASK);
+ offset_in_page(buf[i]));
sg_dma_address(sg) = dma[i];
}
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 5/8] serial: sh-sci: Use offset_in_page() helper instead of open coding
2015-05-20 18:06 [PATCH 5/8] serial: sh-sci: Use offset_in_page() helper instead of open coding Geert Uytterhoeven
@ 2015-05-23 19:13 ` Laurent Pinchart
0 siblings, 0 replies; 2+ messages in thread
From: Laurent Pinchart @ 2015-05-23 19:13 UTC (permalink / raw)
To: linux-sh
Hi Geert,
Thank you for the patch.
On Wednesday 20 May 2015 20:06:11 Geert Uytterhoeven wrote:
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> drivers/tty/serial/sh-sci.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
> index 73f4115159a7fbbc..d2734e13b17bf720 100644
> --- a/drivers/tty/serial/sh-sci.c
> +++ b/drivers/tty/serial/sh-sci.c
> @@ -1715,10 +1715,10 @@ static void sci_request_dma(struct uart_port *port)
> s->chan_tx = chan;
> sg_init_table(&s->sg_tx, 1);
> /* UART circular tx buffer is an aligned page. */
> - BUG_ON((uintptr_t)port->state->xmit.buf & ~PAGE_MASK);
> + BUG_ON(offset_in_page(port->state->xmit.buf));
> sg_set_page(&s->sg_tx, virt_to_page(port->state->xmit.buf),
> UART_XMIT_SIZE,
> - (uintptr_t)port->state->xmit.buf & ~PAGE_MASK);
> + offset_in_page(port->state->xmit.buf));
If a non-zero offset is a bug, do we really need to pass it to sg_set_page()
here and below ? I also expect this code to be simplified if we switch to
dma_map_single().
> nent = dma_map_sg(chan->device->dev, &s->sg_tx, 1,
> DMA_TO_DEVICE);
> if (!nent)
> @@ -1768,7 +1768,7 @@ static void sci_request_dma(struct uart_port *port)
>
> sg_init_table(sg, 1);
> sg_set_page(sg, virt_to_page(buf[i]), s->buf_len_rx,
> - (uintptr_t)buf[i] & ~PAGE_MASK);
> + offset_in_page(buf[i]));
> sg_dma_address(sg) = dma[i];
> }
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-05-23 19:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-20 18:06 [PATCH 5/8] serial: sh-sci: Use offset_in_page() helper instead of open coding Geert Uytterhoeven
2015-05-23 19:13 ` Laurent Pinchart
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.