[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <916eb114-f3d3-4b10-a2c7-ccd411222989@sirena.org.uk>
Date: Fri, 3 Nov 2023 12:51:20 +0000
From: Mark Brown <broonie@...nel.org>
To: Rui Zhang <zr.zhang@...o.com>
Cc: Douglas Anderson <dianders@...omium.org>,
opensource.kernel@...o.com, Liam Girdwood <lgirdwood@...il.com>,
linux-kernel@...r.kernel.org
Subject: Re: [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.
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists