[PATCH v2] i2c: busses: Use min() to improve code
David Laight
david.laight.linux at gmail.com
Wed Jul 9 01:00:41 PDT 2025
On Tue, 8 Jul 2025 10:05:58 +0800
Qianfeng Rong <rongqianfeng at vivo.com> wrote:
> 在 2025/7/7 17:40, Jonathan Cameron 写道:
> >> Signed-off-by: Qianfeng Rong <rongqianfeng at vivo.com>
> >> Reviewed-by: Patrice Chotard <patrice.chotard at foss.st.com>
> > Drive by review...
...
> > Given it is now one statement perhaps cleaner toput it
> > as the loop initializer
> >
> > for (i = min(c->count, SSC_TXFIFO_SIZE - tx_fstat);
> > i > 0; i--, c->count--, c->buf++)
> >
> Got it. Will do in the next version.
Not sure whether that is better.
The continuation line makes the 'for' statement a bit harder to parse.
I'll move the 'initialisation' out of a 'for' statement to get it to
fit on one line.
David
>
> Best regards,
> Qianfeng
>
>
More information about the linux-arm-kernel
mailing list