From: Wolfram Sang <wsa+renesas@sang-engineering.com>
To: linux-renesas-soc@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
Wolfram Sang <wsa+renesas@sang-engineering.com>,
Chen-Yu Tsai <wens@kernel.org>,
Wilken Gottwalt <wilken.gottwalt@posteo.net>,
Bjorn Andersson <andersson@kernel.org>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Samuel Holland <samuel@sholland.org>,
linux-remoteproc@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev
Subject: [PATCH v5 09/15] hwspinlock: sun6i: use new callback to initialize hwspinlock priv
Date: Thu, 19 Mar 2026 11:59:31 +0100 [thread overview]
Message-ID: <20260319105947.6237-10-wsa+renesas@sang-engineering.com> (raw)
In-Reply-To: <20260319105947.6237-1-wsa+renesas@sang-engineering.com>
Apply the new helper to avoid using internal structures from the core.
Remove superfluous setting of drvdata while here.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Chen-Yu Tsai <wens@kernel.org>
---
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);
--
2.51.0
next prev parent reply other threads:[~2026-03-19 11:00 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-19 10:59 [PATCH v5 00/15] hwspinlock: move device alloc into core and refactor includes Wolfram Sang
2026-03-19 10:59 ` [PATCH v5 01/15] hwspinlock: u8500: delete driver Wolfram Sang
2026-03-19 10:59 ` [PATCH v5 02/15] hwspinlock: remove now unused pdata from header file Wolfram Sang
2026-03-19 10:59 ` [PATCH v5 03/15] hwspinlock: add helpers to retrieve core data Wolfram Sang
2026-03-19 10:59 ` [PATCH v5 04/15] hwspinlock: add callback to fill private data of a hwspinlock Wolfram Sang
2026-03-19 13:07 ` Chen-Yu Tsai
2026-03-19 10:59 ` [PATCH v5 05/15] hwspinlock: omap: use new callback to initialize hwspinlock priv Wolfram Sang
2026-03-19 10:59 ` [PATCH v5 06/15] hwspinlock: qcom: " Wolfram Sang
2026-03-19 10:59 ` [PATCH v5 07/15] hwspinlock: sprd: " Wolfram Sang
2026-03-19 10:59 ` [PATCH v5 08/15] hwspinlock: stm32: " Wolfram Sang
2026-03-19 10:59 ` Wolfram Sang [this message]
2026-03-19 10:59 ` [PATCH v5 10/15] hwspinlock: handle hwspinlock device allocation in the core Wolfram Sang
2026-03-19 13:09 ` Chen-Yu Tsai
2026-03-19 10:59 ` [PATCH v5 11/15] hwspinlock: move entries from internal to public header Wolfram Sang
2026-03-19 13:09 ` Chen-Yu Tsai
2026-03-19 10:59 ` [PATCH v5 12/15] hwspinlock: remove internal header Wolfram Sang
2026-03-19 10:59 ` [PATCH v5 13/15] hwspinlock: sort include and update copyright Wolfram Sang
2026-03-19 10:59 ` [PATCH v5 14/15] hwspinlock: refactor provider.h from public header Wolfram Sang
2026-03-19 13:10 ` Chen-Yu Tsai
2026-03-19 10:59 ` [PATCH v5 15/15] hwspinlock/treewide: refactor consumer.h " Wolfram Sang
2026-03-27 11:43 ` [PATCH v5 00/15] hwspinlock: move device alloc into core and refactor includes Wolfram Sang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260319105947.6237-10-wsa+renesas@sang-engineering.com \
--to=wsa+renesas@sang-engineering.com \
--cc=andersson@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=jernej.skrabec@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=samuel@sholland.org \
--cc=wens@kernel.org \
--cc=wilken.gottwalt@posteo.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®