diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2015-01-15 03:08:34 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-01-15 06:37:48 -0500 |
commit | 1b13d118ee8f25227ad779c0f62b46e997e9f5a3 (patch) | |
tree | fa885718b981537111fd532bb88541875f5ad583 | |
parent | 690602fcd85385ff325b65fe4bba32ceaf3c33a3 (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.c | 5 | ||||
-rw-r--r-- | sound/soc/sh/rcar/dvc.c | 2 | ||||
-rw-r--r-- | sound/soc/sh/rcar/rsnd.h | 9 | ||||
-rw-r--r-- | sound/soc/sh/rcar/src.c | 2 | ||||
-rw-r--r-- | sound/soc/sh/rcar/ssi.c | 6 |
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) | |||
149 | return mod->ops->dma_name(mod); | 149 | return mod->ops->dma_name(mod); |
150 | } | 150 | } |
151 | 151 | ||
152 | void rsnd_mod_init(struct rsnd_priv *priv, | 152 | void rsnd_mod_init(struct rsnd_mod *mod, |
153 | struct rsnd_mod *mod, | ||
154 | struct rsnd_mod_ops *ops, | 153 | struct rsnd_mod_ops *ops, |
155 | struct clk *clk, | 154 | struct clk *clk, |
156 | enum rsnd_mod_type type, | 155 | enum rsnd_mod_type type, |
157 | int id) | 156 | int id) |
158 | { | 157 | { |
159 | mod->priv = priv; | ||
160 | mod->id = id; | 158 | mod->id = id; |
161 | mod->ops = ops; | 159 | mod->ops = ops; |
162 | mod->type = type; | 160 | mod->type = type; |
@@ -868,6 +866,7 @@ static int rsnd_dai_probe(struct platform_device *pdev, | |||
868 | * init rsnd_dai | 866 | * init rsnd_dai |
869 | */ | 867 | */ |
870 | snprintf(rdai[i].name, RSND_DAI_NAME_SIZE, "rsnd-dai.%d", i); | 868 | snprintf(rdai[i].name, RSND_DAI_NAME_SIZE, "rsnd-dai.%d", i); |
869 | rdai[i].priv = priv; | ||
871 | 870 | ||
872 | /* | 871 | /* |
873 | * init snd_soc_dai_driver | 872 | * 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, | |||
351 | 351 | ||
352 | dvc->info = &info->dvc_info[i]; | 352 | dvc->info = &info->dvc_info[i]; |
353 | 353 | ||
354 | rsnd_mod_init(priv, &dvc->mod, &rsnd_dvc_ops, | 354 | rsnd_mod_init(&dvc->mod, &rsnd_dvc_ops, |
355 | clk, RSND_MOD_DVC, i); | 355 | clk, RSND_MOD_DVC, i); |
356 | 356 | ||
357 | dev_dbg(dev, "CMD%d probed\n", i); | 357 | 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; | |||
221 | struct rsnd_mod { | 221 | struct rsnd_mod { |
222 | int id; | 222 | int id; |
223 | enum rsnd_mod_type type; | 223 | enum rsnd_mod_type type; |
224 | struct rsnd_priv *priv; | ||
225 | struct rsnd_mod_ops *ops; | 224 | struct rsnd_mod_ops *ops; |
226 | struct rsnd_dma dma; | 225 | struct rsnd_dma dma; |
227 | struct rsnd_dai_stream *io; | 226 | struct rsnd_dai_stream *io; |
@@ -256,7 +255,7 @@ struct rsnd_mod { | |||
256 | #define __rsnd_mod_call_pcm_new 0 | 255 | #define __rsnd_mod_call_pcm_new 0 |
257 | #define __rsnd_mod_call_fallback 0 | 256 | #define __rsnd_mod_call_fallback 0 |
258 | 257 | ||
259 | #define rsnd_mod_to_priv(mod) ((mod)->priv) | 258 | #define rsnd_mod_to_priv(mod) (rsnd_io_to_priv(rsnd_mod_to_io(mod))) |
260 | #define rsnd_mod_to_dma(mod) (&(mod)->dma) | 259 | #define rsnd_mod_to_dma(mod) (&(mod)->dma) |
261 | #define rsnd_dma_to_mod(_dma) container_of((_dma), struct rsnd_mod, dma) | 260 | #define rsnd_dma_to_mod(_dma) container_of((_dma), struct rsnd_mod, dma) |
262 | #define rsnd_mod_to_io(mod) ((mod)->io) | 261 | #define rsnd_mod_to_io(mod) ((mod)->io) |
@@ -264,8 +263,7 @@ struct rsnd_mod { | |||
264 | #define rsnd_mod_hw_start(mod) clk_prepare_enable((mod)->clk) | 263 | #define rsnd_mod_hw_start(mod) clk_prepare_enable((mod)->clk) |
265 | #define rsnd_mod_hw_stop(mod) clk_disable_unprepare((mod)->clk) | 264 | #define rsnd_mod_hw_stop(mod) clk_disable_unprepare((mod)->clk) |
266 | 265 | ||
267 | void rsnd_mod_init(struct rsnd_priv *priv, | 266 | void rsnd_mod_init(struct rsnd_mod *mod, |
268 | struct rsnd_mod *mod, | ||
269 | struct rsnd_mod_ops *ops, | 267 | struct rsnd_mod_ops *ops, |
270 | struct clk *clk, | 268 | struct clk *clk, |
271 | enum rsnd_mod_type type, | 269 | enum rsnd_mod_type type, |
@@ -291,6 +289,7 @@ struct rsnd_dai_stream { | |||
291 | #define rsnd_io_to_mod_src(io) ((io)->mod[RSND_MOD_SRC]) | 289 | #define rsnd_io_to_mod_src(io) ((io)->mod[RSND_MOD_SRC]) |
292 | #define rsnd_io_to_mod_dvc(io) ((io)->mod[RSND_MOD_DVC]) | 290 | #define rsnd_io_to_mod_dvc(io) ((io)->mod[RSND_MOD_DVC]) |
293 | #define rsnd_io_to_rdai(io) ((io)->rdai) | 291 | #define rsnd_io_to_rdai(io) ((io)->rdai) |
292 | #define rsnd_io_to_priv(io) (rsnd_rdai_to_priv(rsnd_io_to_rdai(io))) | ||
294 | #define rsnd_io_is_play(io) (&rsnd_io_to_rdai(io)->playback == io) | 293 | #define rsnd_io_is_play(io) (&rsnd_io_to_rdai(io)->playback == io) |
295 | #define rsnd_io_to_runtime(io) ((io)->substream ? \ | 294 | #define rsnd_io_to_runtime(io) ((io)->substream ? \ |
296 | (io)->substream->runtime : NULL) | 295 | (io)->substream->runtime : NULL) |
@@ -300,6 +299,7 @@ struct rsnd_dai { | |||
300 | char name[RSND_DAI_NAME_SIZE]; | 299 | char name[RSND_DAI_NAME_SIZE]; |
301 | struct rsnd_dai_stream playback; | 300 | struct rsnd_dai_stream playback; |
302 | struct rsnd_dai_stream capture; | 301 | struct rsnd_dai_stream capture; |
302 | struct rsnd_priv *priv; | ||
303 | 303 | ||
304 | unsigned int clk_master:1; | 304 | unsigned int clk_master:1; |
305 | unsigned int bit_clk_inv:1; | 305 | unsigned int bit_clk_inv:1; |
@@ -310,6 +310,7 @@ struct rsnd_dai { | |||
310 | 310 | ||
311 | #define rsnd_rdai_nr(priv) ((priv)->rdai_nr) | 311 | #define rsnd_rdai_nr(priv) ((priv)->rdai_nr) |
312 | #define rsnd_rdai_is_clk_master(rdai) ((rdai)->clk_master) | 312 | #define rsnd_rdai_is_clk_master(rdai) ((rdai)->clk_master) |
313 | #define rsnd_rdai_to_priv(rdai) ((rdai)->priv) | ||
313 | #define for_each_rsnd_dai(rdai, priv, i) \ | 314 | #define for_each_rsnd_dai(rdai, priv, i) \ |
314 | for (i = 0; \ | 315 | for (i = 0; \ |
315 | (i < rsnd_rdai_nr(priv)) && \ | 316 | (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, | |||
889 | 889 | ||
890 | src->info = &info->src_info[i]; | 890 | src->info = &info->src_info[i]; |
891 | 891 | ||
892 | rsnd_mod_init(priv, &src->mod, ops, clk, RSND_MOD_SRC, i); | 892 | rsnd_mod_init(&src->mod, ops, clk, RSND_MOD_SRC, i); |
893 | 893 | ||
894 | dev_dbg(dev, "SRC%d probed\n", i); | 894 | dev_dbg(dev, "SRC%d probed\n", i); |
895 | } | 895 | } |
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, | |||
125 | static int rsnd_ssi_master_clk_start(struct rsnd_ssi *ssi, | 125 | static int rsnd_ssi_master_clk_start(struct rsnd_ssi *ssi, |
126 | struct rsnd_dai_stream *io) | 126 | struct rsnd_dai_stream *io) |
127 | { | 127 | { |
128 | struct rsnd_priv *priv = rsnd_mod_to_priv(&ssi->mod); | 128 | struct rsnd_priv *priv = rsnd_io_to_priv(io); |
129 | struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); | 129 | struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); |
130 | struct device *dev = rsnd_priv_to_dev(priv); | 130 | struct device *dev = rsnd_priv_to_dev(priv); |
131 | int i, j, ret; | 131 | int i, j, ret; |
@@ -179,7 +179,7 @@ static void rsnd_ssi_master_clk_stop(struct rsnd_ssi *ssi) | |||
179 | static void rsnd_ssi_hw_start(struct rsnd_ssi *ssi, | 179 | static void rsnd_ssi_hw_start(struct rsnd_ssi *ssi, |
180 | struct rsnd_dai_stream *io) | 180 | struct rsnd_dai_stream *io) |
181 | { | 181 | { |
182 | struct rsnd_priv *priv = rsnd_mod_to_priv(&ssi->mod); | 182 | struct rsnd_priv *priv = rsnd_io_to_priv(io); |
183 | struct rsnd_dai *rdai = rsnd_io_to_rdai(io); | 183 | struct rsnd_dai *rdai = rsnd_io_to_rdai(io); |
184 | struct device *dev = rsnd_priv_to_dev(priv); | 184 | struct device *dev = rsnd_priv_to_dev(priv); |
185 | u32 cr_mode; | 185 | u32 cr_mode; |
@@ -730,7 +730,7 @@ int rsnd_ssi_probe(struct platform_device *pdev, | |||
730 | else if (rsnd_ssi_pio_available(ssi)) | 730 | else if (rsnd_ssi_pio_available(ssi)) |
731 | ops = &rsnd_ssi_pio_ops; | 731 | ops = &rsnd_ssi_pio_ops; |
732 | 732 | ||
733 | rsnd_mod_init(priv, &ssi->mod, ops, clk, RSND_MOD_SSI, i); | 733 | rsnd_mod_init(&ssi->mod, ops, clk, RSND_MOD_SSI, i); |
734 | 734 | ||
735 | rsnd_ssi_parent_clk_setup(priv, ssi); | 735 | rsnd_ssi_parent_clk_setup(priv, ssi); |
736 | } | 736 | } |