Skip to content

Commit

Permalink
hwspinlock: u8500_hsem: Use devm_hwspin_lock_register() to register h…
Browse files Browse the repository at this point in the history
…wlock controller

Use devm_hwspin_lock_register() to register the hwlock controller instead of
unregistering the hwlock controller explicitly when removing the device.

Reviewed-by: Linus Walleij <[email protected]>
Signed-off-by: Baolin Wang <[email protected]>
Signed-off-by: Bjorn Andersson <[email protected]>
  • Loading branch information
wangbaolin719 authored and andersson committed Oct 5, 2019
1 parent 637bcd1 commit acc98c1
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions drivers/hwspinlock/u8500_hsem.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ static int u8500_hsem_probe(struct platform_device *pdev)
/* no pm needed for HSem but required to comply with hwspilock core */
pm_runtime_enable(&pdev->dev);

ret = hwspin_lock_register(bank, &pdev->dev, &u8500_hwspinlock_ops,
pdata->base_id, num_locks);
ret = devm_hwspin_lock_register(&pdev->dev, bank, &u8500_hwspinlock_ops,
pdata->base_id, num_locks);
if (ret) {
pm_runtime_disable(&pdev->dev);
return ret;
Expand All @@ -133,17 +133,10 @@ static int u8500_hsem_remove(struct platform_device *pdev)
{
struct hwspinlock_device *bank = platform_get_drvdata(pdev);
void __iomem *io_base = bank->lock[0].priv - HSEM_REGISTER_OFFSET;
int ret;

/* clear all interrupts */
writel(0xFFFF, io_base + HSEM_ICRALL);

ret = hwspin_lock_unregister(bank);
if (ret) {
dev_err(&pdev->dev, "%s failed: %d\n", __func__, ret);
return ret;
}

pm_runtime_disable(&pdev->dev);

return 0;
Expand Down

0 comments on commit acc98c1

Please sign in to comment.