[PATCH v2] i2c: mediatek: fix potential incorrect use of I2C_MASTER_WRRD

Wolfram Sang wsa+renesas at sang-engineering.com
Thu Sep 25 14:06:42 PDT 2025


On Sat, Sep 06, 2025 at 04:24:06PM +0800, Leilk Liu wrote:
> From: "Leilk.Liu" <leilk.liu at mediatek.com>
> 
> The old IC does not support the I2C_MASTER_WRRD (write-then-read)
> function, but the current code’s handling of i2c->auto_restart may
> potentially lead to entering the I2C_MASTER_WRRD software flow,
> resulting in unexpected bugs.
> 
> Instead of repurposing the auto_restart flag, add a separate flag
> to signal I2C_MASTER_WRRD operations.
> 
> Also fix handling of msgs. If the operation (i2c->op) is
> I2C_MASTER_WRRD, then the msgs pointer is incremented by 2.
> For all other operations, msgs is simply incremented by 1.
> 
> Fixes: b2ed11e224a2 ("I2C: mediatek: Add driver for MediaTek MT8173 I2C controller")
> Signed-off-by: Leilk.Liu <leilk.liu at mediatek.com>
> Suggested-by: Chen-Yu Tsai <wenst at chromium.org>
> Reviewed-by: Chen-Yu Tsai <wenst at chromium.org>

Applied to for-next, thanks!




More information about the linux-arm-kernel mailing list