On Tue, 2026-03-10 at 08:55 +0100, 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 added only an empty
> placeholder and are converted separately because these changes need
> dedicated reviews.
> 
> Signed-off-by: Wolfram Sang <[email protected]>
> ---
>  drivers/hwspinlock/hwspinlock_core.c     | 19 +++++++++++++++----
>  drivers/hwspinlock/hwspinlock_internal.h | 19 +++++++++++--------
>  drivers/hwspinlock/omap_hwspinlock.c     |  2 +-
>  drivers/hwspinlock/qcom_hwspinlock.c     |  2 +-
>  drivers/hwspinlock/sprd_hwspinlock.c     |  2 +-
>  drivers/hwspinlock/stm32_hwspinlock.c    |  2 +-
>  drivers/hwspinlock/sun6i_hwspinlock.c    |  2 +-
>  include/linux/hwspinlock.h               |  4 ++--
>  8 files changed, 33 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/hwspinlock/hwspinlock_core.c 
> b/drivers/hwspinlock/hwspinlock_core.c
> index 2c9eceba7fe8..afe1e7ce2829 100644
> --- a/drivers/hwspinlock/hwspinlock_core.c
> +++ b/drivers/hwspinlock/hwspinlock_core.c
> @@ -507,6 +507,7 @@ static struct hwspinlock 
> *hwspin_lock_unregister_single(unsigned int id)
>   * @ops: hwspinlock handlers for this device
>   * @base_id: id of the first hardware spinlock in this bank
>   * @num_locks: number of hwspinlocks provided by this device
> + * @init_data: additional data passed on to the init_priv callback
>   *
>   * This function should be called from the underlying platform-specific
>   * implementation, to register a new hwspinlock device instance.
> @@ -516,10 +517,11 @@ static struct hwspinlock 
> *hwspin_lock_unregister_single(unsigned int id)
>   * Returns: %0 on success, or an appropriate error code on failure
>   */
>  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)

Hi Wolfram,

this API is described in Documentation/locking/hwspinlock.rst
in chapter 'API for implementors'.

Changing the API parameters should require updating the documentation too.

Since this API is changed again in 10/15, it's probably fine to update the
documentation only once in the last 15/15.

Best Regards,
Antonio

Reply via email to