Re: [PATCH v6 3/7] ASoC: codecs: wcd937x: add wcd937x codec driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



…
> +++ b/sound/soc/codecs/wcd937x.c
> @@ -0,0 +1,1677 @@
…
> +static bool wcd937x_mbhc_get_moisture_status(struct snd_soc_component *component)
> +{
> +	struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
> +	bool ret = false;
> +
> +	if (wcd937x->mbhc_cfg.moist_rref == R_OFF) {
> +		snd_soc_component_write_field(component, WCD937X_MBHC_NEW_CTL_2,
> +					      WCD937X_M_RTH_CTL_MASK, R_OFF);
> +		goto done;
> +	}

I suggest to use the following statement.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v6.10-rc3#n532

+		return false;



…
> +	/* Read moisture comparator status */
> +	ret = ((snd_soc_component_read(component, WCD937X_MBHC_NEW_FSM_STATUS)
> +				       & 0x20) ? 0 : 1);
> +done:
> +	return ret;
> +}
…

How do you think about to use the following statement instead?

+	return (snd_soc_component_read(component, WCD937X_MBHC_NEW_FSM_STATUS) & 0x20) ? false : true;


May the local variable “ret” and the label “done” be omitted
in this function implementation finally?

Regards,
Markus





[Index of Archives]     [Pulseaudio]     [Linux Audio Users]     [ALSA Devel]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux