Commit e2afca69 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Simon Horman

serial: sh-sci: Fix warnings due to improper casts and printk formats

Use the %zu and %pad printk specifiers to print size_t and dma_addr_t
variables, and cast pointers to uintptr_t instead of unsigned int where
applicable. This fixes warnings on platforms where pointers and/or
dma_addr_t have a different size than int.

Cc: linux-serial@vger.kernel.org
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarSimon Horman <horms+renesas@verge.net.au>
parent 6ce4eac1
...@@ -557,7 +557,7 @@ static inline int sci_rxd_in(struct uart_port *port) ...@@ -557,7 +557,7 @@ static inline int sci_rxd_in(struct uart_port *port)
return 1; return 1;
/* Cast for ARM damage */ /* Cast for ARM damage */
return !!__raw_readb((void __iomem *)s->cfg->port_reg); return !!__raw_readb((void __iomem *)(uintptr_t)s->cfg->port_reg);
} }
/* ********************************************************************** * /* ********************************************************************** *
...@@ -1309,7 +1309,7 @@ static int sci_dma_rx_push(struct sci_port *s, size_t count) ...@@ -1309,7 +1309,7 @@ static int sci_dma_rx_push(struct sci_port *s, size_t count)
} }
if (room < count) if (room < count)
dev_warn(port->dev, "Rx overrun: dropping %u bytes\n", dev_warn(port->dev, "Rx overrun: dropping %zu bytes\n",
count - room); count - room);
if (!room) if (!room)
return room; return room;
...@@ -1442,7 +1442,7 @@ static void work_fn_rx(struct work_struct *work) ...@@ -1442,7 +1442,7 @@ static void work_fn_rx(struct work_struct *work)
int count; int count;
chan->device->device_control(chan, DMA_TERMINATE_ALL, 0); chan->device->device_control(chan, DMA_TERMINATE_ALL, 0);
dev_dbg(port->dev, "Read %u bytes with cookie %d\n", dev_dbg(port->dev, "Read %zu bytes with cookie %d\n",
sh_desc->partial, sh_desc->cookie); sh_desc->partial, sh_desc->cookie);
spin_lock_irqsave(&port->lock, flags); spin_lock_irqsave(&port->lock, flags);
...@@ -1691,16 +1691,17 @@ static void sci_request_dma(struct uart_port *port) ...@@ -1691,16 +1691,17 @@ static void sci_request_dma(struct uart_port *port)
s->chan_tx = chan; s->chan_tx = chan;
sg_init_table(&s->sg_tx, 1); sg_init_table(&s->sg_tx, 1);
/* UART circular tx buffer is an aligned page. */ /* UART circular tx buffer is an aligned page. */
BUG_ON((int)port->state->xmit.buf & ~PAGE_MASK); BUG_ON((uintptr_t)port->state->xmit.buf & ~PAGE_MASK);
sg_set_page(&s->sg_tx, virt_to_page(port->state->xmit.buf), sg_set_page(&s->sg_tx, virt_to_page(port->state->xmit.buf),
UART_XMIT_SIZE, (int)port->state->xmit.buf & ~PAGE_MASK); UART_XMIT_SIZE,
(uintptr_t)port->state->xmit.buf & ~PAGE_MASK);
nent = dma_map_sg(port->dev, &s->sg_tx, 1, DMA_TO_DEVICE); nent = dma_map_sg(port->dev, &s->sg_tx, 1, DMA_TO_DEVICE);
if (!nent) if (!nent)
sci_tx_dma_release(s, false); sci_tx_dma_release(s, false);
else else
dev_dbg(port->dev, "%s: mapped %d@%p to %x\n", __func__, dev_dbg(port->dev, "%s: mapped %d@%p to %pad\n", __func__,
sg_dma_len(&s->sg_tx), sg_dma_len(&s->sg_tx), port->state->xmit.buf,
port->state->xmit.buf, sg_dma_address(&s->sg_tx)); &sg_dma_address(&s->sg_tx));
s->sg_len_tx = nent; s->sg_len_tx = nent;
...@@ -1740,7 +1741,7 @@ static void sci_request_dma(struct uart_port *port) ...@@ -1740,7 +1741,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); (uintptr_t)buf[i] & ~PAGE_MASK);
sg_dma_address(sg) = dma[i]; sg_dma_address(sg) = dma[i];
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment