Re: [PATCH v2 2/5] i2c: designware: Optimize flag reading in i2c_dw_read()
From: Benoît Monin
Date: Thu Nov 06 2025 - 05:47:00 EST
Hi Andy,
On Friday, 31 October 2025 at 15:48:50 CET, Andy Shevchenko wrote:
> On Fri, Oct 31, 2025 at 03:35:40PM +0100, Benoît Monin wrote:
> > Optimize the i2c_dw_read() function by reading the message flags only
> > once per message, rather than for every byte.
> >
> > The message index is only modified by the outer loop, so reading the
> > flags in the inner loop was always getting the same value.
>
> Does it affect the binary (compiled) file?
>
Yes it does. On the mips64 system I am testing this on, built with gcc11,
i2c_dw_process_transfer() which inline i2c_dw_read() get 16 bytes shorter.
Looking at the disassembled code, the flags was read in the inner loop prior
to the patch.
Best regards,
--
Benoît Monin, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com