[RFC PATCH 2/3] alsa: Allow "fallback" configuration for mappings and profiles

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

 



On Tue, 2014-07-29 at 11:57 +0300, Tanu Kaskinen wrote:
> On Fri, 2014-07-25 at 15:31 +0200, David Henningsson wrote:
> > @@ -4337,6 +4370,8 @@ void pa_alsa_profile_set_probe(
> >          unsigned default_fragment_size_msec) {
> >  
> >      void *state;
> > +    bool tryfallback = false;
> > +    int profilesfound = 0;
> >      pa_alsa_profile *p, *last = NULL;
> >      pa_alsa_mapping *m;
> >      pa_hashmap *broken_inputs, *broken_outputs, *used_paths;
> > @@ -4352,9 +4387,13 @@ void pa_alsa_profile_set_probe(
> >      broken_outputs = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
> >      used_paths = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
> >  
> > +again:
> 
> Alexander already complained about the goto, and you said that you
> probably will anyway need to improve this code. You didn't say how you
> plan to improve it, so here's my suggestion:
> 
> When you encounter a fallback profile, add it to a temporary dynarray.
> Then after the first loop is finished, and no supported profiles have
> been found, loop over the dynarray that has the fallback profiles. That
> way the goto is avoided, and probing non-fallback profiles twice is
> avoided too.

Sorry, I realized that your patch already avoids probing non-fallback
profiles twice, so that was a moot point.

-- 
Tanu



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux