Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1633216 > unrolled thread

[PATCH v2] tty/serial: atmel: use offset_in_page() macro

Started byGeliang Tang <geliangtang@gmail.com>
First post2017-04-29 03:40 +0200
Last post2017-05-02 10:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2] tty/serial: atmel: use offset_in_page() macro Geliang Tang <geliangtang@gmail.com> - 2017-04-29 03:40 +0200
    Re: [PATCH v2] tty/serial: atmel: use offset_in_page() macro Richard Genoud <richard.genoud@gmail.com> - 2017-05-02 10:50 +0200

#1633216 — [PATCH v2] tty/serial: atmel: use offset_in_page() macro

FromGeliang Tang <geliangtang@gmail.com>
Date2017-04-29 03:40 +0200
Subject[PATCH v2] tty/serial: atmel: use offset_in_page() macro
Message-ID<tBpwC-7AB-3@gated-at.bofh.it>
Use offset_in_page() macro instead of open-coding.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
Changes in v2:
 - include mm.h
---
 drivers/tty/serial/atmel_serial.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index c355ac9..d25f044 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -46,6 +46,7 @@
 #include <linux/err.h>
 #include <linux/irq.h>
 #include <linux/suspend.h>
+#include <linux/mm.h>
 
 #include <asm/io.h>
 #include <asm/ioctls.h>
@@ -959,7 +960,7 @@ static int atmel_prepare_tx_dma(struct uart_port *port)
 	sg_set_page(&atmel_port->sg_tx,
 			virt_to_page(port->state->xmit.buf),
 			UART_XMIT_SIZE,
-			(unsigned long)port->state->xmit.buf & ~PAGE_MASK);
+			offset_in_page(port->state->xmit.buf));
 	nent = dma_map_sg(port->dev,
 				&atmel_port->sg_tx,
 				1,
@@ -1141,7 +1142,7 @@ static int atmel_prepare_rx_dma(struct uart_port *port)
 	sg_set_page(&atmel_port->sg_rx,
 		    virt_to_page(ring->buf),
 		    sizeof(struct atmel_uart_char) * ATMEL_SERIAL_RINGSIZE,
-		    (unsigned long)ring->buf & ~PAGE_MASK);
+		    offset_in_page(ring->buf));
 	nent = dma_map_sg(port->dev,
 			  &atmel_port->sg_rx,
 			  1,
-- 
2.9.3

[toc] | [next] | [standalone]


#1634258

FromRichard Genoud <richard.genoud@gmail.com>
Date2017-05-02 10:50 +0200
Message-ID<tCBFo-4eG-5@gated-at.bofh.it>
In reply to#1633216
On 29/04/2017 03:39, Geliang Tang wrote:
> Use offset_in_page() macro instead of open-coding.
> 
> Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Acked-by: Richard Genoud <richard.genoud@gmail.com>

> ---
> Changes in v2:
>  - include mm.h
> ---
>  drivers/tty/serial/atmel_serial.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> index c355ac9..d25f044 100644
> --- a/drivers/tty/serial/atmel_serial.c
> +++ b/drivers/tty/serial/atmel_serial.c
> @@ -46,6 +46,7 @@
>  #include <linux/err.h>
>  #include <linux/irq.h>
>  #include <linux/suspend.h>
> +#include <linux/mm.h>
>  
>  #include <asm/io.h>
>  #include <asm/ioctls.h>
> @@ -959,7 +960,7 @@ static int atmel_prepare_tx_dma(struct uart_port *port)
>  	sg_set_page(&atmel_port->sg_tx,
>  			virt_to_page(port->state->xmit.buf),
>  			UART_XMIT_SIZE,
> -			(unsigned long)port->state->xmit.buf & ~PAGE_MASK);
> +			offset_in_page(port->state->xmit.buf));
>  	nent = dma_map_sg(port->dev,
>  				&atmel_port->sg_tx,
>  				1,
> @@ -1141,7 +1142,7 @@ static int atmel_prepare_rx_dma(struct uart_port *port)
>  	sg_set_page(&atmel_port->sg_rx,
>  		    virt_to_page(ring->buf),
>  		    sizeof(struct atmel_uart_char) * ATMEL_SERIAL_RINGSIZE,
> -		    (unsigned long)ring->buf & ~PAGE_MASK);
> +		    offset_in_page(ring->buf));
>  	nent = dma_map_sg(port->dev,
>  			  &atmel_port->sg_rx,
>  			  1,
> 

Thanks !

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web