lkml.org 
[lkml]   [2023]   [Nov]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] regulator: core: Only increment use_count when enable_count changes
On Fri, Nov 03, 2023 at 03:42:31PM +0800, Rui Zhang wrote:

> The use_count of a regulator should only be incremented when the
> enable_count changes from 0 to 1. Similarly, the use_count should
> only be decremented when the enable_count changes from 1 to 0.

Why?

> In the previous implementation, use_count was sometimes decremented
> to 0 when some consumer called unbalanced disable,
> leading to unexpected disable even the regulator is enabled by
> other consumers. With this change, the use_count accurately reflects
> the number of users which the regulator is enabled.

If a consumer does an unbalanced disable the consumer is buggy and the
reference counting is wrong overall. The bug is in the consumer driver
doing the unbalanced disable.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2023-11-20 13:47    [W:0.039 / U:1.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site