On Tue, Mar 10, 2026 at 3:56 PM Wolfram Sang <[email protected]> wrote: > > Apply the new helper to avoid using internal structures from the core. > Remove superfluous setting of drvdata while here. > > Signed-off-by: Wolfram Sang <[email protected]> > Reviewed-by: Chen-Yu Tsai <[email protected]> > --- > drivers/hwspinlock/sun6i_hwspinlock.c | 18 ++++++++---------- > 1 file changed, 8 insertions(+), 10 deletions(-) > > diff --git a/drivers/hwspinlock/sun6i_hwspinlock.c > b/drivers/hwspinlock/sun6i_hwspinlock.c > index a0c76bba3f05..c3db81cb1793 100644 > --- a/drivers/hwspinlock/sun6i_hwspinlock.c > +++ b/drivers/hwspinlock/sun6i_hwspinlock.c > @@ -74,9 +74,15 @@ static void sun6i_hwspinlock_unlock(struct hwspinlock > *lock) > writel(SPINLOCK_NOTTAKEN, lock_addr); > } > > +static void *sun6i_hwspinlock_init_priv(int local_id, void *init_data) > +{ > + return init_data + sizeof(u32) * local_id; > +} > + > static const struct hwspinlock_ops sun6i_hwspinlock_ops = { > .trylock = sun6i_hwspinlock_trylock, > .unlock = sun6i_hwspinlock_unlock, > + .init_priv = sun6i_hwspinlock_init_priv, > }; > > static void sun6i_hwspinlock_disable(void *data) > @@ -91,10 +97,9 @@ static void sun6i_hwspinlock_disable(void *data) > static int sun6i_hwspinlock_probe(struct platform_device *pdev) > { > struct sun6i_hwspinlock_data *priv; > - struct hwspinlock *hwlock; > void __iomem *io_base; > u32 num_banks; > - int err, i; > + int err; > > io_base = devm_platform_ioremap_resource(pdev, SPINLOCK_BASE_ID); > if (IS_ERR(io_base)) > @@ -161,11 +166,6 @@ static int sun6i_hwspinlock_probe(struct platform_device > *pdev) > goto bank_fail; > } > > - for (i = 0; i < priv->nlocks; ++i) { > - hwlock = &priv->bank->lock[i]; > - hwlock->priv = io_base + SPINLOCK_LOCK_REGN + sizeof(u32) * i; > - } > - > /* failure of debugfs is considered non-fatal */ > sun6i_hwspinlock_debugfs_init(priv); > if (IS_ERR(priv->debugfs)) > @@ -177,10 +177,8 @@ static int sun6i_hwspinlock_probe(struct platform_device > *pdev) > goto bank_fail; > } > > - platform_set_drvdata(pdev, priv); > - > return devm_hwspin_lock_register(&pdev->dev, priv->bank, > &sun6i_hwspinlock_ops, > - SPINLOCK_BASE_ID, priv->nlocks, > NULL); > + SPINLOCK_BASE_ID, priv->nlocks, > io_base + SPINLOCK_LOCK_REGN); > > bank_fail: > clk_disable_unprepare(priv->ahb_clk);
Just a note, I see further code savings in using the clk and reset devm_ helpers. I'll do this after this series is merged, as the context overlaps. ChenYu

