From: Shenghao Ding <shenghao-ding@ti.com>
To: <linux-kernel@vger.kernel.org>
Cc: <lgirdwood@gmail.com>, <broonie@kernel.org>,
<linux-sound@vger.kernel.org>, <perex@perex.cz>, <tiwai@suse.com>,
<13916275206@139.com>, <soyer@irl.hu>, <tiwai@suse.de>,
<Baojun.Xu@fpt.com>, Shenghao Ding <shenghao-ding@ti.com>
Subject: [PATCH v1] ASoc: pcm6240: Remove unnecessary name-prefix for all the controls
Date: Fri, 5 Jul 2024 14:48:46 +0800 [thread overview]
Message-ID: <20240705064846.1723-1-shenghao-ding@ti.com> (raw)
Adding name-prefix for each audio controls is a redundant, because
name-prefix will be automatically added behind the control name when
creating a new control.
Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
---
v1:
- remove pcmdev_ctrl_name_with_prefix
- remove some processes for control name_prefix handling
---
sound/soc/codecs/pcm6240.c | 30 ++++++------------------------
1 file changed, 6 insertions(+), 24 deletions(-)
diff --git a/sound/soc/codecs/pcm6240.c b/sound/soc/codecs/pcm6240.c
index 86e126783a1d..3de35b62439b 100644
--- a/sound/soc/codecs/pcm6240.c
+++ b/sound/soc/codecs/pcm6240.c
@@ -57,12 +57,6 @@ static const char *const pcmdev_ctrl_name[] = {
"%s i2c%d Dev%d Ch%d Fine Volume",
};
-static const char *const pcmdev_ctrl_name_with_prefix[] = {
- "%s Dev%d Ch%d Ana Volume",
- "%s Dev%d Ch%d Digi Volume",
- "%s Dev%d Ch%d Fine Volume",
-};
-
static const struct pcmdevice_mixer_control adc5120_analog_gain_ctl[] = {
{
.shift = 1,
@@ -1365,10 +1359,7 @@ static int pcmdev_gain_ctrl_add(struct pcmdevice_priv *pcm_dev,
name_id = pcmdev_gain_ctl_info[id][ctl_id].pcmdev_ctrl_name_id;
- if (comp->name_prefix)
- ctrl_name = pcmdev_ctrl_name_with_prefix[name_id];
- else
- ctrl_name = pcmdev_ctrl_name[name_id];
+ ctrl_name = pcmdev_ctrl_name[name_id];
for (chn = 1; chn <= nr_chn; chn++) {
name = devm_kzalloc(pcm_dev->dev,
@@ -1377,13 +1368,9 @@ static int pcmdev_gain_ctrl_add(struct pcmdevice_priv *pcm_dev,
ret = -ENOMEM;
goto out;
}
- if (comp->name_prefix)
- scnprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN,
- ctrl_name, comp->name_prefix, dev_no, chn);
- else
- scnprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN,
- ctrl_name, pcm_dev->upper_dev_name, adap->nr,
- dev_no, chn);
+ scnprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN,
+ ctrl_name, pcm_dev->upper_dev_name, adap->nr,
+ dev_no, chn);
pcmdev_controls[mix_index].tlv.p =
pcmdev_gain_ctl_info[id][ctl_id].gain;
pcmdev_ctrl = devm_kmemdup(pcm_dev->dev,
@@ -1437,13 +1424,8 @@ static int pcmdev_profile_ctrl_add(struct pcmdevice_priv *pcm_dev)
if (!name)
return -ENOMEM;
- if (comp->name_prefix)
- scnprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN,
- "%s Profile id", comp->name_prefix);
- else
- scnprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN,
- "%s i2c%d Profile id", pcm_dev->upper_dev_name,
- adap->nr);
+ scnprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN,
+ "%s i2c%d Profile id", pcm_dev->upper_dev_name, adap->nr);
pcmdev_ctrl->name = name;
pcmdev_ctrl->iface = SNDRV_CTL_ELEM_IFACE_MIXER;
pcmdev_ctrl->info = pcmdevice_info_profile;
--
2.34.1
next reply other threads:[~2024-07-05 6:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-05 6:48 Shenghao Ding [this message]
2024-07-05 18:04 ` 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=20240705064846.1723-1-shenghao-ding@ti.com \
--to=shenghao-ding@ti.com \
--cc=13916275206@139.com \
--cc=Baojun.Xu@fpt.com \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=soyer@irl.hu \
--cc=tiwai@suse.com \
--cc=tiwai@suse.de \
/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
all inboxes | Powered by JetHome®