aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKuninori Morimoto2015-01-15 08:08:34 +0000
committerMark Brown2015-01-15 11:37:48 +0000
commit1b13d118ee8f25227ad779c0f62b46e997e9f5a3 (patch)
treefa885718b981537111fd532bb88541875f5ad583
parent690602fcd85385ff325b65fe4bba32ceaf3c33a3 (diff)
ASoC: rsnd: save priv in struct rsnd_dai
Current rsnd driver has rsnd_mod_to_priv() macro, and struct rsnd_mod has struct rsnd_priv pointer. But, it is waste of memory from data structure point of view. Today we can link mod <-> io <-> rdai each other, so saving priv in rdai is very reasonable. 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.c5
-rw-r--r--sound/soc/sh/rcar/dvc.c2
-rw-r--r--sound/soc/sh/rcar/rsnd.h9
-rw-r--r--sound/soc/sh/rcar/src.c2
-rw-r--r--sound/soc/sh/rcar/ssi.c6
5 files changed, 12 insertions, 12 deletions
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 6fa8709571ff..f0bb137da31b 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -149,14 +149,12 @@ char *rsnd_mod_dma_name(struct rsnd_mod *mod)
return mod->ops->dma_name(mod);
}
-void rsnd_mod_init(struct rsnd_priv *priv,
- struct rsnd_mod *mod,
+void rsnd_mod_init(struct rsnd_mod *mod,
struct rsnd_mod_ops *ops,
struct clk *clk,
enum rsnd_mod_type type,
int id)
{
- mod->priv = priv;
mod->id = id;
mod->ops = ops;
mod->type = type;
@@ -868,6 +866,7 @@ static int rsnd_dai_probe(struct platform_device *pdev,
* init rsnd_dai
*/
snprintf(rdai[i].name, RSND_DAI_NAME_SIZE, "rsnd-dai.%d", i);
+ rdai[i].priv = priv;
/*
* init snd_soc_dai_driver
diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
index 4ddca4f380c7..38a5f334a6a7 100644
--- a/sound/soc/sh/rcar/dvc.c
+++ b/sound/soc/sh/rcar/dvc.c
@@ -351,7 +351,7 @@ int rsnd_dvc_probe(struct platform_device *pdev,
dvc->info = &info->dvc_info[i];
- rsnd_mod_init(priv, &dvc->mod, &rsnd_dvc_ops,
+ rsnd_mod_init(&dvc->mod, &rsnd_dvc_ops,
clk, RSND_MOD_DVC, i);
dev_dbg(dev, "CMD%d probed\n", i);
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 61545357f036..11a1c412f1f1 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -221,7 +221,6 @@ struct rsnd_dai_stream;
struct rsnd_mod {
int id;
enum rsnd_mod_type type;
- struct rsnd_priv *priv;
struct rsnd_mod_ops *ops;
struct rsnd_dma dma;
struct rsnd_dai_stream *io;
@@ -256,7 +255,7 @@ struct rsnd_mod {
#define __rsnd_mod_call_pcm_new 0
#define __rsnd_mod_call_fallback 0
-#define rsnd_mod_to_priv(mod) ((mod)->priv)
+#define rsnd_mod_to_priv(mod) (rsnd_io_to_priv(rsnd_mod_to_io(mod)))
#define rsnd_mod_to_dma(mod) (&(mod)->dma)
#define rsnd_dma_to_mod(_dma) container_of((_dma), struct rsnd_mod, dma)
#define rsnd_mod_to_io(mod) ((mod)->io)
@@ -264,8 +263,7 @@ struct rsnd_mod {
#define rsnd_mod_hw_start(mod) clk_prepare_enable((mod)->clk)
#define rsnd_mod_hw_stop(mod) clk_disable_unprepare((mod)->clk)
-void rsnd_mod_init(struct rsnd_priv *priv,
- struct rsnd_mod *mod,
+void rsnd_mod_init(struct rsnd_mod *mod,
struct rsnd_mod_ops *ops,
struct clk *clk,
enum rsnd_mod_type type,
@@ -291,6 +289,7 @@ struct rsnd_dai_stream {
#define rsnd_io_to_mod_src(io) ((io)->mod[RSND_MOD_SRC])
#define rsnd_io_to_mod_dvc(io) ((io)->mod[RSND_MOD_DVC])
#define rsnd_io_to_rdai(io) ((io)->rdai)
+#define rsnd_io_to_priv(io) (rsnd_rdai_to_priv(rsnd_io_to_rdai(io)))
#define rsnd_io_is_play(io) (&rsnd_io_to_rdai(io)->playback == io)
#define rsnd_io_to_runtime(io) ((io)->substream ? \
(io)->substream->runtime : NULL)
@@ -300,6 +299,7 @@ struct rsnd_dai {
char name[RSND_DAI_NAME_SIZE];
struct rsnd_dai_stream playback;
struct rsnd_dai_stream capture;
+ struct rsnd_priv *priv;
unsigned int clk_master:1;
unsigned int bit_clk_inv:1;
@@ -310,6 +310,7 @@ struct rsnd_dai {
#define rsnd_rdai_nr(priv) ((priv)->rdai_nr)
#define rsnd_rdai_is_clk_master(rdai) ((rdai)->clk_master)
+#define rsnd_rdai_to_priv(rdai) ((rdai)->priv)
#define for_each_rsnd_dai(rdai, priv, i) \
for (i = 0; \
(i < rsnd_rdai_nr(priv)) && \
diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index 0d136cdc4ada..8c22d2112a1d 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -889,7 +889,7 @@ int rsnd_src_probe(struct platform_device *pdev,
src->info = &info->src_info[i];
- rsnd_mod_init(priv, &src->mod, ops, clk, RSND_MOD_SRC, i);
+ rsnd_mod_init(&src->mod, ops, clk, RSND_MOD_SRC, i);
dev_dbg(dev, "SRC%d probed\n", i);
}
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index b5a2fd61029d..9b89f6cf7680 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -125,7 +125,7 @@ static void rsnd_ssi_status_check(struct rsnd_mod *mod,
static int rsnd_ssi_master_clk_start(struct rsnd_ssi *ssi,
struct rsnd_dai_stream *io)
{
- struct rsnd_priv *priv = rsnd_mod_to_priv(&ssi->mod);
+ struct rsnd_priv *priv = rsnd_io_to_priv(io);
struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
struct device *dev = rsnd_priv_to_dev(priv);
int i, j, ret;
@@ -179,7 +179,7 @@ static void rsnd_ssi_master_clk_stop(struct rsnd_ssi *ssi)
static void rsnd_ssi_hw_start(struct rsnd_ssi *ssi,
struct rsnd_dai_stream *io)
{
- struct rsnd_priv *priv = rsnd_mod_to_priv(&ssi->mod);
+ struct rsnd_priv *priv = rsnd_io_to_priv(io);
struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
struct device *dev = rsnd_priv_to_dev(priv);
u32 cr_mode;
@@ -730,7 +730,7 @@ int rsnd_ssi_probe(struct platform_device *pdev,
else if (rsnd_ssi_pio_available(ssi))
ops = &rsnd_ssi_pio_ops;
- rsnd_mod_init(priv, &ssi->mod, ops, clk, RSND_MOD_SSI, i);
+ rsnd_mod_init(&ssi->mod, ops, clk, RSND_MOD_SSI, i);
rsnd_ssi_parent_clk_setup(priv, ssi);
}