Message ID | 87tv031ojg.wl-kuninori.morimoto.gx@renesas.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | ASoC: add soc-card | expand |
On Tue, 2020-05-26 at 10:18 +0900, Kuninori Morimoto wrote: > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> > > Card related function should be implemented at soc-card now. > This patch adds it. > > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> > --- > include/sound/soc-card.h | 4 ++++ > sound/soc/soc-card.c | 12 ++++++++++++ > sound/soc/soc-dapm.c | 4 ++-- > 3 files changed, 18 insertions(+), 2 deletions(-) > > diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h > index b338bbd08219..4bcdc1d382bf 100644 > --- a/include/sound/soc-card.h > +++ b/include/sound/soc-card.h > @@ -28,6 +28,10 @@ int snd_soc_card_probe(struct snd_soc_card *card); > int snd_soc_card_late_probe(struct snd_soc_card *card); > int snd_soc_card_remove(struct snd_soc_card *card); > > +int snd_soc_card_set_bias_level(struct snd_soc_card *card, > + struct snd_soc_dapm_context *dapm, > + enum snd_soc_bias_level level); > + > /* device driver data */ > static inline void snd_soc_card_set_drvdata(struct snd_soc_card > *card, > void *data) > diff --git a/sound/soc/soc-card.c b/sound/soc/soc-card.c > index 449f6cc86859..a9f25b6a4c67 100644 > --- a/sound/soc/soc-card.c > +++ b/sound/soc/soc-card.c > @@ -172,3 +172,15 @@ int snd_soc_card_remove(struct snd_soc_card > *card) > > return soc_card_ret(card, ret); > } > + > +int snd_soc_card_set_bias_level(struct snd_soc_card *card, > + struct snd_soc_dapm_context *dapm, > + enum snd_soc_bias_level level) > +{ > + int ret = 0; > + > + if (card->set_bias_level) > + ret = card->set_bias_level(card, dapm, level); > + > + return soc_card_ret(card, ret); > +} > diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c > index a4de3e4bc2ef..add39d24a583 100644 > --- a/sound/soc/soc-dapm.c > +++ b/sound/soc/soc-dapm.c > @@ -725,8 +725,8 @@ static int snd_soc_dapm_set_bias_level(struct > snd_soc_dapm_context *dapm, > > trace_snd_soc_bias_level_start(card, level); > > - if (card && card->set_bias_level) > - ret = card->set_bias_level(card, dapm, level); > + if (card) Morimoto-san, Why not move this check inside snd_soc_card_set_bias_level() and remove the first parameter from the function? Thanks, Ranjani
Hi Ranjani Thank you for review > > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> > > > > Card related function should be implemented at soc-card now. > > This patch adds it. > > > > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> > > --- (snip) > > +int snd_soc_card_set_bias_level(struct snd_soc_card *card, > > + struct snd_soc_dapm_context *dapm, > > + enum snd_soc_bias_level level) > > +{ > > + int ret = 0; > > + > > + if (card->set_bias_level) > > + ret = card->set_bias_level(card, dapm, level); > > + > > + return soc_card_ret(card, ret); > > +} > > diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c > > index a4de3e4bc2ef..add39d24a583 100644 > > --- a/sound/soc/soc-dapm.c > > +++ b/sound/soc/soc-dapm.c > > @@ -725,8 +725,8 @@ static int snd_soc_dapm_set_bias_level(struct > > snd_soc_dapm_context *dapm, > > > > trace_snd_soc_bias_level_start(card, level); > > > > - if (card && card->set_bias_level) > > - ret = card->set_bias_level(card, dapm, level); > > + if (card) > Morimoto-san, > > Why not move this check inside snd_soc_card_set_bias_level() and remove > the first parameter from the function? Oh, yes, indeed. We don't need "if (card)" check here. But what does this "remove the first parameter from the function" mean ? Do you mean "remove card" ? Anyway, I will fixup [16/19] and [17/19] patches in v2 Thank you for your help !! Best regards --- Kuninori Morimoto
diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h index b338bbd08219..4bcdc1d382bf 100644 --- a/include/sound/soc-card.h +++ b/include/sound/soc-card.h @@ -28,6 +28,10 @@ int snd_soc_card_probe(struct snd_soc_card *card); int snd_soc_card_late_probe(struct snd_soc_card *card); int snd_soc_card_remove(struct snd_soc_card *card); +int snd_soc_card_set_bias_level(struct snd_soc_card *card, + struct snd_soc_dapm_context *dapm, + enum snd_soc_bias_level level); + /* device driver data */ static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card, void *data) diff --git a/sound/soc/soc-card.c b/sound/soc/soc-card.c index 449f6cc86859..a9f25b6a4c67 100644 --- a/sound/soc/soc-card.c +++ b/sound/soc/soc-card.c @@ -172,3 +172,15 @@ int snd_soc_card_remove(struct snd_soc_card *card) return soc_card_ret(card, ret); } + +int snd_soc_card_set_bias_level(struct snd_soc_card *card, + struct snd_soc_dapm_context *dapm, + enum snd_soc_bias_level level) +{ + int ret = 0; + + if (card->set_bias_level) + ret = card->set_bias_level(card, dapm, level); + + return soc_card_ret(card, ret); +} diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index a4de3e4bc2ef..add39d24a583 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -725,8 +725,8 @@ static int snd_soc_dapm_set_bias_level(struct snd_soc_dapm_context *dapm, trace_snd_soc_bias_level_start(card, level); - if (card && card->set_bias_level) - ret = card->set_bias_level(card, dapm, level); + if (card) + ret = snd_soc_card_set_bias_level(card, dapm, level); if (ret != 0) goto out;