b/drivers/hwspinlock/hwspinlock_core.c
@@ -425,6 +425,42 @@ static int hwspinlock_device_add(struct
hwspinlock_device *bank)
return ret;
}
+static void hwspin_mark_reserved_locks(struct hwspinlock_device *bank)
+{
+ struct device_node *np = bank->dev->of_node;
+ const char *prop_name = "hwlocks";
+ const char *cells_name = "#hwlock-cells";
+ struct device_node *node = NULL;
+ struct of_phandle_args args;
+ struct hwspinlock *hwlock;
+ int i, id, count, ret;
+
+ for_each_node_with_property(node, prop_name) {
+ count = of_count_phandle_with_args(node, prop_name,
cells_name);
+ if (count <= 0)
+ continue;
+
+ for (i = 0; i < count; i++) {
+ ret = of_parse_phandle_with_args(node, prop_name,
+ cells_name, i,
&args);
+ if (ret || np != args.np)
+ continue;
+
+ id = bank->ops->of_xlate(bank, &args);
+ if (id < 0 || id >= bank->num_locks)
+ continue;
+
+ hwlock = &bank->lock[id];
+ if (hwlock->type == HWSPINLOCK_RESERVED) {
+ dev_err(bank->dev, "potential reuse of
hwspinlock %d between multiple clients on %s\n",
+ id, np->full_name);
+ continue;
+ }
+ hwlock->type = HWSPINLOCK_RESERVED;
+ }
+ }
+}