mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	ucm: execute SectionDefaults lately (when the first verb is set)
We need a way to set the SectionOnce at first before SectionDefaults. It also does not make sense to run SectionDefaults when the API is used only to query for values or so. Execute the SectionDefaults commands only when the first verb is set (before the verb specific commands). Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
		
							parent
							
								
									e0da1d2a2a
								
							
						
					
					
						commit
						afb5a9cf61
					
				
					 2 changed files with 13 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -542,14 +542,7 @@ static int import_master_config(snd_use_case_mgr_t *uc_mgr)
 | 
			
		|||
	err = uc_mgr_import_master_config(uc_mgr);
 | 
			
		||||
	if (err < 0)
 | 
			
		||||
		return err;
 | 
			
		||||
	err = add_auto_values(uc_mgr);
 | 
			
		||||
	if (err < 0)
 | 
			
		||||
		return err;
 | 
			
		||||
	err = execute_sequence(uc_mgr, &uc_mgr->default_list,
 | 
			
		||||
			       &uc_mgr->value_list, NULL, NULL);
 | 
			
		||||
	if (err < 0)
 | 
			
		||||
		uc_error("Unable to execute default sequence");
 | 
			
		||||
	return err;
 | 
			
		||||
	return add_auto_values(uc_mgr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
| 
						 | 
				
			
			@ -845,6 +838,15 @@ static int set_verb(snd_use_case_mgr_t *uc_mgr,
 | 
			
		|||
	int err;
 | 
			
		||||
 | 
			
		||||
	if (enable) {
 | 
			
		||||
		if (!uc_mgr->default_list_executed) {
 | 
			
		||||
			err = execute_sequence(uc_mgr, &uc_mgr->default_list,
 | 
			
		||||
						&uc_mgr->value_list, NULL, NULL);
 | 
			
		||||
			if (err < 0) {
 | 
			
		||||
				uc_error("Unable to execute default sequence");
 | 
			
		||||
				return err;
 | 
			
		||||
			}
 | 
			
		||||
			uc_mgr->default_list_executed = 1;
 | 
			
		||||
		}
 | 
			
		||||
		seq = &verb->enable_list;
 | 
			
		||||
	} else {
 | 
			
		||||
		seq = &verb->disable_list;
 | 
			
		||||
| 
						 | 
				
			
			@ -985,6 +987,8 @@ int snd_use_case_mgr_reload(snd_use_case_mgr_t *uc_mgr)
 | 
			
		|||
 | 
			
		||||
	uc_mgr_free_verb(uc_mgr);
 | 
			
		||||
 | 
			
		||||
	uc_mgr->default_list_executed = 0;
 | 
			
		||||
 | 
			
		||||
	/* reload all use cases */
 | 
			
		||||
	err = import_master_config(uc_mgr);
 | 
			
		||||
	if (err < 0) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -226,6 +226,7 @@ struct snd_use_case_mgr {
 | 
			
		|||
 | 
			
		||||
	/* default settings - sequence */
 | 
			
		||||
	struct list_head default_list;
 | 
			
		||||
	int default_list_executed;
 | 
			
		||||
 | 
			
		||||
	/* default settings - value list */
 | 
			
		||||
	struct list_head value_list;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue