diff options
author | Takashi Iwai <tiwai@suse.de> | 2017-05-10 14:33:44 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2017-05-23 07:04:05 +0200 |
commit | c2c86a97175f552fd32b339426a489c7af818123 (patch) | |
tree | a2ac275244082ad47d1c811d85e3e2a24c97fbdc /sound/core/pcm_compat.c | |
parent | 53e7bf452584e73df8a529a2b157a1225a52637f (diff) |
ALSA: pcm: Remove set_fs() in PCM core code
PCM core code has a few usages of set_fs(), mostly for two codepaths:
- The DELAY ioctl call from pcm_compat.c
- The ioctl wrapper in kernel context for PCM OSS and other
This patch removes the set_fs() usage in these places by a slight code
refactoring. For the former point, snd_pcm_delay() is changed to
return the value directly instead of putting the value to the given
address. Each caller stores the result in an appropriate manner.
For fixing the latter, snd_pcm_lib_kernel_ioctl() is changed to call
the functions directly as well. For achieving it, now the function
accepts only the limited set of ioctls that have been used, so far.
The primary user of this function is the PCM OSS layer, and the only
other user is USB UAC1 gadget driver. Both drivers don't need the
full set of ioctls.
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/pcm_compat.c')
-rw-r--r-- | sound/core/pcm_compat.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c index 1f64ab0c2a95..8a0f8d51e95d 100644 --- a/sound/core/pcm_compat.c +++ b/sound/core/pcm_compat.c @@ -27,17 +27,13 @@ static int snd_pcm_ioctl_delay_compat(struct snd_pcm_substream *substream, s32 __user *src) { snd_pcm_sframes_t delay; - mm_segment_t fs; - int err; - fs = snd_enter_user(); - err = snd_pcm_delay(substream, &delay); - snd_leave_user(fs); - if (err < 0) - return err; + delay = snd_pcm_delay(substream); + if (delay < 0) + return delay; if (put_user(delay, src)) return -EFAULT; - return err; + return 0; } static int snd_pcm_ioctl_rewind_compat(struct snd_pcm_substream *substream, |