[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220329085855.2210-1-xiaolinkui@gmail.com>
Date: Tue, 29 Mar 2022 16:58:55 +0800
From: xiaolinkui@...il.com
To: tsbogend@...ha.franken.de, f.fainelli@...il.com, rppt@...nel.org,
david@...hat.com, arnd@...db.de
Cc: linux-mips@...r.kernel.org, linux-kernel@...r.kernel.org,
xiaolinkui <xiaolinkui@...inos.cn>
Subject: [PATCH] mips: fix a compilation error.
From: xiaolinkui <xiaolinkui@...inos.cn>
Commit 4d5b3bdc0ecb ("MIPS: Fix a warning for virt_to_page") will
trigger a compilation error as follows with kernel v5.17-rc8:
(CONFIG_RDMA_SIW=y)
In file included from ./arch/mips/include/asm/page.h:270,
from ./arch/mips/include/asm/io.h:29,
from ./arch/mips/include/asm/mmiowb.h:5,
from ./include/linux/spinlock.h:64,
from ./include/linux/wait.h:9,
from ./include/linux/net.h:19,
from drivers/infiniband/sw/siw/siw_qp_tx.c:8:
drivers/infiniband/sw/siw/siw_qp_tx.c: In function ‘siw_tx_hdt’:
./arch/mips/include/asm/page.h:255:53: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
255 | #define virt_to_pfn(kaddr) PFN_DOWN(virt_to_phys((void *)(kaddr)))
| ^
./include/asm-generic/memory_model.h:18:41: note: in definition of macro ‘__pfn_to_page’
18 | #define __pfn_to_page(pfn) (mem_map + ((pfn) - ARCH_PFN_OFFSET))
| ^~~
./arch/mips/include/asm/page.h:255:31: note: in expansion of macro ‘PFN_DOWN’
255 | #define virt_to_pfn(kaddr) PFN_DOWN(virt_to_phys((void *)(kaddr)))
| ^~~~~~~~
./arch/mips/include/asm/page.h:256:41: note: in expansion of macro ‘virt_to_pfn’
256 | #define virt_to_page(kaddr) pfn_to_page(virt_to_pfn(kaddr))
| ^~~~~~~~~~~
drivers/infiniband/sw/siw/siw_qp_tx.c:538:23: note: in expansion of macro ‘virt_to_page’
538 | page_array[seg] = virt_to_page(va & PAGE_MASK);
| ^~~~~~~~~~~~
Fixes: 37d15948eb72 ("MIPS: page.h: Define virt_to_pfn()")
Fixes: 4d5b3bdc0ecb ("MIPS: Fix a warning for virt_to_page")
Fixes: b9be6f18cf9e ("rdma/siw: transmit path")
Signed-off-by: xiaolinkui <xiaolinkui@...inos.cn>
---
arch/mips/include/asm/page.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h
index 96bc798c1ec1..0f986f4ad4f0 100644
--- a/arch/mips/include/asm/page.h
+++ b/arch/mips/include/asm/page.h
@@ -252,7 +252,7 @@ static inline int pfn_valid(unsigned long pfn)
#endif
-#define virt_to_pfn(kaddr) PFN_DOWN(virt_to_phys((void *)(kaddr)))
+#define virt_to_pfn(kaddr) PFN_DOWN(__pa(kaddr))
#define virt_to_page(kaddr) pfn_to_page(virt_to_pfn(kaddr))
extern bool __virt_addr_valid(const volatile void *kaddr);
--
2.17.1
Powered by blists - more mailing lists