From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Mark Brown <broonie@kernel.org>
Cc: robh@kernel.org, devicetree@vger.kernel.org, perex@perex.cz,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
lgirdwood@gmail.com
Subject: Re: [PATCH v8 6/9] ASoC: codecs: wcd938x: add basic controls
Date: Tue, 8 Jun 2021 16:20:31 +0100 [thread overview]
Message-ID: <e8ca16d9-f179-c6de-d683-21180ea4ed1b@linaro.org> (raw)
In-Reply-To: <20210608135933.GE4200@sirena.org.uk>
On 08/06/2021 14:59, Mark Brown wrote:
> On Tue, Jun 01, 2021 at 12:31:55PM +0100, Srinivas Kandagatla wrote:
>
>> +static int wcd938x_rx_hph_mode_put(struct snd_kcontrol *kcontrol,
>> + struct snd_ctl_elem_value *ucontrol)
>> +{
>> + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
>> + struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component);
>> +
>> + wcd938x->hph_mode = ucontrol->value.enumerated.item[0];
>> +
>> + return 0;
>> +}
>
> _put() should return true if it made a change, the same bug is present
> in a lot of other drivers too.
>
Sure will fix this in next spin
>> +static const struct snd_kcontrol_new wcd9380_snd_controls[] = {
>> + SOC_ENUM_EXT("RX HPH Mode", rx_hph_mode_mux_enum_wcd9380,
>> + wcd938x_rx_hph_mode_get, wcd938x_rx_hph_mode_put),
>> + SOC_ENUM_EXT("TX0 MODE", tx_mode_mux_enum_wcd9380[0],
>> + wcd938x_tx_mode_get, wcd938x_tx_mode_put),
>> + SOC_ENUM_EXT("TX1 MODE", tx_mode_mux_enum_wcd9380[1],
>> + wcd938x_tx_mode_get, wcd938x_tx_mode_put),
>> + SOC_ENUM_EXT("TX2 MODE", tx_mode_mux_enum_wcd9380[2],
>> + wcd938x_tx_mode_get, wcd938x_tx_mode_put),
>> + SOC_ENUM_EXT("TX3 MODE", tx_mode_mux_enum_wcd9380[3],
>> + wcd938x_tx_mode_get, wcd938x_tx_mode_put),
>> +};
>
> Please don't use this pattern of indexing into arrays by absolute
> number, it's error prone and hard to read. Just declare static
> variables for the enums and reference them individually.
I agree, will clean these instances in next version.
--srini
>
next prev parent reply other threads:[~2021-06-08 15:21 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-01 11:31 [PATCH v8 0/9] ASoC: codecs: add wcd938x support Srinivas Kandagatla
2021-06-01 11:31 ` [PATCH v8 1/9] ASoC: dt-bindings: wcd938x: add bindings for wcd938x Srinivas Kandagatla
2021-06-01 11:31 ` [PATCH v8 2/9] ASoC: codecs: wcd-clsh: add new version support Srinivas Kandagatla
2021-06-01 11:31 ` [PATCH v8 3/9] ASoC: codecs: wcd938x: add basic driver Srinivas Kandagatla
2021-06-08 14:12 ` Mark Brown
2021-06-08 15:20 ` Srinivas Kandagatla
2021-06-01 11:31 ` [PATCH v8 4/9] ASoC: dt-bindings: wcd938x-sdw: add bindings for wcd938x-sdw Srinivas Kandagatla
2021-06-01 11:31 ` [PATCH v8 5/9] ASoC: codecs: wcd938x-sdw: add SoundWire driver Srinivas Kandagatla
2021-06-01 11:31 ` [PATCH v8 6/9] ASoC: codecs: wcd938x: add basic controls Srinivas Kandagatla
2021-06-08 13:59 ` Mark Brown
2021-06-08 15:20 ` Srinivas Kandagatla [this message]
2021-06-01 11:31 ` [PATCH v8 7/9] ASoC: codecs: wcd938x: add playback dapm widgets Srinivas Kandagatla
2021-06-01 11:31 ` [PATCH v8 8/9] ASoC: codecs: wcd938x: add capture " Srinivas Kandagatla
2021-06-01 11:31 ` [PATCH v8 9/9] ASoC: codecs: wcd938x: add audio routing Srinivas Kandagatla
2021-06-14 19:53 ` [PATCH v8 0/9] ASoC: codecs: add wcd938x support 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=e8ca16d9-f179-c6de-d683-21180ea4ed1b@linaro.org \
--to=srinivas.kandagatla@linaro.org \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=robh@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).