From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753055AbbLUXvg (ORCPT ); Mon, 21 Dec 2015 18:51:36 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:33110 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752369AbbLUXsK (ORCPT ); Mon, 21 Dec 2015 18:48:10 -0500 From: Al Viro To: linux-kernel@vger.kernel.org Cc: Linus Torvalds Subject: [POC][PATCH 67/83] mn10300 dma_alloc_coherent(): switch to get_free_pages() Date: Mon, 21 Dec 2015 23:47:40 +0000 Message-Id: <1450741676-5865-67-git-send-email-viro@ZenIV.linux.org.uk> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <20151221234615.GW20997@ZenIV.linux.org.uk> References: <20151221234615.GW20997@ZenIV.linux.org.uk> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Viro Signed-off-by: Al Viro --- arch/mn10300/mm/dma-alloc.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/arch/mn10300/mm/dma-alloc.c b/arch/mn10300/mm/dma-alloc.c index 5f3132a4..ffcf771 100644 --- a/arch/mn10300/mm/dma-alloc.c +++ b/arch/mn10300/mm/dma-alloc.c @@ -23,17 +23,16 @@ static unsigned long pci_sram_allocated = 0xbc000000; void *dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, int gfp) { - unsigned long addr; - void *ret; + void *addr, *ret; pr_debug("dma_alloc_coherent(%s,%zu,%x)\n", dev ? dev_name(dev) : "?", size, gfp); if (0xbe000000 - pci_sram_allocated >= size) { size = (size + 255) & ~255; - addr = pci_sram_allocated; + addr = (void *)pci_sram_allocated; pci_sram_allocated += size; - ret = (void *) addr; + ret = addr; goto done; } @@ -43,21 +42,21 @@ void *dma_alloc_coherent(struct device *dev, size_t size, if (dev == NULL || dev->coherent_dma_mask < 0xffffffff) gfp |= GFP_DMA; - addr = __get_free_pages(gfp, get_order(size)); + addr = get_free_pages(gfp, get_order(size)); if (!addr) return NULL; /* map the coherent memory through the uncached memory window */ - ret = (void *) (addr | 0x20000000); + ret = (void *) ((unsigned long)addr | 0x20000000); /* fill the memory with obvious rubbish */ - memset((void *) addr, 0xfb, size); + memset(addr, 0xfb, size); /* write back and evict all cache lines covering this region */ - mn10300_dcache_flush_inv_range2(virt_to_phys((void *) addr), PAGE_SIZE); + mn10300_dcache_flush_inv_range2(virt_to_phys(addr), PAGE_SIZE); done: - *dma_handle = virt_to_bus((void *) addr); + *dma_handle = virt_to_bus(addr); printk("dma_alloc_coherent() = %p [%x]\n", ret, *dma_handle); return ret; } -- 2.1.4