diff options
Diffstat (limited to 'drivers/hwspinlock/hwspinlock_core.c')
-rw-r--r-- | drivers/hwspinlock/hwspinlock_core.c | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwspinlock_core.c index 6505261e6068..cc8e952a6772 100644 --- a/drivers/hwspinlock/hwspinlock_core.c +++ b/drivers/hwspinlock/hwspinlock_core.c @@ -710,66 +710,6 @@ static int __hwspin_lock_request(struct hwspinlock *hwlock) } /** - * hwspin_lock_get_id() - retrieve id number of a given hwspinlock - * @hwlock: a valid hwspinlock instance - * - * Returns: the id number of a given @hwlock, or -EINVAL if @hwlock is invalid. - */ -int hwspin_lock_get_id(struct hwspinlock *hwlock) -{ - if (!hwlock) { - pr_err("invalid hwlock\n"); - return -EINVAL; - } - - return hwlock_to_id(hwlock); -} -EXPORT_SYMBOL_GPL(hwspin_lock_get_id); - -/** - * hwspin_lock_request() - request an hwspinlock - * - * This function should be called by users of the hwspinlock device, - * in order to dynamically assign them an unused hwspinlock. - * Usually the user of this lock will then have to communicate the lock's id - * to the remote core before it can be used for synchronization (to get the - * id of a given hwlock, use hwspin_lock_get_id()). - * - * Should be called from a process context (might sleep) - * - * Returns: the address of the assigned hwspinlock, or %NULL on error - */ -struct hwspinlock *hwspin_lock_request(void) -{ - struct hwspinlock *hwlock; - int ret; - - mutex_lock(&hwspinlock_tree_lock); - - /* look for an unused lock */ - ret = radix_tree_gang_lookup_tag(&hwspinlock_tree, (void **)&hwlock, - 0, 1, HWSPINLOCK_UNUSED); - if (ret == 0) { - pr_warn("a free hwspinlock is not available\n"); - hwlock = NULL; - goto out; - } - - /* sanity check that should never fail */ - WARN_ON(ret > 1); - - /* mark as used and power up */ - ret = __hwspin_lock_request(hwlock); - if (ret < 0) - hwlock = NULL; - -out: - mutex_unlock(&hwspinlock_tree_lock); - return hwlock; -} -EXPORT_SYMBOL_GPL(hwspin_lock_request); - -/** * hwspin_lock_request_specific() - request for a specific hwspinlock * @id: index of the specific hwspinlock that is requested * @@ -913,40 +853,6 @@ int devm_hwspin_lock_free(struct device *dev, struct hwspinlock *hwlock) EXPORT_SYMBOL_GPL(devm_hwspin_lock_free); /** - * devm_hwspin_lock_request() - request an hwspinlock for a managed device - * @dev: the device to request an hwspinlock - * - * This function should be called by users of the hwspinlock device, - * in order to dynamically assign them an unused hwspinlock. - * Usually the user of this lock will then have to communicate the lock's id - * to the remote core before it can be used for synchronization (to get the - * id of a given hwlock, use hwspin_lock_get_id()). - * - * Should be called from a process context (might sleep) - * - * Returns: the address of the assigned hwspinlock, or %NULL on error - */ -struct hwspinlock *devm_hwspin_lock_request(struct device *dev) -{ - struct hwspinlock **ptr, *hwlock; - - ptr = devres_alloc(devm_hwspin_lock_release, sizeof(*ptr), GFP_KERNEL); - if (!ptr) - return NULL; - - hwlock = hwspin_lock_request(); - if (hwlock) { - *ptr = hwlock; - devres_add(dev, ptr); - } else { - devres_free(ptr); - } - - return hwlock; -} -EXPORT_SYMBOL_GPL(devm_hwspin_lock_request); - -/** * devm_hwspin_lock_request_specific() - request for a specific hwspinlock for * a managed device * @dev: the device to request the specific hwspinlock |