mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 01:53:29 +02:00
pinctrl: tegra-xusb: 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
0899bab9b2
commit
160d686fbf
|
|
@ -478,10 +478,10 @@ static void tegra_xusb_padctl_enable(struct tegra_xusb_padctl *padctl)
|
|||
{
|
||||
u32 value;
|
||||
|
||||
mutex_lock(&padctl->lock);
|
||||
guard(mutex)(&padctl->lock);
|
||||
|
||||
if (padctl->enable++ > 0)
|
||||
goto out;
|
||||
return;
|
||||
|
||||
value = padctl_readl(padctl, XUSB_PADCTL_ELPG_PROGRAM);
|
||||
value &= ~XUSB_PADCTL_ELPG_PROGRAM_AUX_MUX_LP0_CLAMP_EN;
|
||||
|
|
@ -498,22 +498,19 @@ static void tegra_xusb_padctl_enable(struct tegra_xusb_padctl *padctl)
|
|||
value = padctl_readl(padctl, XUSB_PADCTL_ELPG_PROGRAM);
|
||||
value &= ~XUSB_PADCTL_ELPG_PROGRAM_AUX_MUX_LP0_VCORE_DOWN;
|
||||
padctl_writel(padctl, value, XUSB_PADCTL_ELPG_PROGRAM);
|
||||
|
||||
out:
|
||||
mutex_unlock(&padctl->lock);
|
||||
}
|
||||
|
||||
static void tegra_xusb_padctl_disable(struct tegra_xusb_padctl *padctl)
|
||||
{
|
||||
u32 value;
|
||||
|
||||
mutex_lock(&padctl->lock);
|
||||
guard(mutex)(&padctl->lock);
|
||||
|
||||
if (WARN_ON(padctl->enable == 0))
|
||||
goto out;
|
||||
return;
|
||||
|
||||
if (--padctl->enable > 0)
|
||||
goto out;
|
||||
return;
|
||||
|
||||
value = padctl_readl(padctl, XUSB_PADCTL_ELPG_PROGRAM);
|
||||
value |= XUSB_PADCTL_ELPG_PROGRAM_AUX_MUX_LP0_VCORE_DOWN;
|
||||
|
|
@ -530,9 +527,6 @@ static void tegra_xusb_padctl_disable(struct tegra_xusb_padctl *padctl)
|
|||
value = padctl_readl(padctl, XUSB_PADCTL_ELPG_PROGRAM);
|
||||
value |= XUSB_PADCTL_ELPG_PROGRAM_AUX_MUX_LP0_CLAMP_EN;
|
||||
padctl_writel(padctl, value, XUSB_PADCTL_ELPG_PROGRAM);
|
||||
|
||||
out:
|
||||
mutex_unlock(&padctl->lock);
|
||||
}
|
||||
|
||||
static int tegra_xusb_phy_init(struct phy *phy)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user