aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMark Brown <[email protected]>2020-11-26 20:03:01 +0000
committerMark Brown <[email protected]>2020-11-26 20:03:01 +0000
commit6d9b4dbf82c74e9c178e1ce2cff505f17cced23e (patch)
treeb70cb6930a396eb76b67df7592f477d309ee21dc /include
parent0858fc17b6f73f868352ed5f6cd7b655a17ff856 (diff)
parent453d32c2f7f7375c223eaf3a0a32efbb71bbd3f3 (diff)
Merge series "ASoC: merge soc_compr_open() rollback and soc_compr_free()" from Kuninori Morimoto <[email protected]>:
Hi Mark soc_compr_open() does rollback when failed (A), but, it is almost same as soc_compr_free(). static int soc_compr_open(xxx) { ... if (ret < 0) goto xxx_err; ... return 0; ^ machine_err: | ... | out: (A) ... | pm_err: | ... v return ret; } This kind of duplicated code can be a hotbed of bugs, thus, this patch-set share soc_compr_free() and rollback. Kuninori Morimoto (5): ASoC: soc-compress: move soc_compr_free() next to soc_compr_open() ASoC: soc-dai: add mark for snd_soc_dai_compr_startup/shutdown() ASoC: soc-component: add mark for snd_soc_component_compr_open/free() ASoC: soc-component: add mark for snd_soc_link_compr_startup/shutdown() ASoC: soc-compress: add soc_compr_clean() and call it from soc_compr_open/free() include/sound/soc-component.h | 6 +- include/sound/soc-dai.h | 4 +- include/sound/soc-link.h | 3 +- include/sound/soc.h | 1 + sound/soc/soc-component.c | 17 +++-- sound/soc/soc-compress.c | 115 +++++++++++++++++----------------- sound/soc/soc-dai.c | 13 +++- sound/soc/soc-link.c | 11 +++- 8 files changed, 95 insertions(+), 75 deletions(-) -- 2.25.1
Diffstat (limited to 'include')
-rw-r--r--include/sound/soc-component.h6
-rw-r--r--include/sound/soc-dai.h4
-rw-r--r--include/sound/soc-link.h3
-rw-r--r--include/sound/soc.h1
4 files changed, 9 insertions, 5 deletions
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 984dd7353066..9140b5fa19a4 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -221,6 +221,7 @@ struct snd_soc_component {
struct snd_pcm_substream *mark_module;
struct snd_pcm_substream *mark_open;
struct snd_pcm_substream *mark_hw_params;
+ struct snd_compr_stream *mark_compr_open;
void *mark_pm;
#ifdef CONFIG_DEBUG_FS
@@ -444,10 +445,9 @@ int snd_soc_component_of_xlate_dai_id(struct snd_soc_component *component,
int snd_soc_component_of_xlate_dai_name(struct snd_soc_component *component,
struct of_phandle_args *args,
const char **dai_name);
-int snd_soc_component_compr_open(struct snd_compr_stream *cstream,
- struct snd_soc_component **last);
+int snd_soc_component_compr_open(struct snd_compr_stream *cstream);
void snd_soc_component_compr_free(struct snd_compr_stream *cstream,
- struct snd_soc_component *last);
+ int rollback);
int snd_soc_component_compr_trigger(struct snd_compr_stream *cstream, int cmd);
int snd_soc_component_compr_set_params(struct snd_compr_stream *cstream,
struct snd_compr_params *params);
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 4bf759f025d2..6f54401d3de9 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -196,7 +196,8 @@ int snd_soc_pcm_dai_bespoke_trigger(struct snd_pcm_substream *substream,
int snd_soc_dai_compr_startup(struct snd_soc_dai *dai,
struct snd_compr_stream *cstream);
void snd_soc_dai_compr_shutdown(struct snd_soc_dai *dai,
- struct snd_compr_stream *cstream);
+ struct snd_compr_stream *cstream,
+ int rollback);
int snd_soc_dai_compr_trigger(struct snd_soc_dai *dai,
struct snd_compr_stream *cstream, int cmd);
int snd_soc_dai_compr_set_params(struct snd_soc_dai *dai,
@@ -400,6 +401,7 @@ struct snd_soc_dai {
/* function mark */
struct snd_pcm_substream *mark_startup;
struct snd_pcm_substream *mark_hw_params;
+ struct snd_compr_stream *mark_compr_startup;
/* bit field */
unsigned int probed:1;
diff --git a/include/sound/soc-link.h b/include/sound/soc-link.h
index eff34fc7d3d3..4c68b06d6fe6 100644
--- a/include/sound/soc-link.h
+++ b/include/sound/soc-link.h
@@ -24,7 +24,8 @@ void snd_soc_link_hw_free(struct snd_pcm_substream *substream,
int snd_soc_link_trigger(struct snd_pcm_substream *substream, int cmd);
int snd_soc_link_compr_startup(struct snd_compr_stream *cstream);
-void snd_soc_link_compr_shutdown(struct snd_compr_stream *cstream);
+void snd_soc_link_compr_shutdown(struct snd_compr_stream *cstream,
+ int rollback);
int snd_soc_link_compr_set_params(struct snd_compr_stream *cstream);
#endif /* __SOC_LINK_H */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 4a9958b9b532..33c289f6097c 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1163,6 +1163,7 @@ struct snd_soc_pcm_runtime {
/* function mark */
struct snd_pcm_substream *mark_startup;
struct snd_pcm_substream *mark_hw_params;
+ struct snd_compr_stream *mark_compr_startup;
/* bit field */
unsigned int pop_wait:1;