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

From: Andi Shyti
Date: Thu Jul 03 2025 - 14:11:59 EST


Hi Qianfeng,

> @@ -422,10 +423,7 @@ static void st_i2c_wr_fill_tx_fifo(struct st_i2c_dev *i2c_dev)
> tx_fstat = readl_relaxed(i2c_dev->base + SSC_TX_FSTAT);
> tx_fstat &= SSC_TX_FSTAT_STATUS;
>
> - if (c->count < (SSC_TXFIFO_SIZE - tx_fstat))
> - i = c->count;
> - else
> - i = SSC_TXFIFO_SIZE - tx_fstat;
> + i = min(c->count, SSC_TXFIFO_SIZE - tx_fstat);

I think it's safe enough not to need a min_t(int,...

merged to i2c/i2c-host.

Thanks,
Andi