]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
i2c: imx: use guard to take spinlock
authorTroy Mitchell <troymitchell988@gmail.com>
Sat, 31 May 2025 06:57:26 +0000 (14:57 +0800)
committerAndi Shyti <andi.shyti@kernel.org>
Wed, 23 Jul 2025 22:37:59 +0000 (00:37 +0200)
commit07e0e8ea6400673fe6eb40d3db2a64f1f2bce4ca
tree9311a23e7fc77b1490546e8b42ae7c1aec9f9b38
parentbe3b425bcb65b1f5879752371131e813eaa2d481
i2c: imx: use guard to take spinlock

Use guard to automatically release the lock after going out of scope
instead of calling it manually.

i2c_imx_slave_handle() can safely be entered with the lock held.

Refactored the i2c_imx_isr function so that i2c_imx_master_isr
does not participate in the guard scope

So Using scoped_guard simplifies the control flow
by ensuring consistent and automatic unlock,
which improves readability without affecting correctness.

Co-developed-by: Yongchao Jia <jyc0019@gmail.com>
Signed-off-by: Yongchao Jia <jyc0019@gmail.com>
Signed-off-by: Troy Mitchell <troymitchell988@gmail.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20250531-i2c-imx-update-v4-1-bfad0c8fd45c@gmail.com
drivers/i2c/busses/i2c-imx.c