summaryrefslogtreecommitdiffstats
path: root/drivers/sound
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-08-08 22:17:26 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-08-08 22:17:26 +0000
commit984760dbf5e48f6224dfe9e26e03536b3d38b6cd (patch)
treea99674322e524c4c90009b3bdae5fab0eebf2094 /drivers/sound
parenta7ce7d5e94c98ef5b867f61b2ebecd563f4b6ec9 (diff)
Merge with Linux 2.4.0-test6-pre8.
Diffstat (limited to 'drivers/sound')
-rw-r--r--drivers/sound/cmpci.c17
-rw-r--r--drivers/sound/dmabuf.c14
-rw-r--r--drivers/sound/emu10k1/audio.c5
-rw-r--r--drivers/sound/es1370.c17
-rw-r--r--drivers/sound/es1371.c17
-rw-r--r--drivers/sound/esssolo1.c17
-rw-r--r--drivers/sound/i810_audio.c17
-rw-r--r--drivers/sound/maestro.c18
-rw-r--r--drivers/sound/msnd_pinnacle.c1
-rw-r--r--drivers/sound/sonicvibes.c17
-rw-r--r--drivers/sound/sscape.c14
-rw-r--r--drivers/sound/trident.c17
12 files changed, 92 insertions, 79 deletions
diff --git a/drivers/sound/cmpci.c b/drivers/sound/cmpci.c
index e97721044..6fcb896ac 100644
--- a/drivers/sound/cmpci.c
+++ b/drivers/sound/cmpci.c
@@ -109,6 +109,7 @@
#include <linux/malloc.h>
#include <linux/soundcard.h>
#include <linux/pci.h>
+#include <linux/wrapper.h>
#include <asm/io.h>
#include <asm/dma.h>
#include <linux/init.h>
@@ -591,13 +592,13 @@ static void start_adc(struct cm_state *s)
static void dealloc_dmabuf(struct dmabuf *db)
{
- unsigned long map, mapend;
+ struct page *pstart, *pend;
if (db->rawbuf) {
/* undo marking the pages as reserved */
- mapend = MAP_NR(db->rawbuf + (PAGE_SIZE << db->buforder) - 1);
- for (map = MAP_NR(db->rawbuf); map <= mapend; map++)
- clear_bit(PG_reserved, &mem_map[map].flags);
+ pend = virt_to_page(db->rawbuf + (PAGE_SIZE << db->buforder) - 1);
+ for (pstart = virt_to_page(db->rawbuf); pstart <= pend; pstart++)
+ mem_map_unreserve(pstart);
free_pages((unsigned long)db->rawbuf, db->buforder);
}
db->rawbuf = NULL;
@@ -614,7 +615,7 @@ static int prog_dmabuf(struct cm_state *s, unsigned rec)
int order;
unsigned bytepersec;
unsigned bufs;
- unsigned long map, mapend;
+ struct page *pstart, *pend;
unsigned char fmt;
unsigned long flags;
@@ -646,9 +647,9 @@ static int prog_dmabuf(struct cm_state *s, unsigned rec)
printk(KERN_DEBUG "cmpci: DMA buffer beyond 16MB: busaddr 0x%lx size %ld\n",
virt_to_bus(db->rawbuf), PAGE_SIZE << db->buforder);
/* now mark the pages as reserved; otherwise remap_page_range doesn't do what we want */
- mapend = MAP_NR(db->rawbuf + (PAGE_SIZE << db->buforder) - 1);
- for (map = MAP_NR(db->rawbuf); map <= mapend; map++)
- set_bit(PG_reserved, &mem_map[map].flags);
+ pend = virt_to_page(db->rawbuf + (PAGE_SIZE << db->buforder) - 1);
+ for (pstart = virt_to_page(db->rawbuf); pstart <= pend; pstart++)
+ mem_map_reserve(pstart);
}
bytepersec = rate << sample_shift[fmt];
bufs = PAGE_SIZE << db->buforder;
diff --git a/drivers/sound/dmabuf.c b/drivers/sound/dmabuf.c
index 07d416a27..c11c1fe73 100644
--- a/drivers/sound/dmabuf.c
+++ b/drivers/sound/dmabuf.c
@@ -56,8 +56,9 @@ static long dmabuf_timeout(struct dma_buffparms *dmap)
static int sound_alloc_dmap(struct dma_buffparms *dmap)
{
char *start_addr, *end_addr;
- int i, dma_pagesize;
+ int dma_pagesize;
int sz, size;
+ struct page *page;
dmap->mapping_flags &= ~DMA_MAP_MAPPED;
@@ -113,14 +114,15 @@ static int sound_alloc_dmap(struct dma_buffparms *dmap)
dmap->raw_buf = start_addr;
dmap->raw_buf_phys = virt_to_bus(start_addr);
- for (i = MAP_NR(start_addr); i <= MAP_NR(end_addr); i++)
- set_bit(PG_reserved, &mem_map[i].flags);;
+ for (page = virt_to_page(start_addr); page <= get_mem_map(end_addr); page++)
+ mem_map_reserve(page);
return 0;
}
static void sound_free_dmap(struct dma_buffparms *dmap)
{
- int sz, size, i;
+ int sz, size;
+ struct page *page;
unsigned long start_addr, end_addr;
if (dmap->raw_buf == NULL)
@@ -132,8 +134,8 @@ static void sound_free_dmap(struct dma_buffparms *dmap)
start_addr = (unsigned long) dmap->raw_buf;
end_addr = start_addr + dmap->buffsize;
- for (i = MAP_NR(start_addr); i <= MAP_NR(end_addr); i++)
- clear_bit(PG_reserved, &mem_map[i].flags);;
+ for (page = virt_to_page(start_addr); page <= get_mem_map(end_addr); page++)
+ mem_map_unreserve(page);
free_pages((unsigned long) dmap->raw_buf, sz);
dmap->raw_buf = NULL;
diff --git a/drivers/sound/emu10k1/audio.c b/drivers/sound/emu10k1/audio.c
index 9e2ee24d1..4d81c1a46 100644
--- a/drivers/sound/emu10k1/audio.c
+++ b/drivers/sound/emu10k1/audio.c
@@ -38,6 +38,7 @@
#include "audio.h"
#include <linux/sched.h>
#include <linux/smp_lock.h>
+#include <linux/wrapper.h>
static void calculate_ofrag(struct woinst *);
static void calculate_ifrag(struct wiinst *);
@@ -918,7 +919,7 @@ static int emu10k1_audio_mmap(struct file *file, struct vm_area_struct *vma)
/* Now mark the pages as reserved, otherwise remap_page_range doesn't do what we want */
for (i = 0; i < wave_out->wavexferbuf->numpages; i++)
- set_bit(PG_reserved, &mem_map[MAP_NR(wave_out->pagetable[i])].flags);
+ mem_map_reserve(virt_to_page(wave_out->pagetable[i]));
}
size = vma->vm_end - vma->vm_start;
@@ -1137,7 +1138,7 @@ static int emu10k1_audio_release(struct inode *inode, struct file *file)
/* Undo marking the pages as reserved */
for (i = 0; i < woinst->wave_out->wavexferbuf->numpages; i++)
- set_bit(PG_reserved, &mem_map[MAP_NR(woinst->wave_out->pagetable[i])].flags);
+ mem_map_reserve(virt_to_page(woinst->wave_out->pagetable[i]));
}
woinst->mapped = 0;
diff --git a/drivers/sound/es1370.c b/drivers/sound/es1370.c
index e6c5945cb..a5bb668f2 100644
--- a/drivers/sound/es1370.c
+++ b/drivers/sound/es1370.c
@@ -150,6 +150,7 @@
#include <linux/soundcard.h>
#include <linux/pci.h>
#include <linux/smp_lock.h>
+#include <linux/wrapper.h>
#include <asm/io.h>
#include <asm/dma.h>
#include <linux/init.h>
@@ -540,13 +541,13 @@ static void start_adc(struct es1370_state *s)
extern inline void dealloc_dmabuf(struct es1370_state *s, struct dmabuf *db)
{
- unsigned long map, mapend;
+ struct page *page, *pend;
if (db->rawbuf) {
/* undo marking the pages as reserved */
- mapend = MAP_NR(db->rawbuf + (PAGE_SIZE << db->buforder) - 1);
- for (map = MAP_NR(db->rawbuf); map <= mapend; map++)
- clear_bit(PG_reserved, &mem_map[map].flags);
+ pend = virt_to_page(db->rawbuf + (PAGE_SIZE << db->buforder) - 1);
+ for (page = virt_to_page(db->rawbuf); page <= pend; page++)
+ mem_map_unreserve(page);
pci_free_consistent(s->dev, PAGE_SIZE << db->buforder, db->rawbuf, db->dmaaddr);
}
db->rawbuf = NULL;
@@ -558,7 +559,7 @@ static int prog_dmabuf(struct es1370_state *s, struct dmabuf *db, unsigned rate,
int order;
unsigned bytepersec;
unsigned bufs;
- unsigned long map, mapend;
+ struct page *page, *pend;
db->hwptr = db->swptr = db->total_bytes = db->count = db->error = db->endcleared = 0;
if (!db->rawbuf) {
@@ -570,9 +571,9 @@ static int prog_dmabuf(struct es1370_state *s, struct dmabuf *db, unsigned rate,
return -ENOMEM;
db->buforder = order;
/* now mark the pages as reserved; otherwise remap_page_range doesn't do what we want */
- mapend = MAP_NR(db->rawbuf + (PAGE_SIZE << db->buforder) - 1);
- for (map = MAP_NR(db->rawbuf); map <= mapend; map++)
- set_bit(PG_reserved, &mem_map[map].flags);
+ pend = virt_to_page(db->rawbuf + (PAGE_SIZE << db->buforder) - 1);
+ for (page = virt_to_page(db->rawbuf); page <= pend; page++)
+ mem_map_reserve(page);
}
fmt &= ES1370_FMT_MASK;
bytepersec = rate << sample_shift[fmt];
diff --git a/drivers/sound/es1371.c b/drivers/sound/es1371.c
index 5a2cc9574..df362e8bb 100644
--- a/drivers/sound/es1371.c
+++ b/drivers/sound/es1371.c
@@ -123,6 +123,7 @@
#include <linux/spinlock.h>
#include <linux/smp_lock.h>
#include <linux/ac97_codec.h>
+#include <linux/wrapper.h>
#include <asm/io.h>
#include <asm/dma.h>
#include <asm/uaccess.h>
@@ -872,13 +873,13 @@ static void start_adc(struct es1371_state *s)
extern inline void dealloc_dmabuf(struct es1371_state *s, struct dmabuf *db)
{
- unsigned long map, mapend;
+ struct page *page, *pend;
if (db->rawbuf) {
/* undo marking the pages as reserved */
- mapend = MAP_NR(db->rawbuf + (PAGE_SIZE << db->buforder) - 1);
- for (map = MAP_NR(db->rawbuf); map <= mapend; map++)
- clear_bit(PG_reserved, &mem_map[map].flags);
+ pend = virt_to_page(db->rawbuf + (PAGE_SIZE << db->buforder) - 1);
+ for (page = virt_to_page(db->rawbuf); page <= pend; page++)
+ mem_map_unreserve(page);
pci_free_consistent(s->dev, PAGE_SIZE << db->buforder, db->rawbuf, db->dmaaddr);
}
db->rawbuf = NULL;
@@ -890,7 +891,7 @@ static int prog_dmabuf(struct es1371_state *s, struct dmabuf *db, unsigned rate,
int order;
unsigned bytepersec;
unsigned bufs;
- unsigned long map, mapend;
+ struct page *page, *pend;
db->hwptr = db->swptr = db->total_bytes = db->count = db->error = db->endcleared = 0;
if (!db->rawbuf) {
@@ -902,9 +903,9 @@ static int prog_dmabuf(struct es1371_state *s, struct dmabuf *db, unsigned rate,
return -ENOMEM;
db->buforder = order;
/* now mark the pages as reserved; otherwise remap_page_range doesn't do what we want */
- mapend = MAP_NR(db->rawbuf + (PAGE_SIZE << db->buforder) - 1);
- for (map = MAP_NR(db->rawbuf); map <= mapend; map++)
- set_bit(PG_reserved, &mem_map[map].flags);
+ pend = virt_to_page(db->rawbuf + (PAGE_SIZE << db->buforder) - 1);
+ for (page = virt_to_page(db->rawbuf); page <= pend; page++)
+ mem_map_reserve(page);
}
fmt &= ES1371_FMT_MASK;
bytepersec = rate << sample_shift[fmt];
diff --git a/drivers/sound/esssolo1.c b/drivers/sound/esssolo1.c
index 6a1623cf0..4c3bdaff8 100644
--- a/drivers/sound/esssolo1.c
+++ b/drivers/sound/esssolo1.c
@@ -91,6 +91,7 @@
#include <linux/poll.h>
#include <linux/spinlock.h>
#include <linux/smp_lock.h>
+#include <linux/wrapper.h>
#include <asm/uaccess.h>
#include <asm/hardirq.h>
@@ -403,13 +404,13 @@ static void start_adc(struct solo1_state *s)
extern inline void dealloc_dmabuf(struct solo1_state *s, struct dmabuf *db)
{
- unsigned long map, mapend;
+ struct page *page, *pend;
if (db->rawbuf) {
/* undo marking the pages as reserved */
- mapend = MAP_NR(db->rawbuf + (PAGE_SIZE << db->buforder) - 1);
- for (map = MAP_NR(db->rawbuf); map <= mapend; map++)
- clear_bit(PG_reserved, &mem_map[map].flags);
+ pend = virt_to_page(db->rawbuf + (PAGE_SIZE << db->buforder) - 1);
+ for (page = virt_to_page(db->rawbuf); page <= pend; page++)
+ mem_map_unreserve(page);
pci_free_consistent(s->dev, PAGE_SIZE << db->buforder, db->rawbuf, db->dmaaddr);
}
db->rawbuf = NULL;
@@ -421,7 +422,7 @@ static int prog_dmabuf(struct solo1_state *s, struct dmabuf *db)
int order;
unsigned bytespersec;
unsigned bufs, sample_shift = 0;
- unsigned long map, mapend;
+ struct page *page, *pend;
db->hwptr = db->swptr = db->total_bytes = db->count = db->error = db->endcleared = 0;
if (!db->rawbuf) {
@@ -433,9 +434,9 @@ static int prog_dmabuf(struct solo1_state *s, struct dmabuf *db)
return -ENOMEM;
db->buforder = order;
/* now mark the pages as reserved; otherwise remap_page_range doesn't do what we want */
- mapend = MAP_NR(db->rawbuf + (PAGE_SIZE << db->buforder) - 1);
- for (map = MAP_NR(db->rawbuf); map <= mapend; map++)
- set_bit(PG_reserved, &mem_map[map].flags);
+ pend = virt_to_page(db->rawbuf + (PAGE_SIZE << db->buforder) - 1);
+ for (page = virt_to_page(db->rawbuf); page <= pend; page++)
+ mem_map_reserve(page);
}
if (s->fmt & (AFMT_S16_LE | AFMT_U16_LE))
sample_shift++;
diff --git a/drivers/sound/i810_audio.c b/drivers/sound/i810_audio.c
index 792f670af..27a1c243b 100644
--- a/drivers/sound/i810_audio.c
+++ b/drivers/sound/i810_audio.c
@@ -78,6 +78,7 @@
#include <linux/spinlock.h>
#include <linux/smp_lock.h>
#include <linux/ac97_codec.h>
+#include <linux/wrapper.h>
#include <asm/uaccess.h>
#include <asm/hardirq.h>
@@ -628,7 +629,7 @@ static int alloc_dmabuf(struct i810_state *state)
struct dmabuf *dmabuf = &state->dmabuf;
void *rawbuf;
int order;
- unsigned long map, mapend;
+ struct page *page, *pend;
/* alloc as big a chunk as we can, FIXME: is this necessary ?? */
for (order = DMABUF_DEFAULTORDER; order >= DMABUF_MINORDER; order--)
@@ -649,9 +650,9 @@ static int alloc_dmabuf(struct i810_state *state)
dmabuf->buforder = order;
/* now mark the pages as reserved; otherwise remap_page_range doesn't do what we want */
- mapend = MAP_NR(rawbuf + (PAGE_SIZE << order) - 1);
- for (map = MAP_NR(rawbuf); map <= mapend; map++)
- set_bit(PG_reserved, &mem_map[map].flags);
+ pend = virt_to_page(rawbuf + (PAGE_SIZE << order) - 1);
+ for (page = virt_to_page(rawbuf); page <= pend; page++)
+ mem_map_reserve(page);
return 0;
}
@@ -660,13 +661,13 @@ static int alloc_dmabuf(struct i810_state *state)
static void dealloc_dmabuf(struct i810_state *state)
{
struct dmabuf *dmabuf = &state->dmabuf;
- unsigned long map, mapend;
+ struct page *page, *pend;
if (dmabuf->rawbuf) {
/* undo marking the pages as reserved */
- mapend = MAP_NR(dmabuf->rawbuf + (PAGE_SIZE << dmabuf->buforder) - 1);
- for (map = MAP_NR(dmabuf->rawbuf); map <= mapend; map++)
- clear_bit(PG_reserved, &mem_map[map].flags);
+ pend = virt_to_page(dmabuf->rawbuf + (PAGE_SIZE << dmabuf->buforder) - 1);
+ for (page = virt_to_page(dmabuf->rawbuf); page <= pend; page++)
+ mem_map_unreserve(page);
pci_free_consistent(state->card->pci_dev, PAGE_SIZE << dmabuf->buforder,
dmabuf->rawbuf, dmabuf->dma_handle);
}
diff --git a/drivers/sound/maestro.c b/drivers/sound/maestro.c
index 429f0055f..6c664aea4 100644
--- a/drivers/sound/maestro.c
+++ b/drivers/sound/maestro.c
@@ -199,6 +199,7 @@
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/smp_lock.h>
+#include <linux/wrapper.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
@@ -2819,7 +2820,7 @@ allocate_buffers(struct ess_state *s)
{
void *rawbuf=NULL;
int order,i;
- unsigned long mapend,map;
+ struct page *page, *pend;
/* alloc as big a chunk as we can */
for (order = (dsps_order + (16-PAGE_SHIFT) + 1); order >= (dsps_order + 2 + 1); order--)
@@ -2865,17 +2866,16 @@ allocate_buffers(struct ess_state *s)
}
/* now mark the pages as reserved; otherwise remap_page_range doesn't do what we want */
- mapend = MAP_NR(rawbuf + (PAGE_SIZE << order) - 1);
- for (map = MAP_NR(rawbuf); map <= mapend; map++) {
- set_bit(PG_reserved, &mem_map[map].flags);
- }
+ pend = virt_to_page(rawbuf + (PAGE_SIZE << order) - 1);
+ for (page = virt_to_page(rawbuf); page <= pend; page++)
+ mem_map_reserve(page);
return 0;
}
static void
free_buffers(struct ess_state *s)
{
- unsigned long map, mapend;
+ struct page *page, *pend;
s->dma_dac.rawbuf = s->dma_adc.rawbuf = NULL;
s->dma_dac.mapped = s->dma_adc.mapped = 0;
@@ -2884,9 +2884,9 @@ free_buffers(struct ess_state *s)
M_printk("maestro: freeing %p\n",s->card->dmapages);
/* undo marking the pages as reserved */
- mapend = MAP_NR(s->card->dmapages + (PAGE_SIZE << s->card->dmaorder) - 1);
- for (map = MAP_NR(s->card->dmapages); map <= mapend; map++)
- clear_bit(PG_reserved, &mem_map[map].flags);
+ pend = virt_to_page(s->card->dmapages + (PAGE_SIZE << s->card->dmaorder) - 1);
+ for (page = virt_to_page(s->card->dmapages); page <= pend; page++)
+ mem_map_unreserve(page);
free_pages((unsigned long)s->card->dmapages,s->card->dmaorder);
s->card->dmapages = NULL;
diff --git a/drivers/sound/msnd_pinnacle.c b/drivers/sound/msnd_pinnacle.c
index 91c7d2306..59d805c7b 100644
--- a/drivers/sound/msnd_pinnacle.c
+++ b/drivers/sound/msnd_pinnacle.c
@@ -33,6 +33,7 @@
*
********************************************************************/
+#include <linux/kernel.h>
#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
diff --git a/drivers/sound/sonicvibes.c b/drivers/sound/sonicvibes.c
index 6b51468b3..526ba929a 100644
--- a/drivers/sound/sonicvibes.c
+++ b/drivers/sound/sonicvibes.c
@@ -109,6 +109,7 @@
#include <linux/poll.h>
#include <linux/spinlock.h>
#include <linux/smp_lock.h>
+#include <linux/wrapper.h>
#include <asm/uaccess.h>
#include <asm/hardirq.h>
@@ -692,13 +693,13 @@ static void start_adc(struct sv_state *s)
static void dealloc_dmabuf(struct sv_state *s, struct dmabuf *db)
{
- unsigned long map, mapend;
+ struct page *page, *pend;
if (db->rawbuf) {
/* undo marking the pages as reserved */
- mapend = MAP_NR(db->rawbuf + (PAGE_SIZE << db->buforder) - 1);
- for (map = MAP_NR(db->rawbuf); map <= mapend; map++)
- clear_bit(PG_reserved, &mem_map[map].flags);
+ pend = virt_to_page(db->rawbuf + (PAGE_SIZE << db->buforder) - 1);
+ for (page = virt_to_page(db->rawbuf); page <= pend; page++)
+ mem_map_unreserve(page);
pci_free_consistent(s->dev, PAGE_SIZE << db->buforder, db->rawbuf, db->dmaaddr);
}
db->rawbuf = NULL;
@@ -715,7 +716,7 @@ static int prog_dmabuf(struct sv_state *s, unsigned rec)
int order;
unsigned bytepersec;
unsigned bufs;
- unsigned long map, mapend;
+ struct page *page, *pend;
unsigned char fmt;
unsigned long flags;
@@ -747,9 +748,9 @@ static int prog_dmabuf(struct sv_state *s, unsigned rec)
printk(KERN_DEBUG "sv: DMA buffer beyond 16MB: busaddr 0x%lx size %ld\n",
virt_to_bus(db->rawbuf), PAGE_SIZE << db->buforder);
/* now mark the pages as reserved; otherwise remap_page_range doesn't do what we want */
- mapend = MAP_NR(db->rawbuf + (PAGE_SIZE << db->buforder) - 1);
- for (map = MAP_NR(db->rawbuf); map <= mapend; map++)
- set_bit(PG_reserved, &mem_map[map].flags);
+ pend = virt_to_page(db->rawbuf + (PAGE_SIZE << db->buforder) - 1);
+ for (page = virt_to_page(db->rawbuf); page <= pend; page++)
+ mem_map_reserve(page);
}
bytepersec = rate << sample_shift[fmt];
bufs = PAGE_SIZE << db->buforder;
diff --git a/drivers/sound/sscape.c b/drivers/sound/sscape.c
index b9ac2879e..e953aac6f 100644
--- a/drivers/sound/sscape.c
+++ b/drivers/sound/sscape.c
@@ -810,8 +810,9 @@ static void sscape_write_host_ctrl2(sscape_info *devc, int a, int b)
static int sscape_alloc_dma(sscape_info *devc)
{
char *start_addr, *end_addr;
- int i, dma_pagesize;
+ int dma_pagesize;
int sz, size;
+ struct page *page;
if (devc->raw_buf != NULL) return 0; /* Already done */
dma_pagesize = (devc->dma < 4) ? (64 * 1024) : (128 * 1024);
@@ -848,23 +849,24 @@ static int sscape_alloc_dma(sscape_info *devc)
devc->raw_buf = start_addr;
devc->raw_buf_phys = virt_to_bus(start_addr);
- for (i = MAP_NR(start_addr); i <= MAP_NR(end_addr); i++)
- set_bit(PG_reserved, &mem_map[i].flags);;
+ for (page = virt_to_page(start_addr); page <= get_mem_map(end_addr); page++)
+ mem_map_reserve(page);
return 1;
}
static void sscape_free_dma(sscape_info *devc)
{
- int sz, size, i;
+ int sz, size;
unsigned long start_addr, end_addr;
+ struct page *page;
if (devc->raw_buf == NULL) return;
for (sz = 0, size = PAGE_SIZE; size < devc->buffsize; sz++, size <<= 1);
start_addr = (unsigned long) devc->raw_buf;
end_addr = start_addr + devc->buffsize;
- for (i = MAP_NR(start_addr); i <= MAP_NR(end_addr); i++)
- clear_bit(PG_reserved, &mem_map[i].flags);;
+ for (page = virt_to_page(start_addr); page <= get_mem_map(end_addr); page++)
+ mem_map_unreserve(page);
free_pages((unsigned long) devc->raw_buf, sz);
devc->raw_buf = NULL;
diff --git a/drivers/sound/trident.c b/drivers/sound/trident.c
index f19cb1740..27a29e42d 100644
--- a/drivers/sound/trident.c
+++ b/drivers/sound/trident.c
@@ -109,6 +109,7 @@
#include <linux/spinlock.h>
#include <linux/smp_lock.h>
#include <linux/ac97_codec.h>
+#include <linux/wrapper.h>
#include <asm/uaccess.h>
#include <asm/hardirq.h>
#include <linux/bitops.h>
@@ -925,7 +926,7 @@ static int alloc_dmabuf(struct trident_state *state)
struct dmabuf *dmabuf = &state->dmabuf;
void *rawbuf;
int order;
- unsigned long map, mapend;
+ struct page *page, *pend;
/* alloc as big a chunk as we can, FIXME: is this necessary ?? */
for (order = DMABUF_DEFAULTORDER; order >= DMABUF_MINORDER; order--)
@@ -946,9 +947,9 @@ static int alloc_dmabuf(struct trident_state *state)
dmabuf->buforder = order;
/* now mark the pages as reserved; otherwise remap_page_range doesn't do what we want */
- mapend = MAP_NR(rawbuf + (PAGE_SIZE << order) - 1);
- for (map = MAP_NR(rawbuf); map <= mapend; map++)
- set_bit(PG_reserved, &mem_map[map].flags);
+ pend = virt_to_page(rawbuf + (PAGE_SIZE << order) - 1);
+ for (page = virt_to_page(rawbuf); page <= pend; page++)
+ mem_map_reserve(page);
return 0;
}
@@ -957,13 +958,13 @@ static int alloc_dmabuf(struct trident_state *state)
static void dealloc_dmabuf(struct trident_state *state)
{
struct dmabuf *dmabuf = &state->dmabuf;
- unsigned long map, mapend;
+ struct page *page, *pend;
if (dmabuf->rawbuf) {
/* undo marking the pages as reserved */
- mapend = MAP_NR(dmabuf->rawbuf + (PAGE_SIZE << dmabuf->buforder) - 1);
- for (map = MAP_NR(dmabuf->rawbuf); map <= mapend; map++)
- clear_bit(PG_reserved, &mem_map[map].flags);
+ pend = virt_to_page(dmabuf->rawbuf + (PAGE_SIZE << dmabuf->buforder) - 1);
+ for (page = virt_to_page(dmabuf->rawbuf); page <= pend; page++)
+ mem_map_unreserve(page);
pci_free_consistent(state->card->pci_dev, PAGE_SIZE << dmabuf->buforder,
dmabuf->rawbuf, dmabuf->dma_handle);
}