From nobody Thu Apr 9 19:20:16 2026 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 A70E348A2A4 for ; Tue, 3 Mar 2026 19:31:57 +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=1772566320; cv=none; b=lRubz8IOyQhLQrnCKsdchO7RJTRBoBTDSYhdSA4HQbuh8pk9FdSR3iRloRDQKLu2yhce3EPFtwpc0dzGrmLapKrHEh41eWZECPL608Xi1WKvUwcGsN4gyVy0lpr3XUjp5QjtkkbqqUstC43B7bXWIhomI8tj5pxJoaKlrP73aHw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772566320; c=relaxed/simple; bh=uzc3fyoi8FSR6bwgllT3vuutQc1YoByfPGRM76QKxto=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iYE00KDef3r+u7dn/zagpWqANIks8KL7JVOyeC6m+dXVoB7TYibUb2IJDBWrU08zCBSL46HOMQhk5/89i0N9HGPAidhsTKWpMQyyE1TDaoOKY6v8+QudP89p3tNeFlEvSTpBZvwC0SGv4eotsyav14z/3oF3zdHix2FOc/d3JaE= 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=AgMxdyKn; 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="AgMxdyKn" 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=huat1Y/wJ/zb768/t+yGa5XgKV25MRf5vTJTHiQcbnY=; b=AgMxdy KnDr6M+97zchJTQOZmBtEyKGpf5Kwm/4G1kAzt3yez5fujjTuGyc8mCPpmJDOOuv uHkdw3H0FNHIvVuEBk3EWKlStqQbVdi2w9rjOiVTD5N7S3S5tFsDH5i0zW6u075I J7/DBeBNqJoWAvuoV5KvVYImcWcmuA0AkEY6gLzaeaw0QncLREXWMoQVib84PKm5 aPnvhDw6Gj05D2vshFEhXKnCfoumEF/1Ar1yrUXUbipqKXY83RpJ50HLJ/dylQrM 02ktwynLlcTysaGvvOfZN9iUfxgp7BjH7XHP6XDLAfS8DpPm/jddxV5ic/zUJSgw NtYnip+yGb8exfBw== Received: (qmail 430691 invoked from network); 3 Mar 2026 20:31:37 +0100 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 3 Mar 2026 20:31:37 +0100 X-UD-Smtp-Session: l3s3148p1@V9eCwCNMJKgujnu+ From: Wolfram Sang To: linux-renesas-soc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Wolfram Sang , Bjorn Andersson , Baolin Wang , Orson Zhai , Chunyan Zhang , Maxime Coquelin , Alexandre Torgue , Wilken Gottwalt , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , linux-remoteproc@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Subject: [PATCH v3 11/15] hwspinlock: move entries from internal to public header Date: Tue, 3 Mar 2026 20:26:03 +0100 Message-ID: <20260303192600.7224-28-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260303192600.7224-17-wsa+renesas@sang-engineering.com> References: <20260303192600.7224-17-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Providers need the ops-structure and the hwlock_to_id-function. Move these entries to the public header. With this change, all providers are also updated to use the public header only. The internal header is now used by the core only. Signed-off-by: Wolfram Sang --- drivers/hwspinlock/hwspinlock_core.c | 8 +++++++ drivers/hwspinlock/hwspinlock_internal.h | 29 ------------------------ drivers/hwspinlock/omap_hwspinlock.c | 2 -- drivers/hwspinlock/qcom_hwspinlock.c | 2 -- drivers/hwspinlock/sprd_hwspinlock.c | 2 -- drivers/hwspinlock/stm32_hwspinlock.c | 2 -- drivers/hwspinlock/sun6i_hwspinlock.c | 2 -- include/linux/hwspinlock.h | 23 +++++++++++++++++++ 8 files changed, 31 insertions(+), 39 deletions(-) diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwsp= inlock_core.c index a7610ba755b4..e0227d027cf2 100644 --- a/drivers/hwspinlock/hwspinlock_core.c +++ b/drivers/hwspinlock/hwspinlock_core.c @@ -915,5 +915,13 @@ struct device *hwspin_lock_get_dev(struct hwspinlock *= hwlock) } EXPORT_SYMBOL_GPL(hwspin_lock_get_dev); =20 +int hwlock_to_id(struct hwspinlock *hwlock) +{ + int local_id =3D hwlock - &hwlock->bank->lock[0]; + + return hwlock->bank->base_id + local_id; +} +EXPORT_SYMBOL_GPL(hwlock_to_id); + MODULE_DESCRIPTION("Hardware spinlock interface"); MODULE_AUTHOR("Ohad Ben-Cohen "); diff --git a/drivers/hwspinlock/hwspinlock_internal.h b/drivers/hwspinlock/= hwspinlock_internal.h index 3c835d96bf86..20ae531fc389 100644 --- a/drivers/hwspinlock/hwspinlock_internal.h +++ b/drivers/hwspinlock/hwspinlock_internal.h @@ -15,28 +15,6 @@ =20 struct hwspinlock_device; =20 -/** - * struct hwspinlock_ops - platform-specific hwspinlock handlers - * - * @trylock: make a single attempt to take the lock. returns 0 on - * failure and true on success. may _not_ sleep. - * @unlock: release the lock. always succeed. may _not_ sleep. - * @bust: optional, platform-specific bust handler, called by hwspinlock - * core to bust a specific lock. - * @relax: optional, platform-specific relax handler, called by hwspinlock - * core while spinning on a lock, between two successive - * invocations of @trylock. may _not_ sleep. - * @init_priv: optional, callback used when registering the hwspinlock dev= ice. - * Its return value will be used to fill the per-lock 'priv' data. - */ -struct hwspinlock_ops { - int (*trylock)(struct hwspinlock *lock); - void (*unlock)(struct hwspinlock *lock); - int (*bust)(struct hwspinlock *lock, unsigned int id); - void (*relax)(struct hwspinlock *lock); - void *(*init_priv)(int local_id, void *init_data); -}; - /** * struct hwspinlock - this struct represents a single hwspinlock instance * @bank: the hwspinlock_device structure which owns this lock @@ -65,11 +43,4 @@ struct hwspinlock_device { struct hwspinlock lock[]; }; =20 -static inline int hwlock_to_id(struct hwspinlock *hwlock) -{ - int local_id =3D hwlock - &hwlock->bank->lock[0]; - - return hwlock->bank->base_id + local_id; -} - #endif /* __HWSPINLOCK_HWSPINLOCK_H */ diff --git a/drivers/hwspinlock/omap_hwspinlock.c b/drivers/hwspinlock/omap= _hwspinlock.c index f1ff6406db46..96fdc35ef642 100644 --- a/drivers/hwspinlock/omap_hwspinlock.c +++ b/drivers/hwspinlock/omap_hwspinlock.c @@ -23,8 +23,6 @@ #include #include =20 -#include "hwspinlock_internal.h" - /* Spinlock register offsets */ #define SYSSTATUS_OFFSET 0x0014 #define LOCK_BASE_OFFSET 0x0800 diff --git a/drivers/hwspinlock/qcom_hwspinlock.c b/drivers/hwspinlock/qcom= _hwspinlock.c index e2836d6728e8..22cc6f9003df 100644 --- a/drivers/hwspinlock/qcom_hwspinlock.c +++ b/drivers/hwspinlock/qcom_hwspinlock.c @@ -14,8 +14,6 @@ #include #include =20 -#include "hwspinlock_internal.h" - #define QCOM_MUTEX_APPS_PROC_ID 1 #define QCOM_MUTEX_NUM_LOCKS 32 =20 diff --git a/drivers/hwspinlock/sprd_hwspinlock.c b/drivers/hwspinlock/sprd= _hwspinlock.c index 95b254e9b6a0..d2aa4714e2ea 100644 --- a/drivers/hwspinlock/sprd_hwspinlock.c +++ b/drivers/hwspinlock/sprd_hwspinlock.c @@ -15,8 +15,6 @@ #include #include =20 -#include "hwspinlock_internal.h" - /* hwspinlock registers definition */ #define HWSPINLOCK_RECCTRL 0x4 #define HWSPINLOCK_MASTERID(_X_) (0x80 + 0x4 * (_X_)) diff --git a/drivers/hwspinlock/stm32_hwspinlock.c b/drivers/hwspinlock/stm= 32_hwspinlock.c index a966e967dcdb..08762cd96cee 100644 --- a/drivers/hwspinlock/stm32_hwspinlock.c +++ b/drivers/hwspinlock/stm32_hwspinlock.c @@ -14,8 +14,6 @@ #include #include =20 -#include "hwspinlock_internal.h" - #define STM32_MUTEX_COREID BIT(8) #define STM32_MUTEX_LOCK_BIT BIT(31) #define STM32_MUTEX_NUM_LOCKS 32 diff --git a/drivers/hwspinlock/sun6i_hwspinlock.c b/drivers/hwspinlock/sun= 6i_hwspinlock.c index 8e17deb503c7..5c6d20eb24b5 100644 --- a/drivers/hwspinlock/sun6i_hwspinlock.c +++ b/drivers/hwspinlock/sun6i_hwspinlock.c @@ -17,8 +17,6 @@ #include #include =20 -#include "hwspinlock_internal.h" - #define DRIVER_NAME "sun6i_hwspinlock" =20 #define SPINLOCK_BASE_ID 0 /* there is only one hwspinlock device per SoC = */ diff --git a/include/linux/hwspinlock.h b/include/linux/hwspinlock.h index 58733cda7a9a..4f5b6932712e 100644 --- a/include/linux/hwspinlock.h +++ b/include/linux/hwspinlock.h @@ -27,8 +27,31 @@ struct hwspinlock_ops; =20 #ifdef CONFIG_HWSPINLOCK =20 +/** + * struct hwspinlock_ops - platform-specific hwspinlock handlers + * + * @trylock: make a single attempt to take the lock. returns 0 on + * failure and true on success. may _not_ sleep. + * @unlock: release the lock. always succeed. may _not_ sleep. + * @bust: optional, platform-specific bust handler, called by hwspinlock + * core to bust a specific lock. + * @relax: optional, platform-specific relax handler, called by hwspinlock + * core while spinning on a lock, between two successive + * invocations of @trylock. may _not_ sleep. + * @init_priv: optional, callback used when registering the hwspinlock dev= ice. + * Its return value will be used to fill the per-lock 'priv' data. + */ +struct hwspinlock_ops { + int (*trylock)(struct hwspinlock *lock); + void (*unlock)(struct hwspinlock *lock); + int (*bust)(struct hwspinlock *lock, unsigned int id); + void (*relax)(struct hwspinlock *lock); + void *(*init_priv)(int local_id, void *init_data); +}; + void *hwspin_lock_get_priv(struct hwspinlock *hwlock); struct device *hwspin_lock_get_dev(struct hwspinlock *hwlock); +int hwlock_to_id(struct hwspinlock *hwlock); struct hwspinlock_device *hwspin_lock_register(struct device *dev, const s= truct hwspinlock_ops *ops, int base_id, int num_locks, void *init_data); int hwspin_lock_unregister(struct hwspinlock_device *bank); --=20 2.51.0