• Kuninori Morimoto's avatar
    ASoC: soc-component: use io_mutex correctly · e8712315
    Kuninori Morimoto authored
    component has io_mutex, but it had been used at
    snd_soc_component_update_bits_legacy() only which does read and write.
    
    	static int snd_soc_component_update_bits_legacy(...)
    	{
    		...
    =>		mutex_lock(&component->io_mutex);
    		...
    		old = snd_soc_component_read(...);
    		...
    		ret = snd_soc_component_write(...);
    		...
    =>		mutex_unlock(&component->io_mutex);
    		...
    	}
    
    It is pointless if it is not used with both read and write functions.
    This patch uses io_mutex correctly with read/write.
    Here, xxx_no_lock() is local functions.
    
    	static int snd_soc_component_read(...)
    	{
    		...
    =>		mutex_lock(&component->io_mutex);
    		val = soc_component_read_no_lock(...);
    =>		mutex_unlock(&component->io_mutex);
    		...
    	}
    
    	static int snd_soc_component_write(...)
    	{
    		...
    =>		mutex_lock(&component->io_mutex);
    		ret = soc_component_write_no_lock(...);
    =>		mutex_unlock(&component->io_mutex);
    		...
    	}
    
    	static int snd_soc_component_update_bits_legacy(...)
    	{
    		...
    =>		mutex_lock(&component->io_mutex);
    		...
    		old = soc_component_read_no_lock(...);
    		...
    		ret = soc_component_write_no_lock(...);
    		...
    =>		mutex_unlock(&component->io_mutex);
    		...
    	}
    Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
    Link: https://lore.kernel.org/r/87r1uf4mfa.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
    e8712315
soc-component.c 21.5 KB