ASoC: rsnd: cleanup debug information method
rsnd_mod debug information is implemented in each callback functions now. But, it can be implemented in rsnd_mod_call(), and share this code. This patch adds it Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
parent
0290d2a42c
commit
92d9587ede
|
@ -152,10 +152,19 @@ 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) \
|
#define rsnd_mod_call(mod, func, rdai, io) \
|
||||||
(!(mod) ? -ENODEV : \
|
(!(mod) ? -ENODEV : \
|
||||||
!((mod)->ops->func) ? 0 : \
|
!((mod)->ops->func) ? 0 : \
|
||||||
(mod)->ops->func(mod, rdai, io))
|
__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,
|
||||||
|
|
|
@ -300,8 +300,6 @@ static int rsnd_scu_start(struct rsnd_mod *mod,
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
dev_dbg(dev, "%s%d start\n", rsnd_mod_name(mod), rsnd_mod_id(mod));
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -324,7 +324,6 @@ static int rsnd_ssi_init(struct rsnd_mod *mod,
|
||||||
{
|
{
|
||||||
struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
|
struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
|
||||||
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
|
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
|
||||||
struct device *dev = rsnd_priv_to_dev(priv);
|
|
||||||
struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
|
struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
|
||||||
u32 cr;
|
u32 cr;
|
||||||
|
|
||||||
|
@ -371,8 +370,6 @@ static int rsnd_ssi_init(struct rsnd_mod *mod,
|
||||||
|
|
||||||
rsnd_ssi_mode_set(priv, rdai, ssi);
|
rsnd_ssi_mode_set(priv, rdai, ssi);
|
||||||
|
|
||||||
dev_dbg(dev, "%s.%d init\n", rsnd_mod_name(mod), rsnd_mod_id(mod));
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,8 +381,6 @@ static int rsnd_ssi_quit(struct rsnd_mod *mod,
|
||||||
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
|
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
|
||||||
struct device *dev = rsnd_priv_to_dev(priv);
|
struct device *dev = rsnd_priv_to_dev(priv);
|
||||||
|
|
||||||
dev_dbg(dev, "%s.%d quit\n", rsnd_mod_name(mod), rsnd_mod_id(mod));
|
|
||||||
|
|
||||||
if (ssi->err > 0)
|
if (ssi->err > 0)
|
||||||
dev_warn(dev, "ssi under/over flow err = %d\n", ssi->err);
|
dev_warn(dev, "ssi under/over flow err = %d\n", ssi->err);
|
||||||
|
|
||||||
|
@ -450,7 +445,6 @@ static int rsnd_ssi_pio_start(struct rsnd_mod *mod,
|
||||||
{
|
{
|
||||||
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
|
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
|
||||||
struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
|
struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
|
||||||
struct device *dev = rsnd_priv_to_dev(priv);
|
|
||||||
|
|
||||||
/* enable PIO IRQ */
|
/* enable PIO IRQ */
|
||||||
ssi->cr_etc = UIEN | OIEN | DIEN;
|
ssi->cr_etc = UIEN | OIEN | DIEN;
|
||||||
|
@ -461,8 +455,6 @@ static int rsnd_ssi_pio_start(struct rsnd_mod *mod,
|
||||||
|
|
||||||
rsnd_ssi_hw_start(ssi, rdai, io);
|
rsnd_ssi_hw_start(ssi, rdai, io);
|
||||||
|
|
||||||
dev_dbg(dev, "%s.%d start\n", rsnd_mod_name(mod), rsnd_mod_id(mod));
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -470,12 +462,8 @@ static int rsnd_ssi_pio_stop(struct rsnd_mod *mod,
|
||||||
struct rsnd_dai *rdai,
|
struct rsnd_dai *rdai,
|
||||||
struct rsnd_dai_stream *io)
|
struct rsnd_dai_stream *io)
|
||||||
{
|
{
|
||||||
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);
|
struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
|
||||||
|
|
||||||
dev_dbg(dev, "%s.%d stop\n", rsnd_mod_name(mod), rsnd_mod_id(mod));
|
|
||||||
|
|
||||||
ssi->cr_etc = 0;
|
ssi->cr_etc = 0;
|
||||||
|
|
||||||
rsnd_ssi_hw_stop(ssi, rdai);
|
rsnd_ssi_hw_stop(ssi, rdai);
|
||||||
|
|
Loading…
Reference in a new issue