[ALSA] Remove xxx_t typedefs: PCI Trident
Modules: Trident driver Remove xxx_t typedefs from the PCI Trident driver. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:

committed by
Jaroslav Kysela

parent
abfd67bd6f
commit
bee1a5be8b
@@ -68,13 +68,14 @@
|
||||
#define page_to_addr(trident,page) __tlb_to_addr(trident, (page) << 1)
|
||||
|
||||
/* fill TLB entries -- we need to fill two entries */
|
||||
static inline void set_tlb_bus(trident_t *trident, int page, unsigned long ptr, dma_addr_t addr)
|
||||
static inline void set_tlb_bus(struct snd_trident *trident, int page,
|
||||
unsigned long ptr, dma_addr_t addr)
|
||||
{
|
||||
page <<= 1;
|
||||
__set_tlb_bus(trident, page, ptr, addr);
|
||||
__set_tlb_bus(trident, page+1, ptr + SNDRV_TRIDENT_PAGE_SIZE, addr + SNDRV_TRIDENT_PAGE_SIZE);
|
||||
}
|
||||
static inline void set_silent_tlb(trident_t *trident, int page)
|
||||
static inline void set_silent_tlb(struct snd_trident *trident, int page)
|
||||
{
|
||||
page <<= 1;
|
||||
__set_tlb_bus(trident, page, (unsigned long)trident->tlb.silent_page.area, trident->tlb.silent_page.addr);
|
||||
@@ -97,7 +98,8 @@ static inline void set_silent_tlb(trident_t *trident, int page)
|
||||
#define page_to_addr(trident,page) __tlb_to_addr(trident, (page) * UNIT_PAGES)
|
||||
|
||||
/* fill TLB entries -- UNIT_PAGES entries must be filled */
|
||||
static inline void set_tlb_bus(trident_t *trident, int page, unsigned long ptr, dma_addr_t addr)
|
||||
static inline void set_tlb_bus(struct snd_trident *trident, int page,
|
||||
unsigned long ptr, dma_addr_t addr)
|
||||
{
|
||||
int i;
|
||||
page *= UNIT_PAGES;
|
||||
@@ -107,7 +109,7 @@ static inline void set_tlb_bus(trident_t *trident, int page, unsigned long ptr,
|
||||
addr += SNDRV_TRIDENT_PAGE_SIZE;
|
||||
}
|
||||
}
|
||||
static inline void set_silent_tlb(trident_t *trident, int page)
|
||||
static inline void set_silent_tlb(struct snd_trident *trident, int page)
|
||||
{
|
||||
int i;
|
||||
page *= UNIT_PAGES;
|
||||
@@ -118,7 +120,7 @@ static inline void set_silent_tlb(trident_t *trident, int page)
|
||||
#endif /* PAGE_SIZE */
|
||||
|
||||
/* calculate buffer pointer from offset address */
|
||||
static inline void *offset_ptr(trident_t *trident, int offset)
|
||||
static inline void *offset_ptr(struct snd_trident *trident, int offset)
|
||||
{
|
||||
char *ptr;
|
||||
ptr = page_to_ptr(trident, get_aligned_page(offset));
|
||||
@@ -127,16 +129,16 @@ static inline void *offset_ptr(trident_t *trident, int offset)
|
||||
}
|
||||
|
||||
/* first and last (aligned) pages of memory block */
|
||||
#define firstpg(blk) (((snd_trident_memblk_arg_t*)snd_util_memblk_argptr(blk))->first_page)
|
||||
#define lastpg(blk) (((snd_trident_memblk_arg_t*)snd_util_memblk_argptr(blk))->last_page)
|
||||
#define firstpg(blk) (((struct snd_trident_memblk_arg *)snd_util_memblk_argptr(blk))->first_page)
|
||||
#define lastpg(blk) (((struct snd_trident_memblk_arg *)snd_util_memblk_argptr(blk))->last_page)
|
||||
|
||||
/*
|
||||
* search empty pages which may contain given size
|
||||
*/
|
||||
static snd_util_memblk_t *
|
||||
search_empty(snd_util_memhdr_t *hdr, int size)
|
||||
static struct snd_util_memblk *
|
||||
search_empty(struct snd_util_memhdr *hdr, int size)
|
||||
{
|
||||
snd_util_memblk_t *blk, *prev;
|
||||
struct snd_util_memblk *blk, *prev;
|
||||
int page, psize;
|
||||
struct list_head *p;
|
||||
|
||||
@@ -144,7 +146,7 @@ search_empty(snd_util_memhdr_t *hdr, int size)
|
||||
prev = NULL;
|
||||
page = 0;
|
||||
list_for_each(p, &hdr->block) {
|
||||
blk = list_entry(p, snd_util_memblk_t, list);
|
||||
blk = list_entry(p, struct snd_util_memblk, list);
|
||||
if (page + psize <= firstpg(blk))
|
||||
goto __found_pages;
|
||||
page = lastpg(blk) + 1;
|
||||
@@ -183,12 +185,13 @@ static int is_valid_page(unsigned long ptr)
|
||||
/*
|
||||
* page allocation for DMA (Scatter-Gather version)
|
||||
*/
|
||||
static snd_util_memblk_t *
|
||||
snd_trident_alloc_sg_pages(trident_t *trident, snd_pcm_substream_t *substream)
|
||||
static struct snd_util_memblk *
|
||||
snd_trident_alloc_sg_pages(struct snd_trident *trident,
|
||||
struct snd_pcm_substream *substream)
|
||||
{
|
||||
snd_util_memhdr_t *hdr;
|
||||
snd_util_memblk_t *blk;
|
||||
snd_pcm_runtime_t *runtime = substream->runtime;
|
||||
struct snd_util_memhdr *hdr;
|
||||
struct snd_util_memblk *blk;
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
int idx, page;
|
||||
struct snd_sg_buf *sgbuf = snd_pcm_substream_sgbuf(substream);
|
||||
|
||||
@@ -230,13 +233,14 @@ snd_trident_alloc_sg_pages(trident_t *trident, snd_pcm_substream_t *substream)
|
||||
/*
|
||||
* page allocation for DMA (contiguous version)
|
||||
*/
|
||||
static snd_util_memblk_t *
|
||||
snd_trident_alloc_cont_pages(trident_t *trident, snd_pcm_substream_t *substream)
|
||||
static struct snd_util_memblk *
|
||||
snd_trident_alloc_cont_pages(struct snd_trident *trident,
|
||||
struct snd_pcm_substream *substream)
|
||||
{
|
||||
snd_util_memhdr_t *hdr;
|
||||
snd_util_memblk_t *blk;
|
||||
struct snd_util_memhdr *hdr;
|
||||
struct snd_util_memblk *blk;
|
||||
int page;
|
||||
snd_pcm_runtime_t *runtime = substream->runtime;
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
dma_addr_t addr;
|
||||
unsigned long ptr;
|
||||
|
||||
@@ -270,8 +274,9 @@ snd_trident_alloc_cont_pages(trident_t *trident, snd_pcm_substream_t *substream)
|
||||
/*
|
||||
* page allocation for DMA
|
||||
*/
|
||||
snd_util_memblk_t *
|
||||
snd_trident_alloc_pages(trident_t *trident, snd_pcm_substream_t *substream)
|
||||
struct snd_util_memblk *
|
||||
snd_trident_alloc_pages(struct snd_trident *trident,
|
||||
struct snd_pcm_substream *substream)
|
||||
{
|
||||
snd_assert(trident != NULL, return NULL);
|
||||
snd_assert(substream != NULL, return NULL);
|
||||
@@ -285,9 +290,10 @@ snd_trident_alloc_pages(trident_t *trident, snd_pcm_substream_t *substream)
|
||||
/*
|
||||
* release DMA buffer from page table
|
||||
*/
|
||||
int snd_trident_free_pages(trident_t *trident, snd_util_memblk_t *blk)
|
||||
int snd_trident_free_pages(struct snd_trident *trident,
|
||||
struct snd_util_memblk *blk)
|
||||
{
|
||||
snd_util_memhdr_t *hdr;
|
||||
struct snd_util_memhdr *hdr;
|
||||
int page;
|
||||
|
||||
snd_assert(trident != NULL, return -EINVAL);
|
||||
@@ -314,17 +320,17 @@ int snd_trident_free_pages(trident_t *trident, snd_util_memblk_t *blk)
|
||||
|
||||
/*
|
||||
*/
|
||||
static int synth_alloc_pages(trident_t *hw, snd_util_memblk_t *blk);
|
||||
static int synth_free_pages(trident_t *hw, snd_util_memblk_t *blk);
|
||||
static int synth_alloc_pages(struct snd_trident *hw, struct snd_util_memblk *blk);
|
||||
static int synth_free_pages(struct snd_trident *hw, struct snd_util_memblk *blk);
|
||||
|
||||
/*
|
||||
* allocate a synth sample area
|
||||
*/
|
||||
snd_util_memblk_t *
|
||||
snd_trident_synth_alloc(trident_t *hw, unsigned int size)
|
||||
struct snd_util_memblk *
|
||||
snd_trident_synth_alloc(struct snd_trident *hw, unsigned int size)
|
||||
{
|
||||
snd_util_memblk_t *blk;
|
||||
snd_util_memhdr_t *hdr = hw->tlb.memhdr;
|
||||
struct snd_util_memblk *blk;
|
||||
struct snd_util_memhdr *hdr = hw->tlb.memhdr;
|
||||
|
||||
down(&hdr->block_mutex);
|
||||
blk = __snd_util_mem_alloc(hdr, size);
|
||||
@@ -346,9 +352,9 @@ snd_trident_synth_alloc(trident_t *hw, unsigned int size)
|
||||
* free a synth sample area
|
||||
*/
|
||||
int
|
||||
snd_trident_synth_free(trident_t *hw, snd_util_memblk_t *blk)
|
||||
snd_trident_synth_free(struct snd_trident *hw, struct snd_util_memblk *blk)
|
||||
{
|
||||
snd_util_memhdr_t *hdr = hw->tlb.memhdr;
|
||||
struct snd_util_memhdr *hdr = hw->tlb.memhdr;
|
||||
|
||||
down(&hdr->block_mutex);
|
||||
synth_free_pages(hw, blk);
|
||||
@@ -361,7 +367,7 @@ snd_trident_synth_free(trident_t *hw, snd_util_memblk_t *blk)
|
||||
/*
|
||||
* reset TLB entry and free kernel page
|
||||
*/
|
||||
static void clear_tlb(trident_t *trident, int page)
|
||||
static void clear_tlb(struct snd_trident *trident, int page)
|
||||
{
|
||||
void *ptr = page_to_ptr(trident, page);
|
||||
dma_addr_t addr = page_to_addr(trident, page);
|
||||
@@ -378,20 +384,22 @@ static void clear_tlb(trident_t *trident, int page)
|
||||
}
|
||||
|
||||
/* check new allocation range */
|
||||
static void get_single_page_range(snd_util_memhdr_t *hdr, snd_util_memblk_t *blk, int *first_page_ret, int *last_page_ret)
|
||||
static void get_single_page_range(struct snd_util_memhdr *hdr,
|
||||
struct snd_util_memblk *blk,
|
||||
int *first_page_ret, int *last_page_ret)
|
||||
{
|
||||
struct list_head *p;
|
||||
snd_util_memblk_t *q;
|
||||
struct snd_util_memblk *q;
|
||||
int first_page, last_page;
|
||||
first_page = firstpg(blk);
|
||||
if ((p = blk->list.prev) != &hdr->block) {
|
||||
q = list_entry(p, snd_util_memblk_t, list);
|
||||
q = list_entry(p, struct snd_util_memblk, list);
|
||||
if (lastpg(q) == first_page)
|
||||
first_page++; /* first page was already allocated */
|
||||
}
|
||||
last_page = lastpg(blk);
|
||||
if ((p = blk->list.next) != &hdr->block) {
|
||||
q = list_entry(p, snd_util_memblk_t, list);
|
||||
q = list_entry(p, struct snd_util_memblk, list);
|
||||
if (firstpg(q) == last_page)
|
||||
last_page--; /* last page was already allocated */
|
||||
}
|
||||
@@ -402,7 +410,7 @@ static void get_single_page_range(snd_util_memhdr_t *hdr, snd_util_memblk_t *blk
|
||||
/*
|
||||
* allocate kernel pages and assign them to TLB
|
||||
*/
|
||||
static int synth_alloc_pages(trident_t *hw, snd_util_memblk_t *blk)
|
||||
static int synth_alloc_pages(struct snd_trident *hw, struct snd_util_memblk *blk)
|
||||
{
|
||||
int page, first_page, last_page;
|
||||
struct snd_dma_buffer dmab;
|
||||
@@ -438,7 +446,7 @@ __fail:
|
||||
/*
|
||||
* free pages
|
||||
*/
|
||||
static int synth_free_pages(trident_t *trident, snd_util_memblk_t *blk)
|
||||
static int synth_free_pages(struct snd_trident *trident, struct snd_util_memblk *blk)
|
||||
{
|
||||
int page, first_page, last_page;
|
||||
|
||||
@@ -452,7 +460,9 @@ static int synth_free_pages(trident_t *trident, snd_util_memblk_t *blk)
|
||||
/*
|
||||
* copy_from_user(blk + offset, data, size)
|
||||
*/
|
||||
int snd_trident_synth_copy_from_user(trident_t *trident, snd_util_memblk_t *blk, int offset, const char __user *data, int size)
|
||||
int snd_trident_synth_copy_from_user(struct snd_trident *trident,
|
||||
struct snd_util_memblk *blk,
|
||||
int offset, const char __user *data, int size)
|
||||
{
|
||||
int page, nextofs, end_offset, temp, temp1;
|
||||
|
||||
|
Reference in New Issue
Block a user