patch-2.4.0-test6 linux/drivers/sound/i810_audio.c

Next file: linux/drivers/sound/maestro.c
Previous file: linux/drivers/sound/esssolo1.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test5/linux/drivers/sound/i810_audio.c linux/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 @@
 	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 @@
 	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 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);
 	}

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)