Skip to content

Commit

Permalink
hwspinlock: Let the PM runtime can be optional
Browse files Browse the repository at this point in the history
Now some hwspinlock controllers did not have the requirement to implement
the PM runtime, but drivers must enable the PM runtime to comply with the
hwspinlock core.

Thus we can change the PM runtime support to be optional by validating
the -EACCES error number which means the PM runtime is not enabled, and
removing the return value validating of pm_runtime_put(). So that we
can remove some redundant PM runtime code in drivers.

Signed-off-by: Baolin Wang <[email protected]>
Signed-off-by: Bjorn Andersson <[email protected]>
  • Loading branch information
wangbaolin719 authored and andersson committed Nov 9, 2019
1 parent b2547dc commit a6fc490
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/hwspinlock/hwspinlock_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -657,13 +657,15 @@ static int __hwspin_lock_request(struct hwspinlock *hwlock)

/* notify PM core that power is now needed */
ret = pm_runtime_get_sync(dev);
if (ret < 0) {
if (ret < 0 && ret != -EACCES) {
dev_err(dev, "%s: can't power on device\n", __func__);
pm_runtime_put_noidle(dev);
module_put(dev->driver->owner);
return ret;
}

ret = 0;

/* mark hwspinlock as used, should not fail */
tmp = radix_tree_tag_clear(&hwspinlock_tree, hwlock_to_id(hwlock),
HWSPINLOCK_UNUSED);
Expand Down Expand Up @@ -820,9 +822,7 @@ int hwspin_lock_free(struct hwspinlock *hwlock)
}

/* notify the underlying device that power is not needed */
ret = pm_runtime_put(dev);
if (ret < 0)
goto out;
pm_runtime_put(dev);

/* mark this hwspinlock as available */
tmp = radix_tree_tag_set(&hwspinlock_tree, hwlock_to_id(hwlock),
Expand Down

0 comments on commit a6fc490

Please sign in to comment.