Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 182680
b: refs/heads/master
c: 149feef
h: refs/heads/master
v: v3
  • Loading branch information
Clemens Ladisch authored and Takashi Iwai committed Dec 18, 2009
1 parent b0af0c0 commit d9976c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 55 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6cedf8696d6a01bba391bdae06231243cfe2f48a
refs/heads/master: 149feef54bf543448dd4ec5820ef8ae178021c3a
59 changes: 5 additions & 54 deletions trunk/sound/drivers/vx/vx_pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
*/

#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/delay.h>
#include <sound/core.h>
#include <sound/asoundef.h>
Expand All @@ -55,55 +54,6 @@
#include "vx_cmd.h"


/*
* we use a vmalloc'ed (sg-)buffer
*/

/* get the physical page pointer on the given offset */
static struct page *snd_pcm_get_vmalloc_page(struct snd_pcm_substream *subs,
unsigned long offset)
{
void *pageptr = subs->runtime->dma_area + offset;
return vmalloc_to_page(pageptr);
}

/*
* allocate a buffer via vmalloc_32().
* called from hw_params
* NOTE: this may be called not only once per pcm open!
*/
static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, size_t size)
{
struct snd_pcm_runtime *runtime = subs->runtime;
if (runtime->dma_area) {
/* already allocated */
if (runtime->dma_bytes >= size)
return 0; /* already enough large */
vfree(runtime->dma_area);
}
runtime->dma_area = vmalloc_32(size);
if (! runtime->dma_area)
return -ENOMEM;
memset(runtime->dma_area, 0, size);
runtime->dma_bytes = size;
return 1; /* changed */
}

/*
* free the buffer.
* called from hw_free callback
* NOTE: this may be called not only once per pcm open!
*/
static int snd_pcm_free_vmalloc_buffer(struct snd_pcm_substream *subs)
{
struct snd_pcm_runtime *runtime = subs->runtime;

vfree(runtime->dma_area);
runtime->dma_area = NULL;
return 0;
}


/*
* read three pending pcm bytes via inb()
*/
Expand Down Expand Up @@ -865,15 +815,16 @@ static snd_pcm_uframes_t vx_pcm_playback_pointer(struct snd_pcm_substream *subs)
static int vx_pcm_hw_params(struct snd_pcm_substream *subs,
struct snd_pcm_hw_params *hw_params)
{
return snd_pcm_alloc_vmalloc_buffer(subs, params_buffer_bytes(hw_params));
return snd_pcm_lib_alloc_vmalloc_32_buffer
(subs, params_buffer_bytes(hw_params));
}

/*
* vx_pcm_hw_free - hw_free callback for playback and capture
*/
static int vx_pcm_hw_free(struct snd_pcm_substream *subs)
{
return snd_pcm_free_vmalloc_buffer(subs);
return snd_pcm_lib_free_vmalloc_buffer(subs);
}

/*
Expand Down Expand Up @@ -953,7 +904,7 @@ static struct snd_pcm_ops vx_pcm_playback_ops = {
.prepare = vx_pcm_prepare,
.trigger = vx_pcm_trigger,
.pointer = vx_pcm_playback_pointer,
.page = snd_pcm_get_vmalloc_page,
.page = snd_pcm_lib_get_vmalloc_page,
};


Expand Down Expand Up @@ -1173,7 +1124,7 @@ static struct snd_pcm_ops vx_pcm_capture_ops = {
.prepare = vx_pcm_prepare,
.trigger = vx_pcm_trigger,
.pointer = vx_pcm_capture_pointer,
.page = snd_pcm_get_vmalloc_page,
.page = snd_pcm_lib_get_vmalloc_page,
};


Expand Down

0 comments on commit d9976c7

Please sign in to comment.