[PATCH] i2c: busses: Use min() to improve code
Andi Shyti
andi.shyti at kernel.org
Thu Jul 3 11:11:47 PDT 2025
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
More information about the linux-arm-kernel
mailing list