linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: xiaolinkui@gmail.com
To: tsbogend@alpha.franken.de, f.fainelli@gmail.com, rppt@kernel.org,
	david@redhat.com, arnd@arndb.de
Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
	xiaolinkui <xiaolinkui@kylinos.cn>
Subject: [PATCH] mips: fix a compilation error.
Date: Tue, 29 Mar 2022 16:58:55 +0800	[thread overview]
Message-ID: <20220329085855.2210-1-xiaolinkui@gmail.com> (raw)

From: xiaolinkui <xiaolinkui@kylinos.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@kylinos.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


             reply	other threads:[~2022-03-29  8:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-29  8:58 xiaolinkui [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-03-29  1:35 [PATCH] mips: Fix a compilation error xiaolinkui2022

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220329085855.2210-1-xiaolinkui@gmail.com \
    --to=xiaolinkui@gmail.com \
    --cc=arnd@arndb.de \
    --cc=david@redhat.com \
    --cc=f.fainelli@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=rppt@kernel.org \
    --cc=tsbogend@alpha.franken.de \
    --cc=xiaolinkui@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).