From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH 3/8] serial: sh-sci: Use min_t()/max_t() instead of casts
Date: Sat, 23 May 2015 19:06:27 +0000 [thread overview]
Message-ID: <1761966.VabTI6DprL@avalon> (raw)
In-Reply-To: <1432145174-11534-4-git-send-email-geert+renesas@glider.be>
Hi Geert,
Thank you for the patch.
On Wednesday 20 May 2015 20:06:09 Geert Uytterhoeven wrote:
> When comparing differently sized types, it's better to use
> min_t()/max_t() than adding casts.
>
> Also use "unsigned int" instead of "int", as that's the right type for
> the length of an SG entry.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> drivers/tty/serial/sh-sci.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
> index 0aec66cf68615972..21c07c6cb0cd2220 100644
> --- a/drivers/tty/serial/sh-sci.c
> +++ b/drivers/tty/serial/sh-sci.c
> @@ -1520,7 +1520,8 @@ static void work_fn_tx(struct work_struct *work)
> sg->offset = xmit->tail & (UART_XMIT_SIZE - 1);
> sg_dma_address(sg) = (sg_dma_address(sg) & ~(UART_XMIT_SIZE - 1)) +
> sg->offset;
> - sg_dma_len(sg) = min((int)CIRC_CNT(xmit->head, xmit->tail,
> UART_XMIT_SIZE), + sg_dma_len(sg) = min_t(unsigned int,
> + CIRC_CNT(xmit->head, xmit->tail, UART_XMIT_SIZE),
> CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE));
> spin_unlock_irq(&port->lock);
>
> @@ -1746,7 +1747,7 @@ static void sci_request_dma(struct uart_port *port)
>
> s->chan_rx = chan;
>
> - s->buf_len_rx = 2 * max(16, (int)port->fifosize);
> + s->buf_len_rx = 2 * max_t(size_t, 16, port->fifosize);
> buf[0] = dma_alloc_coherent(chan->device->dev,
> s->buf_len_rx * 2, &dma[0],
> GFP_KERNEL);
--
Regards,
Laurent Pinchart
prev parent reply other threads:[~2015-05-23 19:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-20 18:06 [PATCH 3/8] serial: sh-sci: Use min_t()/max_t() instead of casts Geert Uytterhoeven
2015-05-23 19:06 ` Laurent Pinchart [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=1761966.VabTI6DprL@avalon \
--to=laurent.pinchart@ideasonboard.com \
--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