summaryrefslogtreecommitdiffstats
path: root/include/linux/hwspinlock.h
diff options
context:
space:
mode:
authorBaolin Wang <baolin.wang@linaro.org>2018-06-22 16:08:59 +0800
committerBjorn Andersson <bjorn.andersson@linaro.org>2018-06-26 13:27:58 -0700
commit4f1acd758b08d93306d13010c74d38dd8d9f5768 (patch)
tree2e59dc9ca521e9a0720eef3313a881926b8b15d1 /include/linux/hwspinlock.h
parent5560f70cad996e7d90d1c141bcbca0df214eefc9 (diff)
downloadlinux-4f1acd758b08d93306d13010c74d38dd8d9f5768.tar.gz
linux-4f1acd758b08d93306d13010c74d38dd8d9f5768.tar.bz2
linux-4f1acd758b08d93306d13010c74d38dd8d9f5768.zip
hwspinlock: Add devm_xxx() APIs to request/free hwlock
This patch introduces some devm_xxx() APIs to help to request or free the hwlocks, which will help to simplify the cleanup code for drivers requesting one hwlock, ensuring that the hwlock is automatically freed whenever the device is unbound. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'include/linux/hwspinlock.h')
-rw-r--r--include/linux/hwspinlock.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/linux/hwspinlock.h b/include/linux/hwspinlock.h
index 2b6f389a3133..dfd05938a3cb 100644
--- a/include/linux/hwspinlock.h
+++ b/include/linux/hwspinlock.h
@@ -67,6 +67,10 @@ int __hwspin_lock_timeout(struct hwspinlock *, unsigned int, int,
int __hwspin_trylock(struct hwspinlock *, int, unsigned long *);
void __hwspin_unlock(struct hwspinlock *, int, unsigned long *);
int of_hwspin_lock_get_id_byname(struct device_node *np, const char *name);
+int devm_hwspin_lock_free(struct device *dev, struct hwspinlock *hwlock);
+struct hwspinlock *devm_hwspin_lock_request(struct device *dev);
+struct hwspinlock *devm_hwspin_lock_request_specific(struct device *dev,
+ unsigned int id);
#else /* !CONFIG_HWSPINLOCK */
@@ -132,6 +136,24 @@ int of_hwspin_lock_get_id_byname(struct device_node *np, const char *name)
return 0;
}
+static inline
+int devm_hwspin_lock_free(struct device *dev, struct hwspinlock *hwlock)
+{
+ return 0;
+}
+
+static inline struct hwspinlock *devm_hwspin_lock_request(struct device *dev)
+{
+ return ERR_PTR(-ENODEV);
+}
+
+static inline
+struct hwspinlock *devm_hwspin_lock_request_specific(struct device *dev,
+ unsigned int id)
+{
+ return ERR_PTR(-ENODEV);
+}
+
#endif /* !CONFIG_HWSPINLOCK */
/**