aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKuninori Morimoto2015-01-15 08:07:47 +0000
committerMark Brown2015-01-15 11:37:48 +0000
commit690602fcd85385ff325b65fe4bba32ceaf3c33a3 (patch)
tree48cd9bd3289654be1db421cc5f922e1b4dbd5603
parentf708d944fee384961f5ab7df3463760099c9d69c (diff)
ASoC: rsnd: replace rdai to priv in each function
Current rsnd driver's function requests rdai, but it is not used. Adding priv is more reasonable. Let's replace it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/sh/rcar/core.c41
-rw-r--r--sound/soc/sh/rcar/dvc.c13
-rw-r--r--sound/soc/sh/rcar/rsnd.h15
-rw-r--r--sound/soc/sh/rcar/src.c25
-rw-r--r--sound/soc/sh/rcar/ssi.c39
5 files changed, 60 insertions, 73 deletions
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 74e2c4214058..6fa8709571ff 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -414,7 +414,7 @@ u32 rsnd_get_adinr(struct rsnd_mod *mod)
/*
* rsnd_dai functions
*/
-#define __rsnd_mod_call(mod, func, rdai...) \
+#define __rsnd_mod_call(mod, func, param...) \
({ \
struct rsnd_priv *priv = rsnd_mod_to_priv(mod); \
struct device *dev = rsnd_priv_to_dev(priv); \
@@ -424,18 +424,18 @@ u32 rsnd_get_adinr(struct rsnd_mod *mod)
if ((mod->status & mask) == call) { \
dev_dbg(dev, "%s[%d] %s\n", \
rsnd_mod_name(mod), rsnd_mod_id(mod), #func); \
- ret = (mod)->ops->func(mod, rdai); \
+ ret = (mod)->ops->func(mod, param); \
mod->status = (mod->status & ~mask) | (~call & mask); \
} \
ret; \
})
-#define rsnd_mod_call(mod, func, rdai...) \
+#define rsnd_mod_call(mod, func, param...) \
(!(mod) ? -ENODEV : \
!((mod)->ops->func) ? 0 : \
- __rsnd_mod_call(mod, func, rdai))
+ __rsnd_mod_call(mod, func, param))
-#define rsnd_dai_call(fn, io, rdai...) \
+#define rsnd_dai_call(fn, io, param...) \
({ \
struct rsnd_mod *mod; \
int ret = 0, i; \
@@ -443,7 +443,7 @@ u32 rsnd_get_adinr(struct rsnd_mod *mod)
mod = (io)->mod[i]; \
if (!mod) \
continue; \
- ret = rsnd_mod_call(mod, fn, rdai); \
+ ret = rsnd_mod_call(mod, fn, param); \
if (ret < 0) \
break; \
} \
@@ -585,20 +585,20 @@ static int rsnd_soc_dai_trigger(struct snd_pcm_substream *substream, int cmd,
if (ret < 0)
goto dai_trigger_end;
- ret = rsnd_dai_call(init, io, rdai);
+ ret = rsnd_dai_call(init, io, priv);
if (ret < 0)
goto dai_trigger_end;
- ret = rsnd_dai_call(start, io, rdai);
+ ret = rsnd_dai_call(start, io, priv);
if (ret < 0)
goto dai_trigger_end;
break;
case SNDRV_PCM_TRIGGER_STOP:
- ret = rsnd_dai_call(stop, io, rdai);
+ ret = rsnd_dai_call(stop, io, priv);
if (ret < 0)
goto dai_trigger_end;
- ret = rsnd_dai_call(quit, io, rdai);
+ ret = rsnd_dai_call(quit, io, priv);
if (ret < 0)
goto dai_trigger_end;
@@ -1109,11 +1109,11 @@ static int rsnd_pcm_new(struct snd_soc_pcm_runtime *rtd)
struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai);
int ret;
- ret = rsnd_dai_call(pcm_new, &rdai->playback, rdai, rtd);
+ ret = rsnd_dai_call(pcm_new, &rdai->playback, rtd);
if (ret)
return ret;
- ret = rsnd_dai_call(pcm_new, &rdai->capture, rdai, rtd);
+ ret = rsnd_dai_call(pcm_new, &rdai->capture, rtd);
if (ret)
return ret;
@@ -1136,10 +1136,9 @@ static const struct snd_soc_component_driver rsnd_soc_component = {
static int rsnd_rdai_continuance_probe(struct rsnd_priv *priv,
struct rsnd_dai_stream *io)
{
- struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
int ret;
- ret = rsnd_dai_call(probe, io, rdai);
+ ret = rsnd_dai_call(probe, io, priv);
if (ret == -EAGAIN) {
/*
* Fallback to PIO mode
@@ -1152,7 +1151,7 @@ static int rsnd_rdai_continuance_probe(struct rsnd_priv *priv,
* rsnd_dma_init()
* rsnd_ssi_fallback()
*/
- rsnd_dai_call(remove, io, rdai);
+ rsnd_dai_call(remove, io, priv);
/*
* remove SRC/DVC from DAI,
@@ -1163,13 +1162,13 @@ static int rsnd_rdai_continuance_probe(struct rsnd_priv *priv,
/*
* fallback
*/
- rsnd_dai_call(fallback, io, rdai);
+ rsnd_dai_call(fallback, io, priv);
/*
* retry to "probe".
* DAI has SSI which is PIO mode only now.
*/
- ret = rsnd_dai_call(probe, io, rdai);
+ ret = rsnd_dai_call(probe, io, priv);
}
return ret;
@@ -1272,8 +1271,8 @@ exit_snd_soc:
snd_soc_unregister_platform(dev);
exit_snd_probe:
for_each_rsnd_dai(rdai, priv, i) {
- rsnd_dai_call(remove, &rdai->playback, rdai);
- rsnd_dai_call(remove, &rdai->capture, rdai);
+ rsnd_dai_call(remove, &rdai->playback, priv);
+ rsnd_dai_call(remove, &rdai->capture, priv);
}
return ret;
@@ -1288,8 +1287,8 @@ static int rsnd_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev);
for_each_rsnd_dai(rdai, priv, i) {
- ret |= rsnd_dai_call(remove, &rdai->playback, rdai);
- ret |= rsnd_dai_call(remove, &rdai->capture, rdai);
+ ret |= rsnd_dai_call(remove, &rdai->playback, priv);
+ ret |= rsnd_dai_call(remove, &rdai->capture, priv);
}
return ret;
diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
index e24db9e4ee25..4ddca4f380c7 100644
--- a/sound/soc/sh/rcar/dvc.c
+++ b/sound/soc/sh/rcar/dvc.c
@@ -117,9 +117,8 @@ static void rsnd_dvc_volume_update(struct rsnd_mod *mod)
}
static int rsnd_dvc_probe_gen2(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+ struct rsnd_priv *priv)
{
- struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct device *dev = rsnd_priv_to_dev(priv);
dev_dbg(dev, "%s[%d] (Gen2) is probed\n",
@@ -129,10 +128,9 @@ static int rsnd_dvc_probe_gen2(struct rsnd_mod *mod,
}
static int rsnd_dvc_init(struct rsnd_mod *dvc_mod,
- struct rsnd_dai *rdai)
+ struct rsnd_priv *priv)
{
struct rsnd_dai_stream *io = rsnd_mod_to_io(dvc_mod);
- struct rsnd_priv *priv = rsnd_mod_to_priv(dvc_mod);
struct rsnd_mod *src_mod = rsnd_io_to_mod_src(io);
struct device *dev = rsnd_priv_to_dev(priv);
int dvc_id = rsnd_mod_id(dvc_mod);
@@ -177,7 +175,7 @@ static int rsnd_dvc_init(struct rsnd_mod *dvc_mod,
}
static int rsnd_dvc_quit(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+ struct rsnd_priv *priv)
{
rsnd_mod_hw_stop(mod);
@@ -185,7 +183,7 @@ static int rsnd_dvc_quit(struct rsnd_mod *mod,
}
static int rsnd_dvc_start(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+ struct rsnd_priv *priv)
{
rsnd_mod_write(mod, CMD_CTRL, 0x10);
@@ -193,7 +191,7 @@ static int rsnd_dvc_start(struct rsnd_mod *mod,
}
static int rsnd_dvc_stop(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+ struct rsnd_priv *priv)
{
rsnd_mod_write(mod, CMD_CTRL, 0);
@@ -201,7 +199,6 @@ static int rsnd_dvc_stop(struct rsnd_mod *mod,
}
static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
- struct rsnd_dai *rdai,
struct snd_soc_pcm_runtime *rtd)
{
struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index aaba717b8fd3..61545357f036 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -200,22 +200,21 @@ struct rsnd_mod_ops {
char *name;
char* (*dma_name)(struct rsnd_mod *mod);
int (*probe)(struct rsnd_mod *mod,
- struct rsnd_dai *rdai);
+ struct rsnd_priv *priv);
int (*remove)(struct rsnd_mod *mod,
- struct rsnd_dai *rdai);
+ struct rsnd_priv *priv);
int (*init)(struct rsnd_mod *mod,
- struct rsnd_dai *rdai);
+ struct rsnd_priv *priv);
int (*quit)(struct rsnd_mod *mod,
- struct rsnd_dai *rdai);
+ struct rsnd_priv *priv);
int (*start)(struct rsnd_mod *mod,
- struct rsnd_dai *rdai);
+ struct rsnd_priv *priv);
int (*stop)(struct rsnd_mod *mod,
- struct rsnd_dai *rdai);
+ struct rsnd_priv *priv);
int (*pcm_new)(struct rsnd_mod *mod,
- struct rsnd_dai *rdai,
struct snd_soc_pcm_runtime *rtd);
int (*fallback)(struct rsnd_mod *mod,
- struct rsnd_dai *rdai);
+ struct rsnd_priv *priv);
};
struct rsnd_dai_stream;
diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index 31e19a00655f..0d136cdc4ada 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -294,10 +294,9 @@ static int rsnd_src_init(struct rsnd_mod *mod)
}
static int rsnd_src_quit(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+ struct rsnd_priv *priv)
{
struct rsnd_src *src = rsnd_mod_to_src(mod);
- struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct device *dev = rsnd_priv_to_dev(priv);
rsnd_mod_hw_stop(mod);
@@ -449,9 +448,8 @@ static int rsnd_src_set_convert_rate_gen1(struct rsnd_mod *mod)
}
static int rsnd_src_probe_gen1(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+ struct rsnd_priv *priv)
{
- struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct device *dev = rsnd_priv_to_dev(priv);
dev_dbg(dev, "%s[%d] (Gen1) is probed\n",
@@ -461,7 +459,7 @@ static int rsnd_src_probe_gen1(struct rsnd_mod *mod,
}
static int rsnd_src_init_gen1(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+ struct rsnd_priv *priv)
{
int ret;
@@ -485,7 +483,7 @@ static int rsnd_src_init_gen1(struct rsnd_mod *mod,
}
static int rsnd_src_start_gen1(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+ struct rsnd_priv *priv)
{
int id = rsnd_mod_id(mod);
@@ -495,7 +493,7 @@ static int rsnd_src_start_gen1(struct rsnd_mod *mod,
}
static int rsnd_src_stop_gen1(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+ struct rsnd_priv *priv)
{
int id = rsnd_mod_id(mod);
@@ -691,9 +689,8 @@ static int rsnd_src_set_convert_timing_gen2(struct rsnd_mod *mod)
}
static int rsnd_src_probe_gen2(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+ struct rsnd_priv *priv)
{
- struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct rsnd_src *src = rsnd_mod_to_src(mod);
struct device *dev = rsnd_priv_to_dev(priv);
int irq = src->info->irq;
@@ -733,15 +730,15 @@ rsnd_src_probe_gen2_fail:
}
static int rsnd_src_remove_gen2(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+ struct rsnd_priv *priv)
{
- rsnd_dma_quit(rsnd_mod_to_priv(mod), rsnd_mod_to_dma(mod));
+ rsnd_dma_quit(priv, rsnd_mod_to_dma(mod));
return 0;
}
static int rsnd_src_init_gen2(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+ struct rsnd_priv *priv)
{
int ret;
@@ -761,7 +758,7 @@ static int rsnd_src_init_gen2(struct rsnd_mod *mod,
}
static int rsnd_src_start_gen2(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+ struct rsnd_priv *priv)
{
rsnd_dma_start(rsnd_mod_to_dma(mod));
@@ -769,7 +766,7 @@ static int rsnd_src_start_gen2(struct rsnd_mod *mod,
}
static int rsnd_src_stop_gen2(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+ struct rsnd_priv *priv)
{
int ret;
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 6e36c53e7b8f..b5a2fd61029d 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -270,10 +270,11 @@ static void rsnd_ssi_hw_stop(struct rsnd_ssi *ssi)
* SSI mod common functions
*/
static int rsnd_ssi_init(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+ struct rsnd_priv *priv)
{
struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
+ struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
u32 cr;
@@ -320,10 +321,9 @@ static int rsnd_ssi_init(struct rsnd_mod *mod,
}
static int rsnd_ssi_quit(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+ struct rsnd_priv *priv)
{
struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
- struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct device *dev = rsnd_priv_to_dev(priv);
if (ssi->err > 0)
@@ -347,7 +347,7 @@ static void rsnd_ssi_record_error(struct rsnd_ssi *ssi, u32 status)
}
static int rsnd_ssi_start(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+ struct rsnd_priv *priv)
{
struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
@@ -362,7 +362,7 @@ static int rsnd_ssi_start(struct rsnd_mod *mod,
}
static int rsnd_ssi_stop(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+ struct rsnd_priv *priv)
{
struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
@@ -381,8 +381,8 @@ static irqreturn_t rsnd_ssi_interrupt(int irq, void *data)
{
struct rsnd_ssi *ssi = data;
struct rsnd_mod *mod = &ssi->mod;
+ struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
- struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
u32 status = rsnd_mod_read(mod, SSISR);
if (!io)
@@ -409,14 +409,13 @@ static irqreturn_t rsnd_ssi_interrupt(int irq, void *data)
/* PIO / DMA */
if (status & (UIRQ | OIRQ)) {
- struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct device *dev = rsnd_priv_to_dev(priv);
/*
* restart SSI
*/
- rsnd_ssi_stop(mod, rdai);
- rsnd_ssi_start(mod, rdai);
+ rsnd_ssi_stop(mod, priv);
+ rsnd_ssi_start(mod, priv);
dev_dbg(dev, "%s[%d] restart\n",
rsnd_mod_name(mod), rsnd_mod_id(mod));
@@ -431,9 +430,8 @@ static irqreturn_t rsnd_ssi_interrupt(int irq, void *data)
* SSI PIO
*/
static int rsnd_ssi_pio_probe(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+ struct rsnd_priv *priv)
{
- struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct device *dev = rsnd_priv_to_dev(priv);
struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
int ret;
@@ -462,9 +460,8 @@ static struct rsnd_mod_ops rsnd_ssi_pio_ops = {
};
static int rsnd_ssi_dma_probe(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+ struct rsnd_priv *priv)
{
- struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
struct device *dev = rsnd_priv_to_dev(priv);
int dma_id = ssi->info->dma_id;
@@ -497,14 +494,13 @@ rsnd_ssi_dma_probe_fail:
}
static int rsnd_ssi_dma_remove(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+ struct rsnd_priv *priv)
{
- struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
struct device *dev = rsnd_priv_to_dev(priv);
int irq = ssi->info->irq;
- rsnd_dma_quit(rsnd_mod_to_priv(mod), rsnd_mod_to_dma(mod));
+ rsnd_dma_quit(priv, rsnd_mod_to_dma(mod));
/* PIO will request IRQ again */
devm_free_irq(dev, irq, ssi);
@@ -513,9 +509,8 @@ static int rsnd_ssi_dma_remove(struct rsnd_mod *mod,
}
static int rsnd_ssi_fallback(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+ struct rsnd_priv *priv)
{
- struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct device *dev = rsnd_priv_to_dev(priv);
/*
@@ -534,11 +529,11 @@ static int rsnd_ssi_fallback(struct rsnd_mod *mod,
}
static int rsnd_ssi_dma_start(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+ struct rsnd_priv *priv)
{
struct rsnd_dma *dma = rsnd_mod_to_dma(mod);
- rsnd_ssi_start(mod, rdai);
+ rsnd_ssi_start(mod, priv);
rsnd_dma_start(dma);
@@ -546,13 +541,13 @@ static int rsnd_ssi_dma_start(struct rsnd_mod *mod,
}
static int rsnd_ssi_dma_stop(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+ struct rsnd_priv *priv)
{
struct rsnd_dma *dma = rsnd_mod_to_dma(mod);
rsnd_dma_stop(dma);
- rsnd_ssi_stop(mod, rdai);
+ rsnd_ssi_stop(mod, priv);
return 0;
}