ASoC: soc-dapm.h: Convert macros to return a compound literal
authorHerve Codina <herve.codina@bootlin.com>
Fri, 23 Jun 2023 08:58:28 +0000 (10:58 +0200)
committerMark Brown <broonie@kernel.org>
Sun, 9 Jul 2023 21:48:18 +0000 (22:48 +0100)
commit12e58fec5b2aff3ae6fef4e6c278f295a666b9b6
tree87ec3e502f60a27646d9e59c92fcd97c7090f00c
parent7560418078b939e1e83f7dce502ec3c1ca8c152f
ASoC: soc-dapm.h: Convert macros to return a compound literal

The SND_SOC_DAPM_* helpers family are used to build widgets array in a
static way.

Convert them to return a compound literal in order to use them in both
static and dynamic way.
With this conversion, the different SND_SOC_DAPM_* parameters can be
computed by the code and the widget can be built based on this parameter
computation.
  static int create_widget(char *input_name)
  {
          struct snd_soc_dapm_widget widget;
          char name*;
          ...
          name = input_name;
          if (!name)
                  name = "default";

          widget = SND_SOC_DAPM_INPUT(name);
          ...
  }

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Link: https://lore.kernel.org/r/20230623085830.749991-12-herve.codina@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc-dapm.h