]> git.ipfire.org Git - thirdparty/linux.git/commit
i2c: rtl9300: use scoped guard instead of explicit lock/unlock
authorJonas Jelonek <jelonek.jonas@gmail.com>
Sat, 27 Sep 2025 10:19:29 +0000 (10:19 +0000)
committerAndi Shyti <andi.shyti@kernel.org>
Sat, 4 Oct 2025 09:43:40 +0000 (11:43 +0200)
commit46fe8265685cb6003a0989b53e11e8afa4826572
tree6e04b4d300ff55b8959a1ce3cb7533c44587f149
parent059374aa0ab11a758a9e2219e90361911397b03d
i2c: rtl9300: use scoped guard instead of explicit lock/unlock

Use the scoped guard infrastructure which unlocks a mutex automatically
when the guard goes out of scope, instead of explicit lock and unlock.
This simplifies the code and control flow in rtl9300_i2c_smbus_xfer and
removes the need of using goto in error cases to unlock before
returning.

Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Tested-by: Chris Packham <chris.packham@alliedtelesis.co.nz> # On RTL9302C based board
Tested-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20250927101931.71575-8-jelonek.jonas@gmail.com
drivers/i2c/busses/i2c-rtl9300.c