Skip to content

Commit 7f42eed

Browse files
committed
ASoC: soc-component: Convert the mark_module to void*
The mark_module of the snd_soc_component is strict snd_pcm_substream type which prevents it to be used by compressed streams. Change the type to void* along with the snd_soc_component_module_get() and snd_soc_component_module_put() to allow the same mark to be used by compressed when it's module_get_upon_open is set to 1. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
1 parent 83eb86f commit 7f42eed

2 files changed

Lines changed: 10 additions & 14 deletions

File tree

include/sound/soc-component.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ struct snd_soc_component {
220220
int (*init)(struct snd_soc_component *component);
221221

222222
/* function mark */
223-
struct snd_pcm_substream *mark_module;
223+
void *mark_module;
224224
struct snd_pcm_substream *mark_open;
225225
struct snd_pcm_substream *mark_hw_params;
226226
struct snd_pcm_substream *mark_trigger;
@@ -391,15 +391,13 @@ void snd_soc_component_exit_regmap(struct snd_soc_component *component);
391391
#define snd_soc_component_module_get_when_open(component, substream) \
392392
snd_soc_component_module_get(component, substream, 1)
393393
int snd_soc_component_module_get(struct snd_soc_component *component,
394-
struct snd_pcm_substream *substream,
395-
int upon_open);
394+
void *mark, int upon_open);
396395
#define snd_soc_component_module_put_when_remove(component) \
397396
snd_soc_component_module_put(component, NULL, 0, 0)
398397
#define snd_soc_component_module_put_when_close(component, substream, rollback) \
399398
snd_soc_component_module_put(component, substream, 1, rollback)
400399
void snd_soc_component_module_put(struct snd_soc_component *component,
401-
struct snd_pcm_substream *substream,
402-
int upon_open, int rollback);
400+
void *mark, int upon_open, int rollback);
403401

404402
static inline void snd_soc_component_set_drvdata(struct snd_soc_component *c,
405403
void *data)

sound/soc/soc-component.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -251,34 +251,32 @@ int snd_soc_component_set_jack(struct snd_soc_component *component,
251251
EXPORT_SYMBOL_GPL(snd_soc_component_set_jack);
252252

253253
int snd_soc_component_module_get(struct snd_soc_component *component,
254-
struct snd_pcm_substream *substream,
255-
int upon_open)
254+
void *mark, int upon_open)
256255
{
257256
int ret = 0;
258257

259258
if (component->driver->module_get_upon_open == !!upon_open &&
260259
!try_module_get(component->dev->driver->owner))
261260
ret = -ENODEV;
262261

263-
/* mark substream if succeeded */
262+
/* mark module if succeeded */
264263
if (ret == 0)
265-
soc_component_mark_push(component, substream, module);
264+
soc_component_mark_push(component, mark, module);
266265

267266
return soc_component_ret(component, ret);
268267
}
269268

270269
void snd_soc_component_module_put(struct snd_soc_component *component,
271-
struct snd_pcm_substream *substream,
272-
int upon_open, int rollback)
270+
void *mark, int upon_open, int rollback)
273271
{
274-
if (rollback && !soc_component_mark_match(component, substream, module))
272+
if (rollback && !soc_component_mark_match(component, mark, module))
275273
return;
276274

277275
if (component->driver->module_get_upon_open == !!upon_open)
278276
module_put(component->dev->driver->owner);
279277

280-
/* remove marked substream */
281-
soc_component_mark_pop(component, substream, module);
278+
/* remove the mark from module */
279+
soc_component_mark_pop(component, mark, module);
282280
}
283281

284282
int snd_soc_component_open(struct snd_soc_component *component,

0 commit comments

Comments
 (0)