On Thu, Jun 25, 2015 at 05:35:03PM +0800, Nicolas Boichat wrote:
I'm trying to revive Antti's patch [1], as we are hitting similar issue with rt5677 driver. I only updated the commit message and documentation, I kept both Signed-off-by and From lines, with a small note highlighting my changes, let me know if that's not appropriate.
This continues to have the same problems as the previous version of the patch where I can't really tell how users are supposed to figure out if they should use this or not. There will be cases where there is a clear use within the driver itself but as far as I can tell almost any driver might be bitten by this if some underlying driver on a given system happens to use a regmap so should be allocating a class.
One issue that was raised by Mark at the time is that a per-regmap_config lock class might not be enough (Mark mentioned clocks as an example). The current implementation should be good enough as long as the clock regmaps do not access each other. If this is a problem, maybe we should consider replacing lockdep_lock_class_key by a boolean use_own_lock_class that would allocate/use a per regmap instance lock class, or have devm_regmap_init take an extra parameter specifying the lock class.
I think this is a problem and making this something that every regmap does by default was my original suggestion, there's also Arjan's suggestion of just using nested mutexes rather than classes.