[PATCH v5 05/15] hwspinlock: omap: use new callback to initialize hwspinlock priv

From: Wolfram Sang

Date: Thu Mar 19 2026 - 07:00:57 EST


Apply the new helper to avoid using internal structures from the core.

Signed-off-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>
---
drivers/hwspinlock/omap_hwspinlock.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/hwspinlock/omap_hwspinlock.c b/drivers/hwspinlock/omap_hwspinlock.c
index adff502bcbc4..868b93131796 100644
--- a/drivers/hwspinlock/omap_hwspinlock.c
+++ b/drivers/hwspinlock/omap_hwspinlock.c
@@ -66,10 +66,16 @@ static void omap_hwspinlock_relax(struct hwspinlock *lock)
ndelay(50);
}

+static void *omap_hwspinlock_init_priv(int local_id, void *init_data)
+{
+ return init_data + sizeof(u32) * local_id;
+}
+
static const struct hwspinlock_ops omap_hwspinlock_ops = {
.trylock = omap_hwspinlock_trylock,
.unlock = omap_hwspinlock_unlock,
.relax = omap_hwspinlock_relax,
+ .init_priv = omap_hwspinlock_init_priv,
};

static int omap_hwspinlock_probe(struct platform_device *pdev)
@@ -116,11 +122,8 @@ static int omap_hwspinlock_probe(struct platform_device *pdev)
if (!bank)
return -ENOMEM;

- for (i = 0; i < num_locks; i++)
- bank->lock[i].priv = io_base + LOCK_BASE_OFFSET + sizeof(u32) * i;
-
return devm_hwspin_lock_register(&pdev->dev, bank, &omap_hwspinlock_ops,
- base_id, num_locks, NULL);
+ base_id, num_locks, io_base + LOCK_BASE_OFFSET);
}

static const struct of_device_id omap_hwspinlock_of_match[] = {
--
2.51.0