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


Groups > linux.kernel > #1628727

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

From Geliang Tang <geliangtang@gmail.com>
Newsgroups linux.kernel
Subject [PATCH] tty/serial: atmel: use offset_in_page() macro
Date 2017-04-22 03:30 +0200
Message-ID <tyS27-4Ml-29@gated-at.bofh.it> (permalink)
References <tyS26-4Ml-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Use offset_in_page() macro instead of open-coding.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
 drivers/tty/serial/atmel_serial.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index c355ac9..f398db8 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -959,7 +959,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 +1141,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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] fs/ocfs2/cluster: use offset_in_page() macro Geliang Tang <geliangtang@gmail.com> - 2017-04-22 03:30 +0200
  [PATCH] xprtrdma: use offset_in_page() macro Geliang Tang <geliangtang@gmail.com> - 2017-04-22 03:30 +0200
    Re: [PATCH] xprtrdma: use offset_in_page() macro Chuck Lever <chuck.lever@oracle.com> - 2017-04-22 05:40 +0200
  [PATCH] tty/serial: atmel: use offset_in_page() macro Geliang Tang <geliangtang@gmail.com> - 2017-04-22 03:30 +0200
    Re: [PATCH] tty/serial: atmel: use offset_in_page() macro Richard Genoud <richard.genoud@gmail.com> - 2017-04-24 09:20 +0200

csiph-web