
On Wed, Feb 15, 2023 at 08:06:35AM -0800, Guenter Roeck wrote:
On Wed, Feb 15, 2023 at 5:10 AM Mark Brown broonie@kernel.org wrote:
Copying in Guenter given the issues he raised with this, not deleting context for his benefit. It looks like this should avoid the issues with the interrupt appearing locked up.
It should since it limits the delay to cases where jack_inserted is false, but on the other side it hides the delay in an odd way.
...
Effectively this seems to be quite similar to moving the conditional sleep to the place where cancel_work_sync() is called. I would assume that will fix the problem (after all, the msleep() is no longer called unconditionally), but I don't see the benefit of introducing a worker to do that. Also, since there is no guarantee that the worker actually started by the time cancel_work_sync() is called, I would suspect that it may result in unexpected behavior if the worker has not started by that time, which I would assume can happen if the system is heavily loaded. It also makes the use of the ground switch (i.e., when to set and when to drop it) even more of a mystery than it is right now.
Having said that, I don't really know or understand the code, so maybe this all makes sense and my feedback should be ignored.
Yes, I would certainly welcome more clarity especially around the ground switch. OTOH it does seem like an improvement over the current situation so I think I'll go ahead and apply it for now, hopefully it can be improved upon in future.