Skip to content

Commit 5cbbadd

Browse files
morimotobroonie
authored andcommitted
ASoC: rsnd: add rsnd_io_to_mod()
Sometimes we would like to get each module directly, especially data path searching. this patch adds rsnd_io_to_mod() macro, and existing rsnd_io_to_mod_xxx() use it. Signed-off-by: Kuninori Morimoto <[email protected]> Tested-by: Keita Kobayashi <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent ddea1b2 commit 5cbbadd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sound/soc/sh/rcar/rsnd.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,10 @@ struct rsnd_dai_stream {
348348
int byte_per_period;
349349
int next_period_byte;
350350
};
351-
#define rsnd_io_to_mod_ssi(io) ((io)->mod[RSND_MOD_SSI])
352-
#define rsnd_io_to_mod_src(io) ((io)->mod[RSND_MOD_SRC])
353-
#define rsnd_io_to_mod_dvc(io) ((io)->mod[RSND_MOD_DVC])
351+
#define rsnd_io_to_mod(io, i) ((i) < RSND_MOD_MAX ? (io)->mod[(i)] : NULL)
352+
#define rsnd_io_to_mod_ssi(io) rsnd_io_to_mod((io), RSND_MOD_SSI)
353+
#define rsnd_io_to_mod_src(io) rsnd_io_to_mod((io), RSND_MOD_SRC)
354+
#define rsnd_io_to_mod_dvc(io) rsnd_io_to_mod((io), RSND_MOD_DVC)
354355
#define rsnd_io_to_rdai(io) ((io)->rdai)
355356
#define rsnd_io_to_priv(io) (rsnd_rdai_to_priv(rsnd_io_to_rdai(io)))
356357
#define rsnd_io_is_play(io) (&rsnd_io_to_rdai(io)->playback == io)

0 commit comments

Comments
 (0)