[PATCH 7/8] ASoC: codecs: wcd938x: Drop unused variant field

Srinivas Kandagatla srinivas.kandagatla at oss.qualcomm.com
Thu May 29 19:31:09 AEST 2025



On 5/28/25 9:00 PM, Krzysztof Kozlowski wrote:
> Member wcd938x_priv.variant is assigned in probe() function and used
> immediately thereafter, thus it can be just a local variable for less
> variables stored in 'struct wcd938x_priv' device-wide state.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski at linaro.org>
> ---

Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla at oss.qualcomm.com>

--srini

>  sound/soc/codecs/wcd938x.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c
> index 43347c14070ca6dd8035b0c290f0dacb0326122b..5a751056a98a5d4cc5716aafc25af27e3ab22786 100644
> --- a/sound/soc/codecs/wcd938x.c
> +++ b/sound/soc/codecs/wcd938x.c
> @@ -168,7 +168,6 @@ struct wcd938x_priv {
>  	u32 tx_mode[TX_ADC_MAX];
>  	int flyback_cur_det_disable;
>  	int ear_rx_path;
> -	int variant;
>  	struct gpio_desc *reset_gpio;
>  	struct gpio_desc *us_euro_gpio;
>  	struct mux_control *us_euro_mux;
> @@ -3044,6 +3043,7 @@ static int wcd938x_soc_codec_probe(struct snd_soc_component *component)
>  	struct sdw_slave *tx_sdw_dev = wcd938x->tx_sdw_dev;
>  	struct device *dev = component->dev;
>  	unsigned long time_left;
> +	unsigned int variant;
>  	int ret, i;
>  
>  	time_left = wait_for_completion_timeout(&tx_sdw_dev->initialization_complete,
> @@ -3059,9 +3059,9 @@ static int wcd938x_soc_codec_probe(struct snd_soc_component *component)
>  	if (ret < 0)
>  		return ret;
>  
> -	wcd938x->variant = snd_soc_component_read_field(component,
> -						 WCD938X_DIGITAL_EFUSE_REG_0,
> -						 WCD938X_ID_MASK);
> +	variant = snd_soc_component_read_field(component,
> +					       WCD938X_DIGITAL_EFUSE_REG_0,
> +					       WCD938X_ID_MASK);
>  
>  	wcd938x->clsh_info = wcd_clsh_ctrl_alloc(component, WCD938X);
>  	if (IS_ERR(wcd938x->clsh_info)) {
> @@ -3115,14 +3115,14 @@ static int wcd938x_soc_codec_probe(struct snd_soc_component *component)
>  	disable_irq_nosync(wcd938x->hphl_pdm_wd_int);
>  	disable_irq_nosync(wcd938x->aux_pdm_wd_int);
>  
> -	switch (wcd938x->variant) {
> +	switch (variant) {
>  	case WCD9380:
>  		ret = snd_soc_add_component_controls(component, wcd9380_snd_controls,
>  					ARRAY_SIZE(wcd9380_snd_controls));
>  		if (ret < 0) {
>  			dev_err(component->dev,
>  				"%s: Failed to add snd ctrls for variant: %d\n",
> -				__func__, wcd938x->variant);
> +				__func__, variant);
>  			goto err_free_aux_pdm_wd_int;
>  		}
>  		break;
> @@ -3132,7 +3132,7 @@ static int wcd938x_soc_codec_probe(struct snd_soc_component *component)
>  		if (ret < 0) {
>  			dev_err(component->dev,
>  				"%s: Failed to add snd ctrls for variant: %d\n",
> -				__func__, wcd938x->variant);
> +				__func__, variant);
>  			goto err_free_aux_pdm_wd_int;
>  		}
>  		break;
> 



More information about the Linuxppc-dev mailing list