diff mbox

[alsa-lib] pcm: hw: minor refactoring for initialization of control data

Message ID 20170630110026.6721-1-o-takashi@sakamocchi.jp (mailing list archive)
State New, archived
Headers show

Commit Message

Takashi Sakamoto June 30, 2017, 11 a.m. UTC
At failure of control data mapping, alsa-lib goes to fallback mode. In
this mode, a buffer is kept in user space and executes ioctl(2) with
SNDRV_PCM_IOCTL_SYNC_PTR for the buffer to synchronize the control data.

In current implementation, no helper function is used for initialize
the control data. This commit use an proper helper function instead of
a direct call of ioctl(2).

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 src/pcm/pcm_hw.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Takashi Iwai June 30, 2017, 2:35 p.m. UTC | #1
On Fri, 30 Jun 2017 13:00:26 +0200,
Takashi Sakamoto wrote:
> 
> At failure of control data mapping, alsa-lib goes to fallback mode. In
> this mode, a buffer is kept in user space and executes ioctl(2) with
> SNDRV_PCM_IOCTL_SYNC_PTR for the buffer to synchronize the control data.
> 
> In current implementation, no helper function is used for initialize
> the control data. This commit use an proper helper function instead of
> a direct call of ioctl(2).
> 
> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

Applied, thanks.


Takashi


> ---
>  src/pcm/pcm_hw.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c
> index e0931577..f03bc589 100644
> --- a/src/pcm/pcm_hw.c
> +++ b/src/pcm/pcm_hw.c
> @@ -957,11 +957,9 @@ static int map_status_and_control_data(snd_pcm_t *pcm, bool force_fallback)
>  	snd_pcm_set_appl_ptr(pcm, &hw->mmap_control->appl_ptr, hw->fd,
>  			     SNDRV_PCM_MMAP_OFFSET_CONTROL);
>  	if (hw->mmap_control_fallbacked) {
> -		if (ioctl(hw->fd, SNDRV_PCM_IOCTL_SYNC_PTR, hw->sync_ptr) < 0) {
> -			err = -errno;
> -			SYSMSG("SNDRV_PCM_IOCTL_SYNC_PTR failed (%i)", err);
> +		err = sync_ptr1(hw, 0);
> +		if (err < 0)
>  			return err;
> -		}
>  	}
>  
>  	return 0;
> -- 
> 2.11.0
>
diff mbox

Patch

diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c
index e0931577..f03bc589 100644
--- a/src/pcm/pcm_hw.c
+++ b/src/pcm/pcm_hw.c
@@ -957,11 +957,9 @@  static int map_status_and_control_data(snd_pcm_t *pcm, bool force_fallback)
 	snd_pcm_set_appl_ptr(pcm, &hw->mmap_control->appl_ptr, hw->fd,
 			     SNDRV_PCM_MMAP_OFFSET_CONTROL);
 	if (hw->mmap_control_fallbacked) {
-		if (ioctl(hw->fd, SNDRV_PCM_IOCTL_SYNC_PTR, hw->sync_ptr) < 0) {
-			err = -errno;
-			SYSMSG("SNDRV_PCM_IOCTL_SYNC_PTR failed (%i)", err);
+		err = sync_ptr1(hw, 0);
+		if (err < 0)
 			return err;
-		}
 	}
 
 	return 0;