Browse files

hwspinlock/core: use global ID to register hwspinlocks on multiple de…


commit 476a7ee upstream.

Commit 300bab9 (hwspinlock/core: register a bank of hwspinlocks in a
single API call, 2011-09-06) introduced 'hwspin_lock_register_single()'
to register numerous (a bank of) hwspinlock instances in a single API,

At which time, 'hwspin_lock_register()' accidentally passes 'local IDs'
to 'hwspin_lock_register_single()', despite that ..._single() requires
'global IDs' to register hwspinlocks.

We have to convert into global IDs by supplying the missing 'base_id'.

Signed-off-by: Shinya Kuribayashi <>
[ohad: fix error path of hwspin_lock_register, too]
Signed-off-by: Ohad Ben-Cohen <>
Signed-off-by: Ben Hutchings <>
  • Loading branch information...
1 parent c4c5d62 commit 1e1cdddbadc5f3044882127f3931a19f48b1a69b Shinya Kuribayashi committed with bwhacks Jul 7, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 drivers/hwspinlock/hwspinlock_core.c
4 drivers/hwspinlock/hwspinlock_core.c
@@ -345,7 +345,7 @@ int hwspin_lock_register(struct hwspinlock_device *bank, struct device *dev,
hwlock->bank = bank;
- ret = hwspin_lock_register_single(hwlock, i);
+ ret = hwspin_lock_register_single(hwlock, base_id + i);
if (ret)
goto reg_failed;
@@ -354,7 +354,7 @@ int hwspin_lock_register(struct hwspinlock_device *bank, struct device *dev,
while (--i >= 0)
- hwspin_lock_unregister_single(i);
+ hwspin_lock_unregister_single(base_id + i);
return ret;

0 comments on commit 1e1cddd

Please sign in to comment.