From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: <broonie@kernel.org>
Cc: <lgirdwood@gmail.com>, <linux-sound@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <patches@opensource.cirrus.com>
Subject: [PATCH v2 3/3] ASoC: ops: Apply platform_max after deciding control type
Date: Wed, 19 Mar 2025 17:51:23 +0000 [thread overview]
Message-ID: <20250319175123.3835849-4-ckeepax@opensource.cirrus.com> (raw)
In-Reply-To: <20250319175123.3835849-1-ckeepax@opensource.cirrus.com>
It doesn't really make sense for the type of a control to change based
on the platform_max field. platform_max allows a specific system to
limit values of a control for safety but it seems reasonable the
control type should remain the same between different systems, even
if it is restricted down to just two values. Move the application of
platform_max to after control type determination in soc_info_volsw().
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
No change since v1.
sound/soc/soc-ops.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c
index 3ac5b3a62c812..8d4dd11c9aef1 100644
--- a/sound/soc/soc-ops.c
+++ b/sound/soc/soc-ops.c
@@ -172,9 +172,6 @@ static int soc_info_volsw(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo,
struct soc_mixer_control *mc, int max)
{
- if (mc->platform_max && mc->platform_max < max)
- max = mc->platform_max;
-
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
if (max == 1) {
@@ -185,6 +182,9 @@ static int soc_info_volsw(struct snd_kcontrol *kcontrol,
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
}
+ if (mc->platform_max && mc->platform_max < max)
+ max = mc->platform_max;
+
uinfo->count = snd_soc_volsw_is_stereo(mc) ? 2 : 1;
uinfo->value.integer.min = 0;
uinfo->value.integer.max = max;
--
2.39.5
next prev parent reply other threads:[~2025-03-19 17:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-19 17:51 [PATCH v2 0/3] Tidy up ASoC control get and put handlers Charles Keepax
2025-03-19 17:51 ` [PATCH v2 1/3] ASoC: ops: Factor out common code from get callbacks Charles Keepax
2025-03-19 17:51 ` [PATCH v2 2/3] ASoC: ops: Remove some unnecessary local variables Charles Keepax
2025-03-19 17:51 ` Charles Keepax [this message]
2025-03-20 18:45 ` [PATCH v2 0/3] Tidy up ASoC control get and put handlers 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=20250319175123.3835849-4-ckeepax@opensource.cirrus.com \
--to=ckeepax@opensource.cirrus.com \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=patches@opensource.cirrus.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