Re: [PATCH 1/3] ASoC: codecs: tas675x: use READ_ONCE for params to be used concurrently

From: Wang, Sen

Date: Thu Jul 02 2026 - 13:59:28 EST


On 7/1/2026 1:55 PM, Mark Brown wrote:
On Tue, Jun 30, 2026 at 01:31:20PM -0500, Sen Wang wrote:
active_playback_dais and active_capture_dais are written atomically via
set_bit()/clear_bit() and can be read concurrently from the
fault_check_work delayed work handler.

fault_check_work already uses READ_ONCE; extend the same guard to all other
reads in tas675x_hw_params() and tas675x_mute_stream().

I'm not convinced that any of this READ_ONCE stuff is safe, that's a
very unusual pattern for an I2C device like these, but given that I
missed it earlier I'll take the patch for now.

You're right mark, READ_ONCE only makes the variable volatile. I had a false assumption that it also adds memory barrier as well. This patch should be dropped as it provides no inherent benefit.

Tracing back, the reasons for needing to keeping a separate record of active DAIs was the unreliable active count when calling snd_soc_component_active in mute_stream when I first developed the driver, I should look deeper into that instead...