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

Signed-off-by: Wolfram Sang <[email protected]>
---
 drivers/hwspinlock/omap_hwspinlock.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/hwspinlock/omap_hwspinlock.c 
b/drivers/hwspinlock/omap_hwspinlock.c
index adff502bcbc4..9a9cb3692348 100644
--- a/drivers/hwspinlock/omap_hwspinlock.c
+++ b/drivers/hwspinlock/omap_hwspinlock.c
@@ -66,10 +66,18 @@ static void omap_hwspinlock_relax(struct hwspinlock *lock)
        ndelay(50);
 }
 
+static void *omap_hwspinlock_init_priv(int local_id, void *init_data)
+{
+       void __iomem *io_base_ofs = init_data;
+
+       return io_base_ofs + 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 +124,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


Reply via email to