Devicetree
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Neo Chang <YLCHANG2@nuvoton.com>
Cc: broonie@kernel.org, lgirdwood@gmail.com, perex@perex.cz,
	robh@kernel.org, krzk+dt@kernel.org, linux-sound@vger.kernel.org,
	devicetree@vger.kernel.org, alsa-devel@alsa-project.org,
	neo.chang70@gmail.com, kchsu0@nuvoton.com, sjlin0@nuvoton.com
Subject: Re: [PATCH v10 2/2] ASoC: codecs: nau8360: Add support for NAU83G60 amplifier
Date: Thu, 10 Sep 2026 17:33:04 +0300	[thread overview]
Message-ID: <aqK_oOpMAXVhxkHJ@stanley.mountain> (raw)
In-Reply-To: <20260825021644.1203076-3-YLCHANG2@nuvoton.com>

On Tue, Aug 25, 2026 at 10:16:44AM +0800, Neo Chang wrote:
> +static int nau8360_dac_mux_put_enum(struct snd_kcontrol *kcontrol,
> +	struct snd_ctl_elem_value *ucontrol)
> +{
> +	struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol);
> +	struct snd_soc_component *component = snd_soc_dapm_to_component(dapm);
> +	struct nau8360 *nau8360 = snd_soc_component_get_drvdata(component);
> +	struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
> +	unsigned int *item = ucontrol->value.enumerated.item;
> +	int ret = 0;
> +
> +	if (snd_soc_dapm_get_bias_level(dapm) > SND_SOC_BIAS_STANDBY) {
> +		dev_warn(nau8360->dev, "changing path is not allowed during playback");
> +		return ret;

This is another case where I would prefer return 0 or return -EINVAL.

> +	}
> +
> +	mutex_lock(&nau8360->lock);
> +
> +	ret = snd_soc_dapm_put_enum_double(kcontrol, ucontrol);

Not related to your patch but the comments to snd_soc_dapm_put_enum_double()
say "Returns 0 for success." when really it returns true/false on success
where true means it changed something and false means nothing changed.

regards,
dan carpenter

> +	if (ret <= 0)
> +		goto unlock;
> +
> +	nau8360_dsp_switch(component, snd_soc_enum_item_to_val(e, item[0]));
> +
> +unlock:
> +	mutex_unlock(&nau8360->lock);
> +
> +	return ret;
> +}


  parent reply	other threads:[~2026-09-10 14:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-25  2:16 [PATCH v10 0/2] ASoC: codecs: Add Nuvoton NAU83G60 audio codec driver Neo Chang
2026-08-25  2:16 ` [PATCH v10 1/2] ASoC: dt-bindings: nuvoton,nau8360: Add NAU83G60 Neo Chang
2026-08-25  2:16 ` [PATCH v10 2/2] ASoC: codecs: nau8360: Add support for NAU83G60 amplifier Neo Chang
2026-08-25  2:29   ` sashiko-bot
2026-09-10 14:33   ` Dan Carpenter [this message]
2026-09-11  2:33     ` YLCHANG2
2026-08-30 22:51 ` [PATCH v10 0/2] ASoC: codecs: Add Nuvoton NAU83G60 audio codec driver Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aqK_oOpMAXVhxkHJ@stanley.mountain \
    --to=error27@gmail.com \
    --cc=YLCHANG2@nuvoton.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=kchsu0@nuvoton.com \
    --cc=krzk+dt@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=neo.chang70@gmail.com \
    --cc=perex@perex.cz \
    --cc=robh@kernel.org \
    --cc=sjlin0@nuvoton.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox