Commit d870a91e authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: rsnd: move rsnd_mod_call() macro

core.c is the only user of rsnd_mod_call() macro.
Move it to core.c from rsnd.h
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 49848073
...@@ -291,16 +291,30 @@ void rsnd_dma_quit(struct rsnd_priv *priv, ...@@ -291,16 +291,30 @@ void rsnd_dma_quit(struct rsnd_priv *priv,
/* /*
* rsnd_dai functions * rsnd_dai functions
*/ */
#define rsnd_dai_call(rdai, io, fn) \ #define __rsnd_mod_call(mod, func, rdai, io) \
({ \ ({ \
struct rsnd_mod *mod, *n; \ struct rsnd_priv *priv = rsnd_mod_to_priv(mod); \
int ret = 0; \ struct device *dev = rsnd_priv_to_dev(priv); \
for_each_rsnd_mod(mod, n, io) { \ dev_dbg(dev, "%s [%d] %s\n", \
ret = rsnd_mod_call(mod, fn, rdai, io); \ rsnd_mod_name(mod), rsnd_mod_id(mod), #func); \
if (ret < 0) \ (mod)->ops->func(mod, rdai, io); \
break; \ })
} \
ret; \ #define rsnd_mod_call(mod, func, rdai, io) \
(!(mod) ? -ENODEV : \
!((mod)->ops->func) ? 0 : \
__rsnd_mod_call(mod, func, (rdai), (io)))
#define rsnd_dai_call(rdai, io, fn) \
({ \
struct rsnd_mod *mod, *n; \
int ret = 0; \
for_each_rsnd_mod(mod, n, (io)) { \
ret = rsnd_mod_call(mod, fn, (rdai), (io)); \
if (ret < 0) \
break; \
} \
ret; \
}) })
int rsnd_dai_connect(struct rsnd_dai *rdai, int rsnd_dai_connect(struct rsnd_dai *rdai,
......
...@@ -169,19 +169,6 @@ struct rsnd_mod { ...@@ -169,19 +169,6 @@ struct rsnd_mod {
#define rsnd_mod_id(mod) ((mod)->id) #define rsnd_mod_id(mod) ((mod)->id)
#define for_each_rsnd_mod(pos, n, io) \ #define for_each_rsnd_mod(pos, n, io) \
list_for_each_entry_safe(pos, n, &(io)->head, list) list_for_each_entry_safe(pos, n, &(io)->head, list)
#define __rsnd_mod_call(mod, func, rdai, io) \
({ \
struct rsnd_priv *priv = rsnd_mod_to_priv(mod); \
struct device *dev = rsnd_priv_to_dev(priv); \
dev_dbg(dev, "%s-%d-%s\n", \
rsnd_mod_name(mod), rsnd_mod_id(mod), #func); \
(mod)->ops->func(mod, rdai, io); \
})
#define rsnd_mod_call(mod, func, rdai, io) \
(!(mod) ? -ENODEV : \
!((mod)->ops->func) ? 0 : \
__rsnd_mod_call(mod, func, rdai, io))
void rsnd_mod_init(struct rsnd_priv *priv, void rsnd_mod_init(struct rsnd_priv *priv,
struct rsnd_mod *mod, struct rsnd_mod *mod,
......
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