summaryrefslogtreecommitdiffstats
path: root/drivers
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
parenta7ce7d5e94c98ef5b867f61b2ebecd563f4b6ec9 (diff)
Merge with Linux 2.4.0-test6-pre8.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/lvm-snap.c2
-rw-r--r--drivers/char/agp/agpgart_be.c34
-rw-r--r--drivers/char/bttv-driver.c4
-rw-r--r--drivers/char/buz.c12
-rw-r--r--drivers/char/cpia.c4
-rw-r--r--drivers/char/drm/i810_dma.c10
-rw-r--r--drivers/char/drm/memory.c4
-rw-r--r--drivers/char/drm/mga_dma.c10
-rw-r--r--drivers/char/drm/vm.c8
-rw-r--r--drivers/char/ftape/lowlevel/ftape-buffer.c16
-rw-r--r--drivers/char/planb.c8
-rw-r--r--drivers/char/zr36120_mem.c4
-rw-r--r--drivers/ieee1394/video1394.c4
-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
-rw-r--r--drivers/usb/audio.c4
-rw-r--r--drivers/usb/ibmcam.c4
-rw-r--r--drivers/usb/ov511.c4
-rw-r--r--drivers/video/acornfb.c7
-rw-r--r--drivers/video/sa1100fb.c9
30 files changed, 164 insertions, 155 deletions
diff --git a/drivers/block/lvm-snap.c b/drivers/block/lvm-snap.c
index 20e1c78cc..938ffc26e 100644
--- a/drivers/block/lvm-snap.c
+++ b/drivers/block/lvm-snap.c
@@ -326,7 +326,7 @@ static int lvm_snapshot_alloc_iobuf_pages(struct kiobuf * iobuf, int sectors)
if (!addr)
goto out;
iobuf->pagelist[i] = addr;
- page = mem_map + MAP_NR(addr);
+ page = virt_to_page(addr);
}
#endif
diff --git a/drivers/char/agp/agpgart_be.c b/drivers/char/agp/agpgart_be.c
index 573419a28..a31a6acf7 100644
--- a/drivers/char/agp/agpgart_be.c
+++ b/drivers/char/agp/agpgart_be.c
@@ -141,8 +141,8 @@ static unsigned long agp_alloc_page(void)
if (pt == NULL) {
return 0;
}
- atomic_inc(&mem_map[MAP_NR(pt)].count);
- set_bit(PG_locked, &mem_map[MAP_NR(pt)].flags);
+ atomic_inc(&virt_to_page(pt)->count);
+ set_bit(PG_locked, &virt_to_page(pt)->flags);
atomic_inc(&agp_bridge.current_memory_agp);
return (unsigned long) pt;
}
@@ -154,9 +154,9 @@ static void agp_destroy_page(unsigned long page)
if (pt == NULL) {
return;
}
- atomic_dec(&mem_map[MAP_NR(pt)].count);
- clear_bit(PG_locked, &mem_map[MAP_NR(pt)].flags);
- wake_up(&mem_map[MAP_NR(pt)].wait);
+ atomic_dec(&virt_to_page(pt)->count);
+ clear_bit(PG_locked, &virt_to_page(pt)->flags);
+ wake_up(&virt_to_page(pt)->wait);
free_page((unsigned long) pt);
atomic_dec(&agp_bridge.current_memory_agp);
}
@@ -541,6 +541,7 @@ static int agp_generic_create_gatt_table(void)
int num_entries;
int i;
void *temp;
+ struct page *page;
/* The generic routines can't handle 2 level gatt's */
if (agp_bridge.size_type == LVL2_APER_SIZE) {
@@ -622,9 +623,8 @@ static int agp_generic_create_gatt_table(void)
}
table_end = table + ((PAGE_SIZE * (1 << page_order)) - 1);
- for (i = MAP_NR(table); i < MAP_NR(table_end); i++) {
- set_bit(PG_reserved, &mem_map[i].flags);
- }
+ for (page = virt_to_page(table); page < get_mem_map(table_end); page++)
+ set_bit(PG_reserved, &page->flags);
agp_bridge.gatt_table_real = (unsigned long *) table;
CACHE_FLUSH();
@@ -633,9 +633,8 @@ static int agp_generic_create_gatt_table(void)
CACHE_FLUSH();
if (agp_bridge.gatt_table == NULL) {
- for (i = MAP_NR(table); i < MAP_NR(table_end); i++) {
- clear_bit(PG_reserved, &mem_map[i].flags);
- }
+ for (page = virt_to_page(table); page < get_mem_map(table_end); page++)
+ clear_bit(PG_reserved, &page->flags);
free_pages((unsigned long) table, page_order);
@@ -653,10 +652,10 @@ static int agp_generic_create_gatt_table(void)
static int agp_generic_free_gatt_table(void)
{
- int i;
int page_order;
char *table, *table_end;
void *temp;
+ struct page *page;
temp = agp_bridge.current_size;
@@ -691,9 +690,8 @@ static int agp_generic_free_gatt_table(void)
table = (char *) agp_bridge.gatt_table_real;
table_end = table + ((PAGE_SIZE * (1 << page_order)) - 1);
- for (i = MAP_NR(table); i < MAP_NR(table_end); i++) {
- clear_bit(PG_reserved, &mem_map[i].flags);
- }
+ for (page = virt_to_page(table); page < get_mem_map(table_end); page++)
+ clear_bit(PG_reserved, &page->flags);
free_pages((unsigned long) agp_bridge.gatt_table_real, page_order);
return 0;
@@ -1500,13 +1498,13 @@ static int amd_create_page_map(amd_page_map *page_map)
if (page_map->real == NULL) {
return -ENOMEM;
}
- set_bit(PG_reserved, &mem_map[MAP_NR(page_map->real)].flags);
+ set_bit(PG_reserved, &virt_to_page(page_map->real)->flags);
CACHE_FLUSH();
page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real),
PAGE_SIZE);
if (page_map->remapped == NULL) {
clear_bit(PG_reserved,
- &mem_map[MAP_NR(page_map->real)].flags);
+ &virt_to_page(page_map->real)->flags);
free_page((unsigned long) page_map->real);
page_map->real = NULL;
return -ENOMEM;
@@ -1524,7 +1522,7 @@ static void amd_free_page_map(amd_page_map *page_map)
{
iounmap(page_map->remapped);
clear_bit(PG_reserved,
- &mem_map[MAP_NR(page_map->real)].flags);
+ &virt_to_page(page_map->real)->flags);
free_page((unsigned long) page_map->real);
}
diff --git a/drivers/char/bttv-driver.c b/drivers/char/bttv-driver.c
index 74d4188a2..6c88a757e 100644
--- a/drivers/char/bttv-driver.c
+++ b/drivers/char/bttv-driver.c
@@ -191,7 +191,7 @@ static void * rvmalloc(signed long size)
while (size > 0)
{
page = kvirt_to_pa(adr);
- mem_map_reserve(MAP_NR(__va(page)));
+ mem_map_reserve(virt_to_page(__va(page)));
adr+=PAGE_SIZE;
size-=PAGE_SIZE;
}
@@ -209,7 +209,7 @@ static void rvfree(void * mem, signed long size)
while (size > 0)
{
page = kvirt_to_pa(adr);
- mem_map_unreserve(MAP_NR(__va(page)));
+ mem_map_unreserve(virt_to_page(__va(page)));
adr+=PAGE_SIZE;
size-=PAGE_SIZE;
}
diff --git a/drivers/char/buz.c b/drivers/char/buz.c
index 299a4f8ca..ca3cb4f47 100644
--- a/drivers/char/buz.c
+++ b/drivers/char/buz.c
@@ -199,7 +199,7 @@ static int v4l_fbuffer_alloc(struct zoran *zr)
zr->v4l_gbuf[i].fbuffer_phys = virt_to_phys(mem);
zr->v4l_gbuf[i].fbuffer_bus = virt_to_bus(mem);
for (off = 0; off < v4l_bufsize; off += PAGE_SIZE)
- mem_map_reserve(MAP_NR(mem + off));
+ mem_map_reserve(virt_to_page(mem + off));
DEBUG(printk(BUZ_INFO ": V4L frame %d mem 0x%x (bus: 0x%x=%d)\n", i, mem, virt_to_bus(mem), virt_to_bus(mem)));
} else {
return -ENOBUFS;
@@ -221,7 +221,7 @@ static void v4l_fbuffer_free(struct zoran *zr)
mem = zr->v4l_gbuf[i].fbuffer;
for (off = 0; off < v4l_bufsize; off += PAGE_SIZE)
- mem_map_unreserve(MAP_NR(mem + off));
+ mem_map_unreserve(virt_to_page(mem + off));
kfree((void *) zr->v4l_gbuf[i].fbuffer);
zr->v4l_gbuf[i].fbuffer = NULL;
}
@@ -286,7 +286,7 @@ static int jpg_fbuffer_alloc(struct zoran *zr)
zr->jpg_gbuf[i].frag_tab[0] = virt_to_bus((void *) mem);
zr->jpg_gbuf[i].frag_tab[1] = ((zr->jpg_bufsize / 4) << 1) | 1;
for (off = 0; off < zr->jpg_bufsize; off += PAGE_SIZE)
- mem_map_reserve(MAP_NR(mem + off));
+ mem_map_reserve(virt_to_page(mem + off));
} else {
/* jpg_bufsize is alreay page aligned */
for (j = 0; j < zr->jpg_bufsize / PAGE_SIZE; j++) {
@@ -297,7 +297,7 @@ static int jpg_fbuffer_alloc(struct zoran *zr)
}
zr->jpg_gbuf[i].frag_tab[2 * j] = virt_to_bus((void *) mem);
zr->jpg_gbuf[i].frag_tab[2 * j + 1] = (PAGE_SIZE / 4) << 1;
- mem_map_reserve(MAP_NR(mem));
+ mem_map_reserve(virt_to_page(mem));
}
zr->jpg_gbuf[i].frag_tab[2 * j - 1] |= 1;
@@ -329,7 +329,7 @@ static void jpg_fbuffer_free(struct zoran *zr)
if (zr->jpg_gbuf[i].frag_tab[0]) {
mem = (unsigned char *) bus_to_virt(zr->jpg_gbuf[i].frag_tab[0]);
for (off = 0; off < zr->jpg_bufsize; off += PAGE_SIZE)
- mem_map_unreserve(MAP_NR(mem + off));
+ mem_map_unreserve(virt_to_page(mem + off));
kfree((void *) mem);
zr->jpg_gbuf[i].frag_tab[0] = 0;
zr->jpg_gbuf[i].frag_tab[1] = 0;
@@ -338,7 +338,7 @@ static void jpg_fbuffer_free(struct zoran *zr)
for (j = 0; j < zr->jpg_bufsize / PAGE_SIZE; j++) {
if (!zr->jpg_gbuf[i].frag_tab[2 * j])
break;
- mem_map_unreserve(MAP_NR(bus_to_virt(zr->jpg_gbuf[i].frag_tab[2 * j])));
+ mem_map_unreserve(virt_to_page(bus_to_virt(zr->jpg_gbuf[i].frag_tab[2 * j])));
free_page((unsigned long) bus_to_virt(zr->jpg_gbuf[i].frag_tab[2 * j]));
zr->jpg_gbuf[i].frag_tab[2 * j] = 0;
zr->jpg_gbuf[i].frag_tab[2 * j + 1] = 0;
diff --git a/drivers/char/cpia.c b/drivers/char/cpia.c
index c9ec988d1..d7d007f01 100644
--- a/drivers/char/cpia.c
+++ b/drivers/char/cpia.c
@@ -239,7 +239,7 @@ static void *rvmalloc(unsigned long size)
adr = (unsigned long) mem;
while (size > 0) {
page = kvirt_to_pa(adr);
- mem_map_reserve(MAP_NR(__va(page)));
+ mem_map_reserve(virt_to_page(__va(page)));
adr += PAGE_SIZE;
if (size > PAGE_SIZE)
size -= PAGE_SIZE;
@@ -263,7 +263,7 @@ static void rvfree(void *mem, unsigned long size)
adr = (unsigned long) mem;
while (size > 0) {
page = kvirt_to_pa(adr);
- mem_map_unreserve(MAP_NR(__va(page)));
+ mem_map_unreserve(virt_to_page(__va(page)));
adr += PAGE_SIZE;
if (size > PAGE_SIZE)
size -= PAGE_SIZE;
diff --git a/drivers/char/drm/i810_dma.c b/drivers/char/drm/i810_dma.c
index f3d9db43e..19b7bd928 100644
--- a/drivers/char/drm/i810_dma.c
+++ b/drivers/char/drm/i810_dma.c
@@ -282,8 +282,8 @@ static unsigned long i810_alloc_page(drm_device_t *dev)
if(address == 0UL)
return 0;
- atomic_inc(&mem_map[MAP_NR((void *) address)].count);
- set_bit(PG_locked, &mem_map[MAP_NR((void *) address)].flags);
+ atomic_inc(&virt_to_page(address)->count);
+ set_bit(PG_locked, &virt_to_page(address)->flags);
return address;
}
@@ -293,9 +293,9 @@ static void i810_free_page(drm_device_t *dev, unsigned long page)
if(page == 0UL)
return;
- atomic_dec(&mem_map[MAP_NR((void *) page)].count);
- clear_bit(PG_locked, &mem_map[MAP_NR((void *) page)].flags);
- wake_up(&mem_map[MAP_NR((void *) page)].wait);
+ atomic_dec(&virt_to_page(page)->count);
+ clear_bit(PG_locked, &virt_to_page(page)->flags);
+ wake_up(&virt_to_page(page)->wait);
free_page(page);
return;
}
diff --git a/drivers/char/drm/memory.c b/drivers/char/drm/memory.c
index 5023de808..43e46f1d6 100644
--- a/drivers/char/drm/memory.c
+++ b/drivers/char/drm/memory.c
@@ -246,7 +246,7 @@ unsigned long drm_alloc_pages(int order, int area)
for (addr = address, sz = bytes;
sz > 0;
addr += PAGE_SIZE, sz -= PAGE_SIZE) {
- mem_map_reserve(MAP_NR(addr));
+ mem_map_reserve(virt_to_page(addr));
}
return address;
@@ -267,7 +267,7 @@ void drm_free_pages(unsigned long address, int order, int area)
for (addr = address, sz = bytes;
sz > 0;
addr += PAGE_SIZE, sz -= PAGE_SIZE) {
- mem_map_unreserve(MAP_NR(addr));
+ mem_map_unreserve(virt_to_page(addr));
}
free_pages(address, order);
}
diff --git a/drivers/char/drm/mga_dma.c b/drivers/char/drm/mga_dma.c
index 28e8811c8..d02c3b581 100644
--- a/drivers/char/drm/mga_dma.c
+++ b/drivers/char/drm/mga_dma.c
@@ -57,8 +57,8 @@ static unsigned long mga_alloc_page(drm_device_t *dev)
if(address == 0UL) {
return 0;
}
- atomic_inc(&mem_map[MAP_NR((void *) address)].count);
- set_bit(PG_locked, &mem_map[MAP_NR((void *) address)].flags);
+ atomic_inc(&virt_to_page(address)->count);
+ set_bit(PG_locked, &virt_to_page(address)->flags);
return address;
}
@@ -70,9 +70,9 @@ static void mga_free_page(drm_device_t *dev, unsigned long page)
if(page == 0UL) {
return;
}
- atomic_dec(&mem_map[MAP_NR((void *) page)].count);
- clear_bit(PG_locked, &mem_map[MAP_NR((void *) page)].flags);
- wake_up(&mem_map[MAP_NR((void *) page)].wait);
+ atomic_dec(&virt_to_page(page)->count);
+ clear_bit(PG_locked, &virt_to_page(page)->flags);
+ wake_up(&virt_to_page(page)->wait);
free_page(page);
return;
}
diff --git a/drivers/char/drm/vm.c b/drivers/char/drm/vm.c
index 5ee9e3242..1386bd172 100644
--- a/drivers/char/drm/vm.c
+++ b/drivers/char/drm/vm.c
@@ -89,13 +89,13 @@ struct page *drm_vm_shm_nopage(struct vm_area_struct *vma,
offset = address - vma->vm_start;
page = offset >> PAGE_SHIFT;
physical = (unsigned long)dev->lock.hw_lock + offset;
- atomic_inc(&mem_map[MAP_NR(physical)].count); /* Dec. by kernel */
+ atomic_inc(&virt_to_page(physical)->count); /* Dec. by kernel */
DRM_DEBUG("0x%08lx (page %lu) => 0x%08lx\n", address, page, physical);
#if LINUX_VERSION_CODE < 0x020317
return physical;
#else
- return mem_map + MAP_NR(physical);
+ return (virt_to_page(physical));
#endif
}
@@ -124,13 +124,13 @@ struct page *drm_vm_dma_nopage(struct vm_area_struct *vma,
offset = address - vma->vm_start; /* vm_[pg]off[set] should be 0 */
page = offset >> PAGE_SHIFT;
physical = dma->pagelist[page] + (offset & (~PAGE_MASK));
- atomic_inc(&mem_map[MAP_NR(physical)].count); /* Dec. by kernel */
+ atomic_inc(&virt_to_page(physical)->count); /* Dec. by kernel */
DRM_DEBUG("0x%08lx (page %lu) => 0x%08lx\n", address, page, physical);
#if LINUX_VERSION_CODE < 0x020317
return physical;
#else
- return mem_map + MAP_NR(physical);
+ return (virt_to_page(physical));
#endif
}
diff --git a/drivers/char/ftape/lowlevel/ftape-buffer.c b/drivers/char/ftape/lowlevel/ftape-buffer.c
index d7d31dbbb..bf3addcf4 100644
--- a/drivers/char/ftape/lowlevel/ftape-buffer.c
+++ b/drivers/char/ftape/lowlevel/ftape-buffer.c
@@ -48,11 +48,10 @@ static inline void *dmaalloc(size_t size)
}
addr = __get_dma_pages(GFP_KERNEL, get_order(size));
if (addr) {
- int i;
+ struct page *page;
- for (i = MAP_NR(addr); i < MAP_NR(addr+size); i++) {
- mem_map_reserve(i);
- }
+ for (page = virt_to_page(addr); page < get_mem_map(addr+size); page++)
+ mem_map_reserve(page);
}
return (void *)addr;
}
@@ -60,12 +59,11 @@ static inline void *dmaalloc(size_t size)
static inline void dmafree(void *addr, size_t size)
{
if (size > 0) {
- int i;
+ struct page *page;
- for (i = MAP_NR((unsigned long)addr);
- i < MAP_NR((unsigned long)addr+size); i++) {
- mem_map_unreserve (i);
- }
+ for (page = virt_to_page((unsigned long)addr);
+ page < virt_to_page((unsigned long)addr+size); page++)
+ mem_map_unreserve(page);
free_pages((unsigned long) addr, get_order(size));
}
}
diff --git a/drivers/char/planb.c b/drivers/char/planb.c
index fe5f905e9..94707619d 100644
--- a/drivers/char/planb.c
+++ b/drivers/char/planb.c
@@ -136,13 +136,12 @@ static int grabbuf_alloc(struct planb *pb)
|GFP_DMA, 0);
if (!pb->rawbuf[i])
break;
- set_bit(PG_reserved, &mem_map[MAP_NR(pb->rawbuf[i])].flags);
+ mem_map_reserve(virt_to_page(pb->rawbuf[i]));
}
if (i-- < npage) {
printk(KERN_DEBUG "PlanB: init_grab: grab buffer not allocated\n");
for (; i > 0; i--) {
- clear_bit(PG_reserved,
- &mem_map[MAP_NR(pb->rawbuf[i])].flags);
+ mem_map_unreserve(virt_to_page(pb->rawbuf[i]));
free_pages((unsigned long)pb->rawbuf[i], 0);
}
kfree(pb->rawbuf);
@@ -435,8 +434,7 @@ static void planb_prepare_close(struct planb *pb)
}
if(pb->rawbuf) {
for (i = 0; i < pb->rawbuf_size; i++) {
- clear_bit(PG_reserved,
- &mem_map[MAP_NR(pb->rawbuf[i])].flags);
+ mem_map_unreserve(virt_to_page(pb->rawbuf[i]));
free_pages((unsigned long)pb->rawbuf[i], 0);
}
kfree(pb->rawbuf);
diff --git a/drivers/char/zr36120_mem.c b/drivers/char/zr36120_mem.c
index 082cfee06..b4c6078d3 100644
--- a/drivers/char/zr36120_mem.c
+++ b/drivers/char/zr36120_mem.c
@@ -50,7 +50,7 @@ void* bmalloc(unsigned long size)
if (mem) {
unsigned long adr = (unsigned long)mem;
while (size > 0) {
- mem_map_reserve(MAP_NR(phys_to_virt(adr)));
+ mem_map_reserve(virt_to_page(phys_to_virt(adr)));
adr += PAGE_SIZE;
size -= PAGE_SIZE;
}
@@ -64,7 +64,7 @@ void bfree(void* mem, unsigned long size)
unsigned long adr = (unsigned long)mem;
unsigned long siz = size;
while (siz > 0) {
- mem_map_unreserve(MAP_NR(phys_to_virt(adr)));
+ mem_map_unreserve(virt_to_page(phys_to_virt(adr)));
adr += PAGE_SIZE;
siz -= PAGE_SIZE;
}
diff --git a/drivers/ieee1394/video1394.c b/drivers/ieee1394/video1394.c
index b42ce0b46..f43d82803 100644
--- a/drivers/ieee1394/video1394.c
+++ b/drivers/ieee1394/video1394.c
@@ -221,7 +221,7 @@ static void * rvmalloc(unsigned long size)
while (size > 0)
{
page = kvirt_to_pa(adr);
- mem_map_reserve(MAP_NR(__va(page)));
+ mem_map_reserve(virt_to_page(__va(page)));
adr+=PAGE_SIZE;
size-=PAGE_SIZE;
}
@@ -239,7 +239,7 @@ static void rvfree(void * mem, unsigned long size)
while (size > 0)
{
page = kvirt_to_pa(adr);
- mem_map_unreserve(MAP_NR(__va(page)));
+ mem_map_unreserve(virt_to_page(__va(page)));
adr+=PAGE_SIZE;
size-=PAGE_SIZE;
}
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);
}
diff --git a/drivers/usb/audio.c b/drivers/usb/audio.c
index 5d6def562..3efd73183 100644
--- a/drivers/usb/audio.c
+++ b/drivers/usb/audio.c
@@ -422,7 +422,7 @@ static void dmabuf_release(struct dmabuf *db)
for(nr = 0; nr < NRSGBUF; nr++) {
if (!(p = db->sgbuf[nr]))
continue;
- mem_map_unreserve(MAP_NR(p));
+ mem_map_unreserve(virt_to_page(p));
free_page((unsigned long)p);
db->sgbuf[nr] = NULL;
}
@@ -464,7 +464,7 @@ static int dmabuf_init(struct dmabuf *db)
if (!p)
return -ENOMEM;
db->sgbuf[nr] = p;
- mem_map_reserve(MAP_NR(p));
+ mem_map_reserve(virt_to_page(p));
}
memset(db->sgbuf[nr], AFMT_ISUNSIGNED(db->format) ? 0x80 : 0, PAGE_SIZE);
if ((nr << PAGE_SHIFT) >= db->dmasize)
diff --git a/drivers/usb/ibmcam.c b/drivers/usb/ibmcam.c
index 86360f687..806c9834d 100644
--- a/drivers/usb/ibmcam.c
+++ b/drivers/usb/ibmcam.c
@@ -268,7 +268,7 @@ static void *rvmalloc(unsigned long size)
adr = (unsigned long) mem;
while (size > 0) {
page = kvirt_to_pa(adr);
- mem_map_reserve(MAP_NR(__va(page)));
+ mem_map_reserve(virt_to_page(__va(page)));
adr += PAGE_SIZE;
if (size > PAGE_SIZE)
size -= PAGE_SIZE;
@@ -292,7 +292,7 @@ static void rvfree(void *mem, unsigned long size)
adr=(unsigned long) mem;
while (size > 0) {
page = kvirt_to_pa(adr);
- mem_map_unreserve(MAP_NR(__va(page)));
+ mem_map_unreserve(virt_to_page(__va(page)));
adr += PAGE_SIZE;
if (size > PAGE_SIZE)
size -= PAGE_SIZE;
diff --git a/drivers/usb/ov511.c b/drivers/usb/ov511.c
index 055099a0c..8f32026f2 100644
--- a/drivers/usb/ov511.c
+++ b/drivers/usb/ov511.c
@@ -248,7 +248,7 @@ static void *rvmalloc(unsigned long size)
adr = (unsigned long) mem;
while (size > 0) {
page = kvirt_to_pa(adr);
- mem_map_reserve(MAP_NR(__va(page)));
+ mem_map_reserve(virt_to_page(__va(page)));
adr += PAGE_SIZE;
if (size > PAGE_SIZE)
size -= PAGE_SIZE;
@@ -272,7 +272,7 @@ static void rvfree(void *mem, unsigned long size)
adr=(unsigned long) mem;
while (size > 0) {
page = kvirt_to_pa(adr);
- mem_map_unreserve(MAP_NR(__va(page)));
+ mem_map_unreserve(virt_to_page(__va(page)));
adr += PAGE_SIZE;
if (size > PAGE_SIZE)
size -= PAGE_SIZE;
diff --git a/drivers/video/acornfb.c b/drivers/video/acornfb.c
index f504cddaf..e5e0e4aad 100644
--- a/drivers/video/acornfb.c
+++ b/drivers/video/acornfb.c
@@ -22,6 +22,7 @@
#include <linux/malloc.h>
#include <linux/init.h>
#include <linux/fb.h>
+#include <linux/wrapper.h>
#include <asm/hardware.h>
#include <asm/io.h>
@@ -1532,8 +1533,8 @@ free_unused_pages(unsigned int virtual_start, unsigned int virtual_end)
* set count to 1, and free
* the page.
*/
- clear_bit(PG_reserved, &mem_map[MAP_NR(virtual_start)].flags);
- atomic_set(&mem_map[MAP_NR(virtual_start)].count, 1);
+ mem_map_unreserve(virt_to_page(virtual_start));
+ atomic_set(&virt_to_page(virtual_start)->count, 1);
free_page(virtual_start);
virtual_start += PAGE_SIZE;
@@ -1628,7 +1629,7 @@ acornfb_init(void)
for (page = current_par.screen_base;
page < PAGE_ALIGN(current_par.screen_base + size);
page += PAGE_SIZE)
- mem_map[MAP_NR(page)].flags |= (1 << PG_reserved);
+ mem_map_reserve(virt_to_page(page));
/* Hand back any excess pages that we allocated. */
for (page = current_par.screen_base + size; page < top; page += PAGE_SIZE)
free_page(page);
diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c
index 7a91d0b01..df86a674e 100644
--- a/drivers/video/sa1100fb.c
+++ b/drivers/video/sa1100fb.c
@@ -36,6 +36,7 @@
#include <linux/init.h>
#include <linux/fb.h>
#include <linux/delay.h>
+#include <linux/wrapper.h>
#include <asm/hardware.h>
#include <asm/io.h>
@@ -730,8 +731,8 @@ __init sa1100fb_map_video_memory(void)
u_int required_pages;
u_int extra_pages;
u_int order;
- u_int i;
char *allocated_region;
+ struct page *page;
if (VideoMemRegion != NULL)
return -EINVAL;
@@ -757,9 +758,9 @@ __init sa1100fb_map_video_memory(void)
/* Set reserved flag for fb memory to allow it to be remapped into */
/* user space by the common fbmem driver using remap_page_range(). */
- for(i = MAP_NR(VideoMemRegion);
- i < MAP_NR(VideoMemRegion + ALLOCATED_FB_MEM_SIZE); i++)
- set_bit(PG_reserved, &mem_map[i].flags);
+ for(page = virt_to_page(VideoMemRegion);
+ page < virt_to_page(VideoMemRegion + ALLOCATED_FB_MEM_SIZE); page++)
+ mem_map_reserve(page);
/* Remap the fb memory to a non-buffered, non-cached region */
VideoMemRegion = (u_char *)__ioremap((u_long)VideoMemRegion_phys,