summaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-05-20 11:59:09 +0200
committerTakashi Iwai <tiwai@suse.de>2010-05-20 11:59:09 +0200
commit7bd9db83087aecef8279c0b8b9dfef4db4a8fc3c (patch)
tree075f76a814023b24be73e78ffa1f7a70433ffb89 /sound/core
parentMerge branch 'topic/core-cleanup' into for-linus (diff)
parentALSA: provide a more useful get_unmapped_area handler for pcm (diff)
downloadlinux-7bd9db83087aecef8279c0b8b9dfef4db4a8fc3c.tar.xz
linux-7bd9db83087aecef8279c0b8b9dfef4db4a8fc3c.zip
Merge branch 'topic/nomm' into for-linus
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/pcm_native.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index b9517f38073c..4c3edc1532c9 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -3440,14 +3440,28 @@ out:
#endif /* CONFIG_SND_SUPPORT_OLD_API */
#ifndef CONFIG_MMU
-unsigned long dummy_get_unmapped_area(struct file *file, unsigned long addr,
- unsigned long len, unsigned long pgoff,
- unsigned long flags)
-{
- return 0;
+static unsigned long snd_pcm_get_unmapped_area(struct file *file,
+ unsigned long addr,
+ unsigned long len,
+ unsigned long pgoff,
+ unsigned long flags)
+{
+ struct snd_pcm_file *pcm_file = file->private_data;
+ struct snd_pcm_substream *substream = pcm_file->substream;
+ struct snd_pcm_runtime *runtime = substream->runtime;
+ unsigned long offset = pgoff << PAGE_SHIFT;
+
+ switch (offset) {
+ case SNDRV_PCM_MMAP_OFFSET_STATUS:
+ return (unsigned long)runtime->status;
+ case SNDRV_PCM_MMAP_OFFSET_CONTROL:
+ return (unsigned long)runtime->control;
+ default:
+ return (unsigned long)runtime->dma_area + offset;
+ }
}
#else
-# define dummy_get_unmapped_area NULL
+# define snd_pcm_get_unmapped_area NULL
#endif
/*
@@ -3467,7 +3481,7 @@ const struct file_operations snd_pcm_f_ops[2] = {
.compat_ioctl = snd_pcm_ioctl_compat,
.mmap = snd_pcm_mmap,
.fasync = snd_pcm_fasync,
- .get_unmapped_area = dummy_get_unmapped_area,
+ .get_unmapped_area = snd_pcm_get_unmapped_area,
},
{
.owner = THIS_MODULE,
@@ -3481,6 +3495,6 @@ const struct file_operations snd_pcm_f_ops[2] = {
.compat_ioctl = snd_pcm_ioctl_compat,
.mmap = snd_pcm_mmap,
.fasync = snd_pcm_fasync,
- .get_unmapped_area = dummy_get_unmapped_area,
+ .get_unmapped_area = snd_pcm_get_unmapped_area,
}
};