On Wed, May 08, 2019 at 10:08:44AM +0200, Jerome Brunet wrote:
On Wed, 2019-05-08 at 16:00 +0900, Mark Brown wrote:
The advantage of mutexes is that they are very simple and clear to reason about. It is therefore unclear that this conversion to use atomic variables is an improvement, they're generally more complex to reason about and fragile.
The point of this patch is not to remove the mutex in favor of atomic operations
Sure, but you mixed in a conversion to atomic operations as well.
I can put back mutex to protect the flag if you prefer.
Another solution would be to use the mutex as the 'busy' flag. Get the ownership of the hdmi using try_lock() in startup() and release it in shutdown()
Would you have a preference Mark ?
Probably using a mutex for the flag is clearer. I'd rather keep things as simple as absolutely possible to avoid people making mistakes in future.