[PATCH v3] i2c: busses: Use min() to improve code

Qianfeng Rong rongqianfeng at vivo.com
Tue Jul 8 19:44:26 PDT 2025


在 2025/7/8 19:06, Jonathan Cameron 写道:
>> -     for (; i > 0; i--, c->count--, c->buf++)
>> +     for (i = min(c->count, SSC_TXFIFO_SIZE - tx_fstat);
>> +             i > 0; i--, c->count--, c->buf++)
>          for (i = min(c->count, SSC_TXFIFO_SIZE - tx_fstat);
>               i > 0; i--, c->count--, c->buf++)
>                  st_i2c_write_tx_fifo(i2c_dev, *c->buf);
>
> So different alignment form what you have.
>
Thank you for pointing out the alignment issue in the code snippet,
Will do in the next version.

Best regards,
Qianfeng




More information about the linux-arm-kernel mailing list