Messages in this thread | | | Subject | Re: [PATCH v2 2/4] ASoC: hdmi-codec: remove reference to the current substream | From | Jerome Brunet <> | Date | Wed, 08 May 2019 10:08:44 +0200 |
| |
On Wed, 2019-05-08 at 16:00 +0900, Mark Brown wrote: > On Mon, May 06, 2019 at 11:58:13AM +0200, Jerome Brunet wrote: > > > Remove current_substream pointer and replace the exclusive locking > > mechanism with a simple variable and some atomic operations. > > 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
The point was to remove the current_substream pointer in favor of a simple 'busy' flag. After that, I ended up with a mutex protecting a flag and it seemed a bit overkill to me. Atomic op seemed like a good fit for this but I don't really care about that particular point.
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 ?
| |