16 Jun
2024
16 Jun
'24
7:26 p.m.
…
+++ 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/Docu...
+ 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