From nobody Mon Apr 6 13:01:24 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 368643CA4AD for ; Thu, 19 Mar 2026 11:00:29 +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=1773918037; cv=none; b=J7t+V6hzalzeF4zJDHlk28AtLx0uRJbj0olgdjn86GO7IfQReuuZx2U4oAb7EO8gnvGE28ipvoByID8eBk/aORPTaDyI/Jg1EN1+m4NSxm+YD4fz1HbDYpPrZ8C2Y1kcKP3UBlcmfx91uK6EcfaJACenv67IFY0oRXwveUulSeo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773918037; c=relaxed/simple; bh=Qq0o4FNNvBG/mWOA0PE9lYgDNYmGuDSBq6pajGH3Bx0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ka0tMwczCk6UE7cBDVqTgAEbE8+5qCYPWixYLsagZsp/MQaPBXBPyPhrteL/4VzSnlVzo6ujWYKdIN3s2v4hz8N4OFWsHvD8fsNrBbRRGlp2V1E5uZIqXqyHpAOdN1Hzevkf+V5Ej+ZNOLbmlN33bbnvqYZUquNKUBvFcPTQqaA= 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=aUUAA+TI; 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="aUUAA+TI" 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=2njF1crk5JYsuohHYtW2T9uqDGU7n8lPKWVOP57dVMM=; b=aUUAA+ TIQCX0SJ4pwNyGnHcH0zdCPfLwTWLGDHElsPMF9Ilpu25xYdzGWSOVuOv8sk4aHl smE69sqboqQY9qeCEAW9pn/aMaEIONIEfygCV6MFDpCke67nmnkkgL9+SrJrTWdI Fk6W7yWEOz1FVBXo1TBgzFag76Q8y+Kf9xsOfuQdmbEZIgD/KfRqXDMCcVNluwl/ apT+Lso2+LBs4YnxOp9WV2vTgIa9vIjiXxvMt7gJFZrwxcr7dlztwyx+5ygqV0nQ JZbCWNk0uBEHrqXerCS6/G27bE61SBY0aSzTQ19mdG5NbUSfyHScytsOE+f60u82 S93eOd3pxgDrJy2g== Received: (qmail 1099899 invoked from network); 19 Mar 2026 12:00:08 +0100 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 19 Mar 2026 12:00:08 +0100 X-UD-Smtp-Session: l3s3148p1@MEzEeF5NuK0gAwDPXzF+ANZpdrMKUeLI 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 v5 11/15] hwspinlock: move entries from internal to public header Date: Thu, 19 Mar 2026 11:59:33 +0100 Message-ID: <20260319105947.6237-12-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260319105947.6237-1-wsa+renesas@sang-engineering.com> References: <20260319105947.6237-1-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 Acked-by: Chen-Yu Tsai # for sun6i --- 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 87ab30614e1d..41a8812708ef 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 bbae37e25243..0f4fc622e3cd 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 ed937bc26bf5..8eafe1a74b1b 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 8bbed23af5f4..145d284c5ab5 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