Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Richard Fitzgerald <rf@opensource.cirrus.com>
To: broonie@kernel.org
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	patches@opensource.cirrus.com
Subject: [PATCH 3/4] ASoC: cs35l56: Use SOC_ENUM_EXT_ACC() for CAL_SET_STATUS control
Date: Thu, 20 Nov 2025 13:44:36 +0000	[thread overview]
Message-ID: <20251120134437.1179191-4-rf@opensource.cirrus.com> (raw)
In-Reply-To: <20251120134437.1179191-1-rf@opensource.cirrus.com>

Use the new SOC_ENUM_EXT_ACC() macro instead of SOC_ENUM_EXT() to
define the CAL_SET_STATUS control, so that it is marked as read-only
and volatile.

This avoids userland code expecting to be able to write to it and
then getting an unexpected EPERM error, or assuming that its value
can never change.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
---
 sound/soc/codecs/cs35l56.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/cs35l56.c b/sound/soc/codecs/cs35l56.c
index 802658720510..f5fd20c8cce1 100644
--- a/sound/soc/codecs/cs35l56.c
+++ b/sound/soc/codecs/cs35l56.c
@@ -95,8 +95,9 @@ static const struct snd_kcontrol_new cs35l56_controls[] = {
 	SOC_SINGLE_EXT("Posture Number", CS35L56_MAIN_POSTURE_NUMBER,
 		       0, 255, 0,
 		       cs35l56_dspwait_get_volsw, cs35l56_dspwait_put_volsw),
-	SOC_ENUM_EXT("CAL_SET_STATUS", cs35l56_cal_set_status_enum,
-		     cs35l56_cal_set_status_ctl_get, NULL),
+	SOC_ENUM_EXT_ACC("CAL_SET_STATUS", cs35l56_cal_set_status_enum,
+			 cs35l56_cal_set_status_ctl_get, NULL,
+			 SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE),
 };
 
 static const struct snd_kcontrol_new cs35l63_controls[] = {
@@ -116,8 +117,9 @@ static const struct snd_kcontrol_new cs35l63_controls[] = {
 	SOC_SINGLE_EXT("Posture Number", CS35L63_MAIN_POSTURE_NUMBER,
 		       0, 255, 0,
 		       cs35l56_dspwait_get_volsw, cs35l56_dspwait_put_volsw),
-	SOC_ENUM_EXT("CAL_SET_STATUS", cs35l56_cal_set_status_enum,
-		     cs35l56_cal_set_status_ctl_get, NULL),
+	SOC_ENUM_EXT_ACC("CAL_SET_STATUS", cs35l56_cal_set_status_enum,
+			 cs35l56_cal_set_status_ctl_get, NULL,
+			 SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE),
 };
 
 static SOC_VALUE_ENUM_SINGLE_DECL(cs35l56_asp1tx1_enum,
-- 
2.47.3


  parent reply	other threads:[~2025-11-20 13:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-20 13:44 [PATCH 0/4] ASoC: cs35l56: Set access permissions on volatile read-only controls Richard Fitzgerald
2025-11-20 13:44 ` [PATCH 1/4] ASoC: soc.h: Add SOC_ENUM_EXT_ACC() to allow setting access flags Richard Fitzgerald
2025-11-20 13:44 ` [PATCH 2/4] ASoC: soc.h: Add SND_SOC_BYTES_E_ACC() " Richard Fitzgerald
2025-11-20 13:44 ` Richard Fitzgerald [this message]
2025-11-20 13:44 ` [PATCH 4/4] ASoC: cs35l56: Use SND_SOC_BYTES_E_ACC() for CAL_DATA_RB control Richard Fitzgerald
2025-11-21 22:11 ` [PATCH 0/4] ASoC: cs35l56: Set access permissions on volatile read-only controls 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=20251120134437.1179191-4-rf@opensource.cirrus.com \
    --to=rf@opensource.cirrus.com \
    --cc=broonie@kernel.org \
    --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