|
@@ -2692,7 +2692,8 @@ static int snd_pcm_hwsync(struct snd_pcm_substream *substream)
|
|
|
return err;
|
|
|
}
|
|
|
|
|
|
-static snd_pcm_sframes_t snd_pcm_delay(struct snd_pcm_substream *substream)
|
|
|
+static int snd_pcm_delay(struct snd_pcm_substream *substream,
|
|
|
+ snd_pcm_sframes_t *delay)
|
|
|
{
|
|
|
struct snd_pcm_runtime *runtime = substream->runtime;
|
|
|
int err;
|
|
@@ -2708,7 +2709,9 @@ static snd_pcm_sframes_t snd_pcm_delay(struct snd_pcm_substream *substream)
|
|
|
n += runtime->delay;
|
|
|
}
|
|
|
snd_pcm_stream_unlock_irq(substream);
|
|
|
- return err < 0 ? err : n;
|
|
|
+ if (!err)
|
|
|
+ *delay = n;
|
|
|
+ return err;
|
|
|
}
|
|
|
|
|
|
static int snd_pcm_sync_ptr(struct snd_pcm_substream *substream,
|
|
@@ -2916,11 +2919,13 @@ static int snd_pcm_common_ioctl(struct file *file,
|
|
|
return snd_pcm_hwsync(substream);
|
|
|
case SNDRV_PCM_IOCTL_DELAY:
|
|
|
{
|
|
|
- snd_pcm_sframes_t delay = snd_pcm_delay(substream);
|
|
|
+ snd_pcm_sframes_t delay;
|
|
|
snd_pcm_sframes_t __user *res = arg;
|
|
|
+ int err;
|
|
|
|
|
|
- if (delay < 0)
|
|
|
- return delay;
|
|
|
+ err = snd_pcm_delay(substream, &delay);
|
|
|
+ if (err)
|
|
|
+ return err;
|
|
|
if (put_user(delay, res))
|
|
|
return -EFAULT;
|
|
|
return 0;
|
|
@@ -3008,13 +3013,7 @@ int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream,
|
|
|
case SNDRV_PCM_IOCTL_DROP:
|
|
|
return snd_pcm_drop(substream);
|
|
|
case SNDRV_PCM_IOCTL_DELAY:
|
|
|
- {
|
|
|
- result = snd_pcm_delay(substream);
|
|
|
- if (result < 0)
|
|
|
- return result;
|
|
|
- *frames = result;
|
|
|
- return 0;
|
|
|
- }
|
|
|
+ return snd_pcm_delay(substream, frames);
|
|
|
default:
|
|
|
return -EINVAL;
|
|
|
}
|