Skip to content

Commit

Permalink
tty/serial: atmel: use offset_in_page() macro
Browse files Browse the repository at this point in the history
Use offset_in_page() macro instead of open-coding.

Signed-off-by: Geliang Tang <[email protected]>
Acked-by: Richard Genoud <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
geliangtang authored and gregkh committed May 18, 2017
1 parent 228a9ff commit 2b5cf14
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/tty/serial/atmel_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 2b5cf14

Please sign in to comment.