[PATCH v4 07/22] regulator: core: Reduce critical area in _regulator_get

From
Mark Brown <broonie@kernel.org>
Date
2015-09-11 12:10:44
Also in
linux-acpi, linux-devicetree, lkml
Reply to
Tomeu Vizoso, 2015-09-07
On Mon, Sep 07, 2015 at 02:23:32PM +0200, Tomeu Vizoso wrote:
By moving the locking of regulator_list_mutex into regulator_dev_lookup,
where it is iterated over. The reference count of the regulator's device
is increased in case it's unregistered while in use.

In _regulator_get() the regulator_list_mutex mutex was held for most of
the function, but that is only strictly needed to protect the list
lookups.

This change would be useful if for example regulator devices could be
registered on demand when a driver requests them. regulator_register()
could end up being called from within _regulator_get while the lock on
regulator_list_mutex is being held, causing a deadlock.
The fix for this is to convert the code to use the list maintained by
the driver core for regulator class to iterate the regulators rather
than fiddle about with the locking.  I'm pretty sure the current locking
has problems and I'm worried that this may make those problems worse.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150911/f2d92875/attachment.sig>
Thread (43 messages) 43 messages, 7 authors, last reply 2015-10-21
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help