mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	ctl: ext: Fail with error code if snd_ctl_ext_callback::read_event() callback is not defined
The snd_ctl_ext_callback::read_event() callback is only optional if no poll descriptor was given via snd_ctl_ext_t::poll_fd or snd_ctl_ext_callback::snd_ctl_ext_poll_descriptors(). If a poll descriptor is given the snd_ctl_ext_callback::read_event() callback has also to be defined because there is no minigful default behavior. This callback will be called when ever the poll() on the file descriptor indicates that there is an event pending. Therefore returning a 0 which indicates that there is no event makes no sense. Signed-off-by: Timo Wischer <twischer@de.adit-jv.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
		
							parent
							
								
									8c0b17bca3
								
							
						
					
					
						commit
						98d2c12ac2
					
				
					 1 changed files with 6 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -415,8 +415,12 @@ static int snd_ctl_ext_read(snd_ctl_t *handle, snd_ctl_event_t *event)
 | 
			
		|||
{
 | 
			
		||||
	snd_ctl_ext_t *ext = handle->private_data;
 | 
			
		||||
 | 
			
		||||
	memset(event, 0, sizeof(*event));
 | 
			
		||||
	return ext->callback->read_event(ext, &event->data.elem.id, &event->data.elem.mask);
 | 
			
		||||
	if (ext->callback->read_event) {
 | 
			
		||||
		memset(event, 0, sizeof(*event));
 | 
			
		||||
		return ext->callback->read_event(ext, &event->data.elem.id, &event->data.elem.mask);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return -EINVAL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int snd_ctl_ext_poll_descriptors_count(snd_ctl_t *handle)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue