From: Simon Horman <horms@verge.net.au>
To: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Cc: linux-sh@vger.kernel.org, linux-serial@vger.kernel.org
Subject: Re: [PATCH v3] serial: sh-sci: Fix warnings due to improper casts and printk formats
Date: Thu, 12 Dec 2013 22:15:21 +0900 [thread overview]
Message-ID: <20131212131520.GF30624@verge.net.au> (raw)
In-Reply-To: <1386765631-1840-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com>
On Wed, Dec 11, 2013 at 01:40:31PM +0100, Laurent Pinchart wrote:
> 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: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Thanks, I will queue this up.
> ---
> drivers/tty/serial/sh-sci.c | 19 ++++++++++---------
> 1 file changed, 10 insertions(+), 9 deletions(-)
>
> This patch depends on "vsprintf: add %pad extension for dma_addr_t use" that
> should make it to v3.14.
>
> diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
> index 7d8103c..6e5ce62 100644
> --- a/drivers/tty/serial/sh-sci.c
> +++ b/drivers/tty/serial/sh-sci.c
> @@ -557,7 +557,7 @@ static inline int sci_rxd_in(struct uart_port *port)
> return 1;
>
> /* 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)
> }
>
> 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);
> if (!room)
> return room;
> @@ -1442,7 +1442,7 @@ static void work_fn_rx(struct work_struct *work)
> int count;
>
> 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);
>
> spin_lock_irqsave(&port->lock, flags);
> @@ -1691,16 +1691,17 @@ 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((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),
> - 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);
> if (!nent)
> sci_tx_dma_release(s, false);
> else
> - dev_dbg(port->dev, "%s: mapped %d@%p to %x\n", __func__,
> - sg_dma_len(&s->sg_tx),
> - port->state->xmit.buf, sg_dma_address(&s->sg_tx));
> + dev_dbg(port->dev, "%s: mapped %d@%p to %pad\n", __func__,
> + sg_dma_len(&s->sg_tx), port->state->xmit.buf,
> + &sg_dma_address(&s->sg_tx));
>
> s->sg_len_tx = nent;
>
> @@ -1740,7 +1741,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,
> - (int)buf[i] & ~PAGE_MASK);
> + (uintptr_t)buf[i] & ~PAGE_MASK);
> sg_dma_address(sg) = dma[i];
> }
>
> --
> Regards,
>
> Laurent Pinchart
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
prev parent reply other threads:[~2013-12-12 13:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-11 12:40 [PATCH v3] serial: sh-sci: Fix warnings due to improper casts and printk formats Laurent Pinchart
2013-12-12 13:15 ` Simon Horman [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131212131520.GF30624@verge.net.au \
--to=horms@verge.net.au \
--cc=laurent.pinchart+renesas@ideasonboard.com \
--cc=linux-serial@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).