[RFC PATCH v2 02/13] hwspinlock: add callback to fill private data of a hwspinlock

Sergey Shtylyov s.shtylyov at omp.ru
Mon Feb 16 00:05:32 PST 2026


On 2/16/26 1:54 AM, Wolfram Sang wrote:

> To hide internal core structures from providers, a callback is added to
> the ops which allows to set the 'priv' field of a hwspinlock. It is
> called when a hwspinlock device is registered and, thus, iterated over
> all locks. The register-functions are also extended to pass a data
> pointer to this callback, so it can do necessary calculations for the
> priv field of each hwspinlock. Providers are converted separately
> because these changes need dedicated reviews.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas at sang-engineering.com>
[...]

> --- a/include/linux/hwspinlock.h
> +++ b/include/linux/hwspinlock.h
> @@ -30,7 +30,7 @@ struct hwspinlock_ops;
>  void *hwspin_lock_get_priv(struct hwspinlock *hwlock);
>  struct device *hwspin_lock_get_dev(struct hwspinlock *hwlock);
>  int hwspin_lock_register(struct hwspinlock_device *bank, struct device *dev,
> -		const struct hwspinlock_ops *ops, int base_id, int num_locks);
> +		const struct hwspinlock_ops *ops, int base_id, int num_locks, void *init_data);
>  int hwspin_lock_unregister(struct hwspinlock_device *bank);
>  struct hwspinlock *hwspin_lock_request_specific(unsigned int id);
>  int hwspin_lock_free(struct hwspinlock *hwlock);
> @@ -49,7 +49,7 @@ int devm_hwspin_lock_unregister(struct device *dev,
>  int devm_hwspin_lock_register(struct device *dev,
>  			      struct hwspinlock_device *bank,
>  			      const struct hwspinlock_ops *ops,
> -			      int base_id, int num_locks);
> +			      int base_id, int num_locks, void *init_data);

   Don't you break the existing users of this API with this change? I see
you're fixing them up in the followup patches but that's not how it should
be done -- the compilation shouldn't be broken...

[...]

MBR, Sergey




More information about the linux-arm-kernel mailing list