void *dma_alloc_coherent(struct device *hwdev, size_t size, dma_addr_t *dma_handle, int gfp) 
void *dma_alloc_coherent(struct device *hwdev, size_t size, dma_addr_t *dma_handle, gfp_t gfp) 
void *dma_alloc_coherent(struct device *hwdev, size_t size, dma_addr_t *dma_handle, int gfp){	struct dma_alloc_record *new;	struct list_head *this = &dma_alloc_list;	unsigned long flags;	unsigned long start = DMA_SRAM_START;	unsigned long end;	if (!DMA_SRAM_START) {		printk("%s called without any DMA area reserved!\n", __func__);		return NULL;	}	new = kmalloc(sizeof (*new), GFP_ATOMIC);	if (!new)		return NULL;	/* Round up to a reasonable alignment */	new->len = (size + 31) & ~31;	spin_lock_irqsave(&dma_alloc_lock, flags);	list_for_each (this, &dma_alloc_list) {		struct dma_alloc_record *this_r = list_entry(this, struct dma_alloc_record, list);		end = this_r->ofs;		if (end - start >= size)			goto gotone;		start = this_r->ofs + this_r->len;	}	/* Reached end of list. */	end = DMA_SRAM_END;	this = &dma_alloc_list;	if (end - start >= size) {	gotone:		new->ofs = start;		list_add_tail(&new->list, this);		spin_unlock_irqrestore(&dma_alloc_lock, flags);		*dma_handle = start;		return (void *)start;	}	kfree(new);	spin_unlock_irqrestore(&dma_alloc_lock, flags);	return NULL;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/a5da7d3c6e8fcd7aaab6c4e1e9101ba333248ffb/pci-dma-nommu.c/buggy/arch/frv/mb93090-mb00/pci-dma-nommu.c