__dma_alloc_coherent(size_t size, dma_addr_t *handle, int gfp) 
__dma_alloc_coherent(size_t size, dma_addr_t *handle, gfp_t gfp) 
__dma_alloc_coherent(size_t size, dma_addr_t *handle, int gfp){	struct page *page;	struct vm_region *c;	unsigned long order;	u64 mask = 0x00ffffff, limit; /* ISA default */	if (!consistent_pte) {		printk(KERN_ERR "%s: not initialised\n", __func__);		dump_stack();		return NULL;	}	size = PAGE_ALIGN(size);	limit = (mask + 1) & ~mask;	if ((limit && size >= limit) || size >= (CONSISTENT_END - CONSISTENT_BASE)) {		printk(KERN_WARNING "coherent allocation too big (requested %#x mask %#Lx)\n",		       size, mask);		return NULL;	}	order = get_order(size);	if (mask != 0xffffffff)		gfp |= GFP_DMA;	page = alloc_pages(gfp, order);	if (!page)		goto no_page;	/*	 * Invalidate any data that might be lurking in the	 * kernel direct-mapped region for device DMA.	 */	{		unsigned long kaddr = (unsigned long)page_address(page);		memset(page_address(page), 0, size);		flush_dcache_range(kaddr, kaddr + size);	}	/*	 * Allocate a virtual address in the consistent mapping region.	 */	c = vm_region_alloc(&consistent_head, size,			    gfp & ~(__GFP_DMA | __GFP_HIGHMEM));	if (c) {		unsigned long vaddr = c->vm_start;		pte_t *pte = consistent_pte + CONSISTENT_OFFSET(vaddr);		struct page *end = page + (1 << order);		/*		 * Set the "dma handle"		 */		*handle = page_to_bus(page);		do {			BUG_ON(!pte_none(*pte));			set_page_count(page, 1);			SetPageReserved(page);			set_pte_at(&init_mm, vaddr,				   pte, mk_pte(page, pgprot_noncached(PAGE_KERNEL)));			page++;			pte++;			vaddr += PAGE_SIZE;		} while (size -= PAGE_SIZE);		/*		 * Free the otherwise unused pages.		 */		while (page < end) {			set_page_count(page, 1);			__free_page(page);			page++;		}		return (void *)c->vm_start;	}	if (page)		__free_pages(page, order); no_page:	return NULL;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/e82dd4d6472304495afa271b2f63b572868b23d9/dma-mapping.c/clean/arch/ppc/kernel/dma-mapping.c