[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250728021151.115197-1-yujugen@huawei.com>
Date: Mon, 28 Jul 2025 10:11:51 +0800
From: Yu Jugen <yujugen@...wei.com>
To: <ohad@...ery.com>, <bjorn.andersson@...aro.org>, <baolin.wang7@...il.com>
CC: <linux-remoteproc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<nixiaoming@...wei.com>, <wangliang101@...wei.com>,
<yangkangming@...wei.com>, <yujugen@...wei.com>
Subject: [PATCH] hwspinlock: export structures that affects the KABI
From: Jugen Yu <yujugen@...wei.com>
The member "hwlock" in struct regmap is defined with struct hwspinlock.
Both regmap_write and regmap_read use struct regmap as a argument, so
their KABI are affected by the hwspinlock structures.
Signed-off-by: Jugen Yu <yujugen@...wei.com>
---
drivers/hwspinlock/hwspinlock_internal.h | 52 ------------------------
include/linux/hwspinlock.h | 50 ++++++++++++++++++++++-
2 files changed, 49 insertions(+), 53 deletions(-)
diff --git a/drivers/hwspinlock/hwspinlock_internal.h b/drivers/hwspinlock/hwspinlock_internal.h
index f298fc0ee5ad..3f22b73c8d50 100644
--- a/drivers/hwspinlock/hwspinlock_internal.h
+++ b/drivers/hwspinlock/hwspinlock_internal.h
@@ -10,58 +10,6 @@
#ifndef __HWSPINLOCK_HWSPINLOCK_H
#define __HWSPINLOCK_HWSPINLOCK_H
-#include <linux/spinlock.h>
-#include <linux/device.h>
-
-struct hwspinlock_device;
-
-/**
- * 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.
- */
-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);
-};
-
-/**
- * struct hwspinlock - this struct represents a single hwspinlock instance
- * @bank: the hwspinlock_device structure which owns this lock
- * @lock: initialized and used by hwspinlock core
- * @priv: private data, owned by the underlying platform-specific hwspinlock drv
- */
-struct hwspinlock {
- struct hwspinlock_device *bank;
- spinlock_t lock;
- void *priv;
-};
-
-/**
- * struct hwspinlock_device - a device which usually spans numerous hwspinlocks
- * @dev: underlying device, will be used to invoke runtime PM api
- * @ops: platform-specific hwspinlock handlers
- * @base_id: id index of the first lock in this device
- * @num_locks: number of locks in this device
- * @lock: dynamically allocated array of 'struct hwspinlock'
- */
-struct hwspinlock_device {
- struct device *dev;
- const struct hwspinlock_ops *ops;
- int base_id;
- int num_locks;
- struct hwspinlock lock[];
-};
-
static inline int hwlock_to_id(struct hwspinlock *hwlock)
{
int local_id = hwlock - &hwlock->bank->lock[0];
diff --git a/include/linux/hwspinlock.h b/include/linux/hwspinlock.h
index f0231dbc4777..5c95cec031fb 100644
--- a/include/linux/hwspinlock.h
+++ b/include/linux/hwspinlock.h
@@ -12,6 +12,8 @@
#include <linux/err.h>
#include <linux/sched.h>
+#include <linux/spinlock.h>
+#include <linux/device.h>
/* hwspinlock mode argument */
#define HWLOCK_IRQSTATE 0x01 /* Disable interrupts, save state */
@@ -23,7 +25,53 @@ struct device;
struct device_node;
struct hwspinlock;
struct hwspinlock_device;
-struct hwspinlock_ops;
+
+/**
+ * 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.
+ */
+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);
+};
+
+/**
+ * struct hwspinlock - this struct represents a single hwspinlock instance
+ * @bank: the hwspinlock_device structure which owns this lock
+ * @lock: initialized and used by hwspinlock core
+ * @priv: private data, owned by the underlying platform-specific hwspinlock drv
+ */
+struct hwspinlock {
+ struct hwspinlock_device *bank;
+ spinlock_t lock;
+ void *priv;
+};
+
+/**
+ * struct hwspinlock_device - a device which usually spans numerous hwspinlocks
+ * @dev: underlying device, will be used to invoke runtime PM api
+ * @ops: platform-specific hwspinlock handlers
+ * @base_id: id index of the first lock in this device
+ * @num_locks: number of locks in this device
+ * @lock: dynamically allocated array of 'struct hwspinlock'
+ */
+struct hwspinlock_device {
+ struct device *dev;
+ const struct hwspinlock_ops *ops;
+ int base_id;
+ int num_locks;
+ struct hwspinlock lock[];
+};
/**
* struct hwspinlock_pdata - platform data for hwspinlock drivers
--
2.37.7
Powered by blists - more mailing lists