Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 38ca2a4d authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Takashi Iwai
Browse files

ALSA: core: pass audio tstamp config from userspace



Let userspace select audio timestamp config when the
STATUS_EXT ioctl is used, ignore and zero all
other fields
No change for the existing STATUS ioctl, parameters
are treated as read-only.

Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 229d0430
Loading
Loading
Loading
Loading
+14 −3
Original line number Original line Diff line number Diff line
@@ -753,12 +753,21 @@ int snd_pcm_status(struct snd_pcm_substream *substream,
}
}


static int snd_pcm_status_user(struct snd_pcm_substream *substream,
static int snd_pcm_status_user(struct snd_pcm_substream *substream,
			       struct snd_pcm_status __user * _status)
			       struct snd_pcm_status __user * _status,
			       bool ext)
{
{
	struct snd_pcm_status status;
	struct snd_pcm_status status;
	int res;
	int res;


	memset(&status, 0, sizeof(status));
	memset(&status, 0, sizeof(status));
	/*
	 * with extension, parameters are read/write,
	 * get audio_tstamp_data from user,
	 * ignore rest of status structure
	 */
	if (ext && get_user(status.audio_tstamp_data,
				(u32 __user *)(&_status->audio_tstamp_data)))
		return -EFAULT;
	res = snd_pcm_status(substream, &status);
	res = snd_pcm_status(substream, &status);
	if (res < 0)
	if (res < 0)
		return res;
		return res;
@@ -2723,7 +2732,9 @@ static int snd_pcm_common_ioctl1(struct file *file,
	case SNDRV_PCM_IOCTL_SW_PARAMS:
	case SNDRV_PCM_IOCTL_SW_PARAMS:
		return snd_pcm_sw_params_user(substream, arg);
		return snd_pcm_sw_params_user(substream, arg);
	case SNDRV_PCM_IOCTL_STATUS:
	case SNDRV_PCM_IOCTL_STATUS:
		return snd_pcm_status_user(substream, arg);
		return snd_pcm_status_user(substream, arg, false);
	case SNDRV_PCM_IOCTL_STATUS_EXT:
		return snd_pcm_status_user(substream, arg, true);
	case SNDRV_PCM_IOCTL_CHANNEL_INFO:
	case SNDRV_PCM_IOCTL_CHANNEL_INFO:
		return snd_pcm_channel_info_user(substream, arg);
		return snd_pcm_channel_info_user(substream, arg);
	case SNDRV_PCM_IOCTL_PREPARE:
	case SNDRV_PCM_IOCTL_PREPARE: