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

From: Stephen Boyd
Date: Wed Aug 30 2023 - 17:12:25 EST


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"?

> rdev->ref check when unlocking is moved inside the critical section.

rdev->ref_cnt?

>
> This patch depends on commit 12235da8c80a ("kernel/locking: Add context
> to ww_mutex_trylock()").
>
> 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.

>
> Reviewed-by: Douglas Anderson <dianders@xxxxxxxxxxxx>
> Signed-off-by: Michał Mirosław <mirq-linux@xxxxxxxxxxxx>