On 02/01/2026 12:14, Johan Hovold wrote:
The soundwire update_status() callback may be called multiple times with the same ATTACHED status but initialisation should only be done when transitioning from UNATTACHED to ATTACHED.
Fix the inverted hw_init flag which was set to false instead of true after initialisation which defeats its purpose and may result in repeated unnecessary initialisation.
Either it results or it does not, not "may". If the device moves to UNATTACHED state flag should be probably set to "true". This is the bug.
Similarly, the initial state of the flag was also inverted so that the codec would only be initialised and brought out of regmap cache only mode if its status first transitions to UNATTACHED.
Maybe that's confusing wording but existing code was intentional and IMO almost correct. The flag is saying - we need hw init - that's why it is set to true in the probe and to false AFTER the proper hw initialization which is done after ATTACHED state.
If you find naming confusing, maybe rename it to other style or fix the false -> true when going to unattached stat, but not everything at once.
Best regards, Krzysztof