diff mbox series

[15/28] ASoC: soc-core: tidyup for card->deferred_resume_work

Message ID 87ftmf2ifk.wl-kuninori.morimoto.gx@renesas.com (mailing list archive)
State New, archived
Headers show
Series ASoC: cleanup patches for soc-core | expand

Commit Message

Kuninori Morimoto Aug. 6, 2019, 1:29 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

card->deferred_resume_work is used if CONFIG_PM_SLEEP was defined.
but
	1) It is defined even though CONFIG_PM_SLEEP was not defined
	2) randam ifdef code is difficlut to read.
This patch tidyup these issues.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc.h  |  5 +++--
 sound/soc/soc-core.c | 14 ++++++++++----
 2 files changed, 13 insertions(+), 6 deletions(-)

Comments

Pierre-Louis Bossart Aug. 6, 2019, 2:55 p.m. UTC | #1
On 8/5/19 8:29 PM, Kuninori Morimoto wrote:
> 
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> card->deferred_resume_work is used if CONFIG_PM_SLEEP was defined.
> but
> 	1) It is defined even though CONFIG_PM_SLEEP was not defined
> 	2) randam ifdef code is difficlut to read.

typos: random .. difficult

> This patch tidyup these issues.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>   include/sound/soc.h  |  5 +++--
>   sound/soc/soc-core.c | 14 ++++++++++----
>   2 files changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/include/sound/soc.h b/include/sound/soc.h
> index 6ac6481..85ad971 100644
> --- a/include/sound/soc.h
> +++ b/include/sound/soc.h
> @@ -1058,8 +1058,6 @@ struct snd_soc_card {
>   	int num_of_dapm_routes;
>   	bool fully_routed;
>   
> -	struct work_struct deferred_resume_work;
> -
>   	/* lists of probed devices belonging to this card */
>   	struct list_head component_dev_list;
>   	struct list_head list;
> @@ -1080,6 +1078,9 @@ struct snd_soc_card {
>   #ifdef CONFIG_DEBUG_FS
>   	struct dentry *debugfs_card_root;
>   #endif
> +#ifdef CONFIG_PM_SLEEP
> +	struct work_struct deferred_resume_work;
> +#endif
>   	u32 pop_time;
>   
>   	void *drvdata;
> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
> index e8ed57a..2536ba4 100644
> --- a/sound/soc/soc-core.c
> +++ b/sound/soc/soc-core.c
> @@ -701,9 +701,18 @@ int snd_soc_resume(struct device *dev)
>   	return 0;
>   }
>   EXPORT_SYMBOL_GPL(snd_soc_resume);
> +
> +static void soc_resume_init(struct snd_soc_card *card)
> +{
> +	/* deferred resume work */
> +	INIT_WORK(&card->deferred_resume_work, soc_resume_deferred);
> +}
>   #else
>   #define snd_soc_suspend NULL
>   #define snd_soc_resume NULL
> +static inline void soc_resume_init(struct snd_soc_card *card)
> +{
> +}
>   #endif
>   
>   static const struct snd_soc_dai_ops null_dai_ops = {
> @@ -1975,10 +1984,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
>   
>   	soc_init_card_debugfs(card);
>   
> -#ifdef CONFIG_PM_SLEEP
> -	/* deferred resume work */
> -	INIT_WORK(&card->deferred_resume_work, soc_resume_deferred);
> -#endif
> +	soc_resume_init(card);
>   
>   	snd_soc_dapm_new_controls(&card->dapm, card->dapm_widgets,
>   				  card->num_dapm_widgets);
>
diff mbox series

Patch

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 6ac6481..85ad971 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1058,8 +1058,6 @@  struct snd_soc_card {
 	int num_of_dapm_routes;
 	bool fully_routed;
 
-	struct work_struct deferred_resume_work;
-
 	/* lists of probed devices belonging to this card */
 	struct list_head component_dev_list;
 	struct list_head list;
@@ -1080,6 +1078,9 @@  struct snd_soc_card {
 #ifdef CONFIG_DEBUG_FS
 	struct dentry *debugfs_card_root;
 #endif
+#ifdef CONFIG_PM_SLEEP
+	struct work_struct deferred_resume_work;
+#endif
 	u32 pop_time;
 
 	void *drvdata;
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index e8ed57a..2536ba4 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -701,9 +701,18 @@  int snd_soc_resume(struct device *dev)
 	return 0;
 }
 EXPORT_SYMBOL_GPL(snd_soc_resume);
+
+static void soc_resume_init(struct snd_soc_card *card)
+{
+	/* deferred resume work */
+	INIT_WORK(&card->deferred_resume_work, soc_resume_deferred);
+}
 #else
 #define snd_soc_suspend NULL
 #define snd_soc_resume NULL
+static inline void soc_resume_init(struct snd_soc_card *card)
+{
+}
 #endif
 
 static const struct snd_soc_dai_ops null_dai_ops = {
@@ -1975,10 +1984,7 @@  static int snd_soc_instantiate_card(struct snd_soc_card *card)
 
 	soc_init_card_debugfs(card);
 
-#ifdef CONFIG_PM_SLEEP
-	/* deferred resume work */
-	INIT_WORK(&card->deferred_resume_work, soc_resume_deferred);
-#endif
+	soc_resume_init(card);
 
 	snd_soc_dapm_new_controls(&card->dapm, card->dapm_widgets,
 				  card->num_dapm_widgets);