Re: [PATCH v2 3/7] regulator/core: regulator_lock_nested: simplify nested locking

From: Michał Mirosław
Date: Thu Aug 31 2023 - 18:43:39 EST


On Wed, Aug 30, 2023 at 01:36:38PM -0700, Stephen Boyd wrote:
> Quoting Michał Mirosław (2023-08-30 10:35:31)
> > Simplify regulator locking by removing locking around locking.
>
> Maybe this should say "Simplify regulator_lock_nested() by removing the
> `regulator_nesting_mutex` now that rdev is locked whenever rdev->ref_cnt or
> rdev->owner are modified"?

I'll rework the message. Thanks for the hints!

[...]
> > Note: return -EALREADY is removed as no caller depends on it and in that
> > case the lock count is incremented anyway.
>
> Where is -EALREADY removed in this patch? Perhaps "removed" should be
> "ignored"?
>
> Note: A return value of -EALREADY from ww_mutex_lock() in
> regulator_lock_nested() is ignored as no caller depends on it.

I can actually remove this altogether: ww_mutex_lock() won't ever
return -EALREADY as it's called only if (rdev->mutex_owner != current).

Best Regards.
Michał Mirosław