Re: [RFC][PATCH] ASoC: soc-core: verify Sound Card normality

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Geert

> > Current ALSA SoC Sound Card basically consists of CPU/Codec/Platform
> > drivers. If system uses Kernel modules, we can disable these drivers
> > by using rmmod command. In such case, we can't disable
> > CPU/Codec/Platform driver without disabling Sound Card driver.
> >
> > But on the other hand, we can disable these drivers by using unbind
> > command. In such case, we can disable these drivers randomly.
> > In this case, we can create dirty Sound Card which is missing necessary
> > components.
> >
> > (1) If user disabled Sound Card first, but did nothing to other drivers,
> > user can't use Sound because Sound Card is no longer exists.
> > (2) If user disabled CPU/Codec/Platform driver randomly, but did nothing
> > to Sound Card, user still be able to use Sound Card, because dirty Sound
> > Card which is missing necessary components still exists.
> > In this case, Sound system will be crashed if user started sound
> > playback/capture. But we can't block such random unbind now.
> >
> > To avoid Sound Card crash in (2) case, what we can do now is, add dirty
> > flag on Sound Card, and avoid to open Sound Card.
> > This patch solved this issue.
> >
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>
> 
> > --- a/sound/soc/soc-core.c
> > +++ b/sound/soc/soc-core.c
> 
> > @@ -3236,6 +3244,8 @@ static void snd_soc_component_cleanup(struct snd_soc_component *component)
> >
> >  static void snd_soc_component_del_unlocked(struct snd_soc_component *component)
> >  {
> > +       if (component->card)
> > +               component->card->dirty = 1;
> 
> Currently this is the only assignment to .dirty.
> Can this be undone later, when the driver is bound again?

Does this "undone" mean "card->dirty = 0" ?

Card itself will be freed if Card was unbind.
Thus, card will be re-created if it was bind again.
.dirty will be automatically 0 cleared.

Best regards
---
Kuninori Morimoto
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux