Re: [next:master 2145/2346] drivers/base/dma-mapping.c:294:2: error: implicit declaration of function 'dma_common_pages_remap'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/26/2014 6:18 AM, kbuild test robot wrote:
> tree:   git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   1c9e4561f3b2afffcda007eae9d0ddd25525f50e
> commit: fa44abcad042144651fa9cd0f698c7c40a59d60f [2145/2346] common: dma-mapping: introduce common remapping functions
> config: make ARCH=mn10300 asb2364_defconfig
> 
> All error/warnings:
> 
>    drivers/base/dma-mapping.c: In function 'dma_common_contiguous_remap':
>>> drivers/base/dma-mapping.c:294:2: error: implicit declaration of function 'dma_common_pages_remap' [-Werror=implicit-function-declaration]
>      ptr = dma_common_pages_remap(pages, size, vm_flags, prot, caller);
>      ^
>>> drivers/base/dma-mapping.c:294:6: warning: assignment makes pointer from integer without a cast
>      ptr = dma_common_pages_remap(pages, size, vm_flags, prot, caller);
>          ^
>    drivers/base/dma-mapping.c: At top level:
>>> drivers/base/dma-mapping.c:305:7: error: conflicting types for 'dma_common_pages_remap'
>     void *dma_common_pages_remap(struct page **pages, size_t size,
>           ^
>    drivers/base/dma-mapping.c:294:8: note: previous implicit declaration of 'dma_common_pages_remap' was here
>      ptr = dma_common_pages_remap(pages, size, vm_flags, prot, caller);
>            ^
>    cc1: some warnings being treated as errors
> 
> vim +/dma_common_pages_remap +294 drivers/base/dma-mapping.c
> 
>    288		if (!pages)
>    289			return NULL;
>    290	
>    291		for (i = 0, pfn = page_to_pfn(page); i < (size >> PAGE_SHIFT); i++)
>    292			pages[i] = pfn_to_page(pfn + i);
>    293	
>  > 294		ptr = dma_common_pages_remap(pages, size, vm_flags, prot, caller);
>    295	
>    296		kfree(pages);
>    297	
>    298		return ptr;
>    299	}
>    300	
>    301	/*
>    302	 * remaps an array of PAGE_SIZE pages into another vm_area
>    303	 * Cannot be used in non-sleeping contexts
>    304	 */
>  > 305	void *dma_common_pages_remap(struct page **pages, size_t size,
>    306				unsigned long vm_flags, pgprot_t prot,
>    307				const void *caller)
>    308	{
> 

I think this should work

----8<-----
>From 81c9a5504cbc1d72ff1df084d48502b248cd79d0 Mon Sep 17 00:00:00 2001
From: Laura Abbott <lauraa@xxxxxxxxxxxxxx>
Date: Tue, 26 Aug 2014 09:50:49 -0700
Subject: [PATCH] common: dma-mapping: Swap function order

Fix the order of dma_common_contiguous_remap and
dma_common_pages_remap to avoid function declaration errors:

drivers/base/dma-mapping.c: In function 'dma_common_contiguous_remap':
drivers/base/dma-mapping.c:294: error: implicit declaration of
function 'dma_common_pages_remap'
drivers/base/dma-mapping.c:294: warning: assignment makes pointer from
integer without a cast
drivers/base/dma-mapping.c: At top level:
drivers/base/dma-mapping.c:308: error: conflicting types for
'dma_common_pages_remap'
drivers/base/dma-mapping.c:294: error: previous implicit declaration
of 'dma_common_pages_remap' was here

Reported-by: James Hogan <james.hogan@xxxxxxxxxx>
Reported-by: kbuild test robot <fengguang.wu@xxxxxxxxx>
Signed-off-by: Laura Abbott <lauraa@xxxxxxxxxxxxxx>
---
 drivers/base/dma-mapping.c | 44 ++++++++++++++++++++++----------------------
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/base/dma-mapping.c b/drivers/base/dma-mapping.c
index 1bc46df..056fd46 100644
--- a/drivers/base/dma-mapping.c
+++ b/drivers/base/dma-mapping.c
@@ -271,6 +271,28 @@ int dma_common_mmap(struct device *dev, struct vm_area_struct *vma,
 EXPORT_SYMBOL(dma_common_mmap);
 
 /*
+ * remaps an array of PAGE_SIZE pages into another vm_area
+ * Cannot be used in non-sleeping contexts
+ */
+void *dma_common_pages_remap(struct page **pages, size_t size,
+			unsigned long vm_flags, pgprot_t prot,
+			const void *caller)
+{
+	struct vm_struct *area;
+
+	area = get_vm_area_caller(size, vm_flags, caller);
+	if (!area)
+		return NULL;
+
+	if (map_vm_area(area, prot, pages)) {
+		vunmap(area->addr);
+		return NULL;
+	}
+
+	return area->addr;
+}
+
+/*
  * remaps an allocated contiguous region into another vm_area.
  * Cannot be used in non-sleeping contexts
  */
@@ -299,28 +321,6 @@ void *dma_common_contiguous_remap(struct page *page, size_t size,
 }
 
 /*
- * remaps an array of PAGE_SIZE pages into another vm_area
- * Cannot be used in non-sleeping contexts
- */
-void *dma_common_pages_remap(struct page **pages, size_t size,
-			unsigned long vm_flags, pgprot_t prot,
-			const void *caller)
-{
-	struct vm_struct *area;
-
-	area = get_vm_area_caller(size, vm_flags, caller);
-	if (!area)
-		return NULL;
-
-	if (map_vm_area(area, prot, pages)) {
-		vunmap(area->addr);
-		return NULL;
-	}
-
-	return area->addr;
-}
-
-/*
  * unmaps a range previously mapped by dma_common_*_remap
  */
 void dma_common_free_remap(void *cpu_addr, size_t size, unsigned long vm_flags)
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]