diff options
author | Baolin Wang <baolin.wang@linaro.org> | 2019-09-27 15:10:46 +0800 |
---|---|---|
committer | Bjorn Andersson <bjorn.andersson@linaro.org> | 2019-10-04 21:09:52 -0700 |
commit | b4d64193d41e52a5d35923bc5a0772d9de250092 (patch) | |
tree | 94157766c73ab2605c719b75f719aa5a3f0cb2ca /drivers/hwspinlock | |
parent | 3070c41643609c66d33de3577fc9d8ca15932513 (diff) | |
download | lwn-b4d64193d41e52a5d35923bc5a0772d9de250092.tar.gz lwn-b4d64193d41e52a5d35923bc5a0772d9de250092.zip |
hwspinlock: sprd: Use devm_add_action_or_reset() for calls to clk_disable_unprepare()
Use devm_add_action_or_reset() for calls to clk_disable_unprepare(),
which can simplify the error handling.
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'drivers/hwspinlock')
-rw-r--r-- | drivers/hwspinlock/sprd_hwspinlock.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/hwspinlock/sprd_hwspinlock.c b/drivers/hwspinlock/sprd_hwspinlock.c index d2104248013b..e76c702f64de 100644 --- a/drivers/hwspinlock/sprd_hwspinlock.c +++ b/drivers/hwspinlock/sprd_hwspinlock.c @@ -79,6 +79,13 @@ static const struct hwspinlock_ops sprd_hwspinlock_ops = { .relax = sprd_hwspinlock_relax, }; +static void sprd_hwspinlock_disable(void *data) +{ + struct sprd_hwspinlock_dev *sprd_hwlock = data; + + clk_disable_unprepare(sprd_hwlock->clk); +} + static int sprd_hwspinlock_probe(struct platform_device *pdev) { struct sprd_hwspinlock_dev *sprd_hwlock; @@ -109,6 +116,14 @@ static int sprd_hwspinlock_probe(struct platform_device *pdev) if (ret) return ret; + ret = devm_add_action_or_reset(&pdev->dev, sprd_hwspinlock_disable, + sprd_hwlock); + if (ret) { + dev_err(&pdev->dev, + "Failed to add hwspinlock disable action\n"); + return ret; + } + /* set the hwspinlock to record user id to identify subsystems */ writel(HWSPINLOCK_USER_BITS, sprd_hwlock->base + HWSPINLOCK_RECCTRL); @@ -124,7 +139,6 @@ static int sprd_hwspinlock_probe(struct platform_device *pdev) &sprd_hwspinlock_ops, 0, SPRD_HWLOCKS_NUM); if (ret) { pm_runtime_disable(&pdev->dev); - clk_disable_unprepare(sprd_hwlock->clk); return ret; } @@ -137,7 +151,6 @@ static int sprd_hwspinlock_remove(struct platform_device *pdev) hwspin_lock_unregister(&sprd_hwlock->bank); pm_runtime_disable(&pdev->dev); - clk_disable_unprepare(sprd_hwlock->clk); return 0; } |