diff mbox series

[1/2] mips: provide unxlate_dev_mem_ptr() in asm/io.h

Message ID 20230516194000.548487-1-arnd@kernel.org (mailing list archive)
State Accepted
Commit 99b619b37ae151dc0fcdffcae48b5a5ad90ebde8
Headers show
Series [1/2] mips: provide unxlate_dev_mem_ptr() in asm/io.h | expand

Commit Message

Arnd Bergmann May 16, 2023, 7:39 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

The unxlate_dev_mem_ptr() function has no prototype on the mips
architecture, which does not include asm-generic/io.h, so gcc warns
about the __weak definition:

drivers/char/mem.c:94:29: error: no previous prototype for 'unxlate_dev_mem_ptr' [-Werror=missing-prototypes]

Since everyone else already gets the generic definition or has a custom
one, there is not really much point in having a __weak version as well.

Remove this one, and instead add a trivial macro to the mips header.
Once we convert mips to use the asm-generic header, this can go away
again.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/mips/include/asm/io.h | 1 +
 drivers/char/mem.c         | 7 -------
 2 files changed, 1 insertion(+), 7 deletions(-)

Comments

Thomas Bogendoerfer June 9, 2023, 8:16 a.m. UTC | #1
On Tue, May 16, 2023 at 09:39:42PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The unxlate_dev_mem_ptr() function has no prototype on the mips
> architecture, which does not include asm-generic/io.h, so gcc warns
> about the __weak definition:
> 
> drivers/char/mem.c:94:29: error: no previous prototype for 'unxlate_dev_mem_ptr' [-Werror=missing-prototypes]
> 
> Since everyone else already gets the generic definition or has a custom
> one, there is not really much point in having a __weak version as well.
> 
> Remove this one, and instead add a trivial macro to the mips header.
> Once we convert mips to use the asm-generic header, this can go away
> again.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  arch/mips/include/asm/io.h | 1 +
>  drivers/char/mem.c         | 7 -------
>  2 files changed, 1 insertion(+), 7 deletions(-)

applied to mips-next.

Thomas.
Guenter Roeck June 21, 2023, 1:52 p.m. UTC | #2
On Tue, May 16, 2023 at 09:39:42PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The unxlate_dev_mem_ptr() function has no prototype on the mips
> architecture, which does not include asm-generic/io.h, so gcc warns
> about the __weak definition:
> 
> drivers/char/mem.c:94:29: error: no previous prototype for 'unxlate_dev_mem_ptr' [-Werror=missing-prototypes]
> 
> Since everyone else already gets the generic definition or has a custom
> one, there is not really much point in having a __weak version as well.
> 
> Remove this one, and instead add a trivial macro to the mips header.
> Once we convert mips to use the asm-generic header, this can go away
> again.
> 

This results in build failures when trying to build sh4 images.

drivers/char/mem.c: In function 'read_mem':
drivers/char/mem.c:164:25: error: implicit declaration of function 'unxlate_dev_mem_ptr'

Guenter
Arnd Bergmann June 21, 2023, 2:05 p.m. UTC | #3
On Wed, Jun 21, 2023, at 15:52, Guenter Roeck wrote:
> On Tue, May 16, 2023 at 09:39:42PM +0200, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>> 
>> The unxlate_dev_mem_ptr() function has no prototype on the mips
>> architecture, which does not include asm-generic/io.h, so gcc warns
>> about the __weak definition:
>> 
>> drivers/char/mem.c:94:29: error: no previous prototype for 'unxlate_dev_mem_ptr' [-Werror=missing-prototypes]
>> 
>> Since everyone else already gets the generic definition or has a custom
>> one, there is not really much point in having a __weak version as well.
>> 
>> Remove this one, and instead add a trivial macro to the mips header.
>> Once we convert mips to use the asm-generic header, this can go away
>> again.
>> 
>
> This results in build failures when trying to build sh4 images.
>
> drivers/char/mem.c: In function 'read_mem':
> drivers/char/mem.c:164:25: error: implicit declaration of function 
> 'unxlate_dev_mem_ptr'

Odd, it looks like arch/sh/ is also missing an #include
<asm-generic/io.h> in its asm/io.h, I was sure that mips was the
only one to still not have that.

There are already patches on the list to convert both, so I think
we'll be fine on sh after this one gets merged:
https://lore.kernel.org/all/20230609075528.9390-12-bhe@redhat.com/

    Arnd
Thomas Bogendoerfer June 23, 2023, 1:16 p.m. UTC | #4
On Wed, Jun 21, 2023 at 04:05:11PM +0200, Arnd Bergmann wrote:
> On Wed, Jun 21, 2023, at 15:52, Guenter Roeck wrote:
> > On Tue, May 16, 2023 at 09:39:42PM +0200, Arnd Bergmann wrote:
> >> From: Arnd Bergmann <arnd@arndb.de>
> >> 
> >> The unxlate_dev_mem_ptr() function has no prototype on the mips
> >> architecture, which does not include asm-generic/io.h, so gcc warns
> >> about the __weak definition:
> >> 
> >> drivers/char/mem.c:94:29: error: no previous prototype for 'unxlate_dev_mem_ptr' [-Werror=missing-prototypes]
> >> 
> >> Since everyone else already gets the generic definition or has a custom
> >> one, there is not really much point in having a __weak version as well.
> >> 
> >> Remove this one, and instead add a trivial macro to the mips header.
> >> Once we convert mips to use the asm-generic header, this can go away
> >> again.
> >> 
> >
> > This results in build failures when trying to build sh4 images.
> >
> > drivers/char/mem.c: In function 'read_mem':
> > drivers/char/mem.c:164:25: error: implicit declaration of function 
> > 'unxlate_dev_mem_ptr'
> 
> Odd, it looks like arch/sh/ is also missing an #include
> <asm-generic/io.h> in its asm/io.h, I was sure that mips was the
> only one to still not have that.
> 
> There are already patches on the list to convert both, so I think
> we'll be fine on sh after this one gets merged:
> https://lore.kernel.org/all/20230609075528.9390-12-bhe@redhat.com/

which is already taken ages, so I'm not that confident, that this
will happen before merge window starts...

Thomas.
diff mbox series

Patch

diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
index cc28d207a061..affd21e9c20b 100644
--- a/arch/mips/include/asm/io.h
+++ b/arch/mips/include/asm/io.h
@@ -554,6 +554,7 @@  extern void (*_dma_cache_inv)(unsigned long start, unsigned long size);
  * access
  */
 #define xlate_dev_mem_ptr(p)	__va(p)
+#define unxlate_dev_mem_ptr(p, v) do { } while (0)
 
 void __ioread64_copy(void *to, const void __iomem *from, size_t count);
 
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index f494d31f2b98..94eff6a2a7b6 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -90,13 +90,6 @@  static inline int range_is_allowed(unsigned long pfn, unsigned long size)
 }
 #endif
 
-#ifndef unxlate_dev_mem_ptr
-#define unxlate_dev_mem_ptr unxlate_dev_mem_ptr
-void __weak unxlate_dev_mem_ptr(phys_addr_t phys, void *addr)
-{
-}
-#endif
-
 static inline bool should_stop_iteration(void)
 {
 	if (need_resched())