mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 03:04:51 +01:00
pinctrl: microchip-sgpio: Simplify locking with guard()
Simplify error handling (less gotos) over locks with guard(). Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Signed-off-by: Linus Walleij <linusw@kernel.org>
This commit is contained in:
parent
6fe3b96b05
commit
708adef80c
1 changed files with 2 additions and 4 deletions
|
|
@ -264,19 +264,17 @@ static int sgpio_single_shot(struct sgpio_priv *priv)
|
|||
* setting.
|
||||
* After the manual burst, reenable the auto repeat mode again.
|
||||
*/
|
||||
mutex_lock(&priv->poll_lock);
|
||||
guard(mutex)(&priv->poll_lock);
|
||||
ret = regmap_update_bits(priv->regs, addr, single_shot | auto_repeat,
|
||||
single_shot);
|
||||
if (ret)
|
||||
goto out;
|
||||
return ret;
|
||||
|
||||
ret = regmap_read_poll_timeout(priv->regs, addr, ctrl,
|
||||
!(ctrl & single_shot), 100, 60000);
|
||||
|
||||
/* reenable auto repeat mode even if there was an error */
|
||||
ret2 = regmap_update_bits(priv->regs, addr, auto_repeat, auto_repeat);
|
||||
out:
|
||||
mutex_unlock(&priv->poll_lock);
|
||||
|
||||
return ret ?: ret2;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue