From patchwork Sun Feb 15 22:54:47 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 449 Received: from mail.zeus03.de (zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E660730B53B for ; Sun, 15 Feb 2026 22:55:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771196130; cv=none; b=l3MDSPcWjmGHP2Esw/H10d7z0lSjqat/Ly9CrxATCEOPGKI1nXG5MICXRq8gFaC/qITwXRWY1zG2MknN1pzXnVeb5buGSm6XeIAyGiQuB2w8afdfy0+09zw1zIWW82iB7pKXPPQNvADLamPrOZMUQjWROFJrQJJc114NQNj6mvA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771196130; c=relaxed/simple; bh=OG3F3DPzsyur1bsJvpPZ62ALOswPTRmdYs02gUy2bho=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=t6mbsgLWfeZmZWZlDNbK7uGGZTtyMmlIYPhGeKxrhl/90QEhE+qF/m1w1aO945Xwpuib/sZPKk5tST7z+0xPsQ5px4CDC7rBXdGW/OcUI9xy1+ypipX0Idd7O9V3LRE0P/YgGH2H76u3NnTfvKEKGwg+LVTniLbgvvFYeoqVxT0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=NtkXmGX1; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="NtkXmGX1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=YFkjV39h9bUTsT9T2mmQ33w6bCMkVVVBeqpoOYjV1AY=; b=NtkXmG X18CRt1bIaz1PA5hfD6uvx/rt6Wey1hMiI84/CxBFaF+SkOBQAnUzsDw2yq0/s2N OtIwPB6Hhjxv3PB2c+mohROVCjWBWC8TPRhONWSjuo3EOzpAwJdF30fBFy7VwDUy NrjdI1Uogy26hFLXd9GgMDioKlbCr4OH1FnHJWz9/xoSv0Io6Wo2QY5IT6vSI12k 8KZrANuSkdD9bPejP8OjMvfY/VfqyRf7EJHnBU7DStysrhGJaBoHGtCv6e2phyLG h/+edhXklO56xPKELqEpCbTQcn41SXQ1PpaZBs4ReKXLm9pr+JjrJLPtr9s/DlTw w8kyMeZ8jGaFOVpA== Received: (qmail 3011465 invoked from network); 15 Feb 2026 23:55:12 +0100 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 15 Feb 2026 23:55:12 +0100 X-UD-Smtp-Session: l3s3148p1@mK8Su+RK5MAujns5 From: Wolfram Sang To: linux-renesas-soc@vger.kernel.org Cc: Andy Shevchenko , linux-arm-kernel@lists.infradead.org, Wolfram Sang , Wilken Gottwalt , Bjorn Andersson , Baolin Wang , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , linux-remoteproc@vger.kernel.org, linux-sunxi@lists.linux.dev Subject: [RFC PATCH v2 07/13] hwspinlock: sun6i: use new callback to initialize hwspinlock priv Date: Sun, 15 Feb 2026 23:54:47 +0100 Message-ID: <20260215225501.6365-8-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260215225501.6365-1-wsa+renesas@sang-engineering.com> References: <20260215225501.6365-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Status: O Apply the new helper to avoid using internal structures from the core. Remove superfluous setting of drvdata while here. Signed-off-by: Wolfram Sang --- drivers/hwspinlock/sun6i_hwspinlock.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/hwspinlock/sun6i_hwspinlock.c b/drivers/hwspinlock/sun6i_hwspinlock.c index 8ff81cb5880a..7d0c639c0e82 100644 --- a/drivers/hwspinlock/sun6i_hwspinlock.c +++ b/drivers/hwspinlock/sun6i_hwspinlock.c @@ -74,9 +74,17 @@ 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) +{ + void __iomem *io_base_ofs = init_data; + + return io_base_ofs + 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 +99,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 +168,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 +179,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); + SPINLOCK_BASE_ID, priv->nlocks, io_base + SPINLOCK_LOCK_REGN); bank_fail: clk_disable_unprepare(priv->ahb_clk);