aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>2015-02-13 16:14:04 -0500
committerTakashi Iwai <tiwai@suse.de>2015-02-20 11:30:04 -0500
commit38ca2a4d58bbc45973ee5cd14e4b803ee5ad69f0 (patch)
tree09aa854fc6f9ad5f6388502576d14442ee48c089 /sound/core
parent229d043096ea8e58829d37d35767afeac15997f5 (diff)
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: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/pcm_native.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index b03a638b420c..72323a8c35c8 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -753,12 +753,21 @@ int snd_pcm_status(struct snd_pcm_substream *substream,
753} 753}
754 754
755static int snd_pcm_status_user(struct snd_pcm_substream *substream, 755static int snd_pcm_status_user(struct snd_pcm_substream *substream,
756 struct snd_pcm_status __user * _status) 756 struct snd_pcm_status __user * _status,
757 bool ext)
757{ 758{
758 struct snd_pcm_status status; 759 struct snd_pcm_status status;
759 int res; 760 int res;
760 761
761 memset(&status, 0, sizeof(status)); 762 memset(&status, 0, sizeof(status));
763 /*
764 * with extension, parameters are read/write,
765 * get audio_tstamp_data from user,
766 * ignore rest of status structure
767 */
768 if (ext && get_user(status.audio_tstamp_data,
769 (u32 __user *)(&_status->audio_tstamp_data)))
770 return -EFAULT;
762 res = snd_pcm_status(substream, &status); 771 res = snd_pcm_status(substream, &status);
763 if (res < 0) 772 if (res < 0)
764 return res; 773 return res;
@@ -2723,7 +2732,9 @@ static int snd_pcm_common_ioctl1(struct file *file,
2723 case SNDRV_PCM_IOCTL_SW_PARAMS: 2732 case SNDRV_PCM_IOCTL_SW_PARAMS:
2724 return snd_pcm_sw_params_user(substream, arg); 2733 return snd_pcm_sw_params_user(substream, arg);
2725 case SNDRV_PCM_IOCTL_STATUS: 2734 case SNDRV_PCM_IOCTL_STATUS:
2726 return snd_pcm_status_user(substream, arg); 2735 return snd_pcm_status_user(substream, arg, false);
2736 case SNDRV_PCM_IOCTL_STATUS_EXT:
2737 return snd_pcm_status_user(substream, arg, true);
2727 case SNDRV_PCM_IOCTL_CHANNEL_INFO: 2738 case SNDRV_PCM_IOCTL_CHANNEL_INFO:
2728 return snd_pcm_channel_info_user(substream, arg); 2739 return snd_pcm_channel_info_user(substream, arg);
2729 case SNDRV_PCM_IOCTL_PREPARE: 2740 case SNDRV_PCM_IOCTL_PREPARE: