Commit 16d44989 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: rsnd: don't use private_value on rsnd_kctrl_new()

Current rsnd kctrl is using both .private_value (for rsnd_kctrl_cfg)
and .private_data (for rsnd_mod) on snd_kcontrol.
But only 1 private data (= rsnd_kctrl_cfg) can be enough if it has
rsnd_mod pointer.
This patch doesn't use private_value.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 32e1b60d
...@@ -1169,11 +1169,10 @@ static struct snd_pcm_ops rsnd_pcm_ops = { ...@@ -1169,11 +1169,10 @@ static struct snd_pcm_ops rsnd_pcm_ops = {
/* /*
* snd_kcontrol * snd_kcontrol
*/ */
#define kcontrol_to_cfg(kctrl) ((struct rsnd_kctrl_cfg *)kctrl->private_value)
static int rsnd_kctrl_info(struct snd_kcontrol *kctrl, static int rsnd_kctrl_info(struct snd_kcontrol *kctrl,
struct snd_ctl_elem_info *uinfo) struct snd_ctl_elem_info *uinfo)
{ {
struct rsnd_kctrl_cfg *cfg = kcontrol_to_cfg(kctrl); struct rsnd_kctrl_cfg *cfg = snd_kcontrol_chip(kctrl);
if (cfg->texts) { if (cfg->texts) {
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
...@@ -1199,7 +1198,7 @@ static int rsnd_kctrl_info(struct snd_kcontrol *kctrl, ...@@ -1199,7 +1198,7 @@ static int rsnd_kctrl_info(struct snd_kcontrol *kctrl,
static int rsnd_kctrl_get(struct snd_kcontrol *kctrl, static int rsnd_kctrl_get(struct snd_kcontrol *kctrl,
struct snd_ctl_elem_value *uc) struct snd_ctl_elem_value *uc)
{ {
struct rsnd_kctrl_cfg *cfg = kcontrol_to_cfg(kctrl); struct rsnd_kctrl_cfg *cfg = snd_kcontrol_chip(kctrl);
int i; int i;
for (i = 0; i < cfg->size; i++) for (i = 0; i < cfg->size; i++)
...@@ -1214,8 +1213,7 @@ static int rsnd_kctrl_get(struct snd_kcontrol *kctrl, ...@@ -1214,8 +1213,7 @@ static int rsnd_kctrl_get(struct snd_kcontrol *kctrl,
static int rsnd_kctrl_put(struct snd_kcontrol *kctrl, static int rsnd_kctrl_put(struct snd_kcontrol *kctrl,
struct snd_ctl_elem_value *uc) struct snd_ctl_elem_value *uc)
{ {
struct rsnd_mod *mod = snd_kcontrol_chip(kctrl); struct rsnd_kctrl_cfg *cfg = snd_kcontrol_chip(kctrl);
struct rsnd_kctrl_cfg *cfg = kcontrol_to_cfg(kctrl);
int i, change = 0; int i, change = 0;
if (!cfg->accept(cfg->io)) if (!cfg->accept(cfg->io))
...@@ -1232,7 +1230,7 @@ static int rsnd_kctrl_put(struct snd_kcontrol *kctrl, ...@@ -1232,7 +1230,7 @@ static int rsnd_kctrl_put(struct snd_kcontrol *kctrl,
} }
if (change && cfg->update) if (change && cfg->update)
cfg->update(cfg->io, mod); cfg->update(cfg->io, cfg->mod);
return change; return change;
} }
...@@ -1284,14 +1282,13 @@ int rsnd_kctrl_new(struct rsnd_mod *mod, ...@@ -1284,14 +1282,13 @@ int rsnd_kctrl_new(struct rsnd_mod *mod,
.index = rtd->num, .index = rtd->num,
.get = rsnd_kctrl_get, .get = rsnd_kctrl_get,
.put = rsnd_kctrl_put, .put = rsnd_kctrl_put,
.private_value = (unsigned long)cfg,
}; };
int ret; int ret;
if (size > RSND_MAX_CHANNELS) if (size > RSND_MAX_CHANNELS)
return -EINVAL; return -EINVAL;
kctrl = snd_ctl_new1(&knew, mod); kctrl = snd_ctl_new1(&knew, cfg);
if (!kctrl) if (!kctrl)
return -ENOMEM; return -ENOMEM;
...@@ -1307,6 +1304,7 @@ int rsnd_kctrl_new(struct rsnd_mod *mod, ...@@ -1307,6 +1304,7 @@ int rsnd_kctrl_new(struct rsnd_mod *mod,
cfg->card = card; cfg->card = card;
cfg->kctrl = kctrl; cfg->kctrl = kctrl;
cfg->io = io; cfg->io = io;
cfg->mod = mod;
return 0; return 0;
} }
......
...@@ -614,6 +614,7 @@ struct rsnd_kctrl_cfg { ...@@ -614,6 +614,7 @@ struct rsnd_kctrl_cfg {
struct rsnd_dai_stream *io; struct rsnd_dai_stream *io;
struct snd_card *card; struct snd_card *card;
struct snd_kcontrol *kctrl; struct snd_kcontrol *kctrl;
struct rsnd_mod *mod;
}; };
#define RSND_MAX_CHANNELS 8 #define RSND_MAX_CHANNELS 8
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment