···87878888::89899090+ int hwspin_lock_bust(struct hwspinlock *hwlock, unsigned int id);9191+9292+After verifying the owner of the hwspinlock, release a previously acquired9393+hwspinlock; returns 0 on success, or an appropriate error code on failure9494+(e.g. -EOPNOTSUPP if the bust operation is not defined for the specific9595+hwspinlock).9696+9797+Should be called from a process context (might sleep).9898+9999+::100100+90101 int hwspin_lock_timeout(struct hwspinlock *hwlock, unsigned int timeout);9110292103Lock a previously-assigned hwspinlock with a timeout limit (specified in
+28
drivers/hwspinlock/hwspinlock_core.c
···306306EXPORT_SYMBOL_GPL(__hwspin_unlock);307307308308/**309309+ * hwspin_lock_bust() - bust a specific hwspinlock310310+ * @hwlock: a previously-acquired hwspinlock which we want to bust311311+ * @id: identifier of the remote lock holder, if applicable312312+ *313313+ * This function will bust a hwspinlock that was previously acquired as314314+ * long as the current owner of the lock matches the id given by the caller.315315+ *316316+ * Context: Process context.317317+ *318318+ * Returns: 0 on success, or -EINVAL if the hwspinlock does not exist, or319319+ * the bust operation fails, and -EOPNOTSUPP if the bust operation is not320320+ * defined for the hwspinlock.321321+ */322322+int hwspin_lock_bust(struct hwspinlock *hwlock, unsigned int id)323323+{324324+ if (WARN_ON(!hwlock))325325+ return -EINVAL;326326+327327+ if (!hwlock->bank->ops->bust) {328328+ pr_err("bust operation not defined\n");329329+ return -EOPNOTSUPP;330330+ }331331+332332+ return hwlock->bank->ops->bust(hwlock, id);333333+}334334+EXPORT_SYMBOL_GPL(hwspin_lock_bust);335335+336336+/**309337 * of_hwspin_lock_simple_xlate - translate hwlock_spec to return a lock id310338 * @hwlock_spec: hwlock specifier as found in the device tree311339 *
+3
drivers/hwspinlock/hwspinlock_internal.h
···2121 * @trylock: make a single attempt to take the lock. returns 0 on2222 * failure and true on success. may _not_ sleep.2323 * @unlock: release the lock. always succeed. may _not_ sleep.2424+ * @bust: optional, platform-specific bust handler, called by hwspinlock2525+ * core to bust a specific lock.2426 * @relax: optional, platform-specific relax handler, called by hwspinlock2527 * core while spinning on a lock, between two successive2628 * invocations of @trylock. may _not_ sleep.···3028struct hwspinlock_ops {3129 int (*trylock)(struct hwspinlock *lock);3230 void (*unlock)(struct hwspinlock *lock);3131+ int (*bust)(struct hwspinlock *lock, unsigned int id);3332 void (*relax)(struct hwspinlock *lock);3433};3534
+25
drivers/hwspinlock/qcom_hwspinlock.c
···6464 pr_err("%s: failed to unlock spinlock\n", __func__);6565}66666767+static int qcom_hwspinlock_bust(struct hwspinlock *lock, unsigned int id)6868+{6969+ struct regmap_field *field = lock->priv;7070+ u32 owner;7171+ int ret;7272+7373+ ret = regmap_field_read(field, &owner);7474+ if (ret) {7575+ dev_err(lock->bank->dev, "unable to query spinlock owner\n");7676+ return ret;7777+ }7878+7979+ if (owner != id)8080+ return 0;8181+8282+ ret = regmap_field_write(field, 0);8383+ if (ret) {8484+ dev_err(lock->bank->dev, "failed to bust spinlock\n");8585+ return ret;8686+ }8787+8888+ return 0;8989+}9090+6791static const struct hwspinlock_ops qcom_hwspinlock_ops = {6892 .trylock = qcom_hwspinlock_trylock,6993 .unlock = qcom_hwspinlock_unlock,9494+ .bust = qcom_hwspinlock_bust,7095};71967297static const struct regmap_config sfpb_mutex_config = {
+6
include/linux/hwspinlock.h
···6868int __hwspin_trylock(struct hwspinlock *, int, unsigned long *);6969void __hwspin_unlock(struct hwspinlock *, int, unsigned long *);7070int of_hwspin_lock_get_id_byname(struct device_node *np, const char *name);7171+int hwspin_lock_bust(struct hwspinlock *hwlock, unsigned int id);7172int devm_hwspin_lock_free(struct device *dev, struct hwspinlock *hwlock);7273struct hwspinlock *devm_hwspin_lock_request(struct device *dev);7374struct hwspinlock *devm_hwspin_lock_request_specific(struct device *dev,···126125static inline127126void __hwspin_unlock(struct hwspinlock *hwlock, int mode, unsigned long *flags)128127{128128+}129129+130130+static inline int hwspin_lock_bust(struct hwspinlock *hwlock, unsigned int id)131131+{132132+ return 0;129133}130134131135static inline int of_hwspin_lock_get_id(struct device_node *np, int index)