linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mips: provide unxlate_dev_mem_ptr() in asm/io.h
@ 2023-05-16 19:39 Arnd Bergmann
  2023-05-16 19:39 ` [PATCH 2/2] mips: asm-offsets: add missing prototypes Arnd Bergmann
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Arnd Bergmann @ 2023-05-16 19:39 UTC (permalink / raw)
  To: Thomas Bogendoerfer
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Geert Uytterhoeven,
	linux-mips, linux-kernel

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(-)

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())
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] mips: asm-offsets: add missing prototypes
  2023-05-16 19:39 [PATCH 1/2] mips: provide unxlate_dev_mem_ptr() in asm/io.h Arnd Bergmann
@ 2023-05-16 19:39 ` Arnd Bergmann
  2023-06-09  8:19   ` Thomas Bogendoerfer
  2023-06-09  8:16 ` [PATCH 1/2] mips: provide unxlate_dev_mem_ptr() in asm/io.h Thomas Bogendoerfer
  2023-06-21 13:52 ` Guenter Roeck
  2 siblings, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2023-05-16 19:39 UTC (permalink / raw)
  To: Thomas Bogendoerfer
  Cc: Arnd Bergmann, Mike Rapoport, Andrew Morton,
	Matthew Wilcox (Oracle),
	Jiaxun Yang, linux-mips, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

Building with -Werror and W=1 fails entirely because of warnings in
asm-offsets.c:

arch/mips/kernel/asm-offsets.c:26:6: error: no previous prototype for 'output_ptreg_defines' [-Werror=missing-prototypes]
arch/mips/kernel/asm-offsets.c:78:6: error: no previous prototype for 'output_task_defines' [-Werror=missing-prototypes]
arch/mips/kernel/asm-offsets.c:92:6: error: no previous prototype for 'output_thread_info_defines' [-Werror=missing-prototypes]
arch/mips/kernel/asm-offsets.c:108:6: error: no previous prototype for 'output_thread_defines' [-Werror=missing-prototypes]
arch/mips/kernel/asm-offsets.c:136:6: error: no previous prototype for 'output_thread_fpu_defines' [-Werror=missing-prototypes]

Nothing actually calls these functions, so just add prototypes to shut
up the warnings.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/mips/kernel/asm-offsets.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/mips/kernel/asm-offsets.c b/arch/mips/kernel/asm-offsets.c
index 40fd4051bb3d..d1b11f66f748 100644
--- a/arch/mips/kernel/asm-offsets.c
+++ b/arch/mips/kernel/asm-offsets.c
@@ -23,6 +23,7 @@
 
 #include <linux/kvm_host.h>
 
+void output_ptreg_defines(void);
 void output_ptreg_defines(void)
 {
 	COMMENT("MIPS pt_regs offsets.");
@@ -75,6 +76,7 @@ void output_ptreg_defines(void)
 	BLANK();
 }
 
+void output_task_defines(void);
 void output_task_defines(void)
 {
 	COMMENT("MIPS task_struct offsets.");
@@ -89,6 +91,7 @@ void output_task_defines(void)
 	BLANK();
 }
 
+void output_thread_info_defines(void);
 void output_thread_info_defines(void)
 {
 	COMMENT("MIPS thread_info offsets.");
@@ -105,6 +108,7 @@ void output_thread_info_defines(void)
 	BLANK();
 }
 
+void output_thread_defines(void);
 void output_thread_defines(void)
 {
 	COMMENT("MIPS specific thread_struct offsets.");
@@ -133,6 +137,7 @@ void output_thread_defines(void)
 }
 
 #ifdef CONFIG_MIPS_FP_SUPPORT
+void output_thread_fpu_defines(void);
 void output_thread_fpu_defines(void)
 {
 	OFFSET(THREAD_FPU, task_struct, thread.fpu);
@@ -176,6 +181,7 @@ void output_thread_fpu_defines(void)
 }
 #endif
 
+void output_mm_defines(void);
 void output_mm_defines(void)
 {
 	COMMENT("Size of struct page");
@@ -210,6 +216,7 @@ void output_mm_defines(void)
 }
 
 #ifdef CONFIG_32BIT
+void output_sc_defines(void);
 void output_sc_defines(void)
 {
 	COMMENT("Linux sigcontext offsets.");
@@ -232,6 +239,7 @@ void output_sc_defines(void)
 #endif
 
 #ifdef CONFIG_64BIT
+void output_sc_defines(void);
 void output_sc_defines(void)
 {
 	COMMENT("Linux sigcontext offsets.");
@@ -245,6 +253,7 @@ void output_sc_defines(void)
 }
 #endif
 
+void output_signal_defined(void);
 void output_signal_defined(void)
 {
 	COMMENT("Linux signal numbers.");
@@ -284,6 +293,7 @@ void output_signal_defined(void)
 }
 
 #ifdef CONFIG_CPU_CAVIUM_OCTEON
+void output_octeon_cop2_state_defines(void);
 void output_octeon_cop2_state_defines(void)
 {
 	COMMENT("Octeon specific octeon_cop2_state offsets.");
@@ -315,6 +325,7 @@ void output_octeon_cop2_state_defines(void)
 #endif
 
 #ifdef CONFIG_HIBERNATION
+void output_pbe_defines(void);
 void output_pbe_defines(void)
 {
 	COMMENT(" Linux struct pbe offsets. ");
@@ -327,6 +338,7 @@ void output_pbe_defines(void)
 #endif
 
 #ifdef CONFIG_CPU_PM
+void output_pm_defines(void);
 void output_pm_defines(void)
 {
 	COMMENT(" PM offsets. ");
@@ -341,6 +353,7 @@ void output_pm_defines(void)
 #endif
 
 #ifdef CONFIG_MIPS_FP_SUPPORT
+void output_kvm_defines(void);
 void output_kvm_defines(void)
 {
 	COMMENT(" KVM/MIPS Specific offsets. ");
@@ -385,6 +398,7 @@ void output_kvm_defines(void)
 #endif
 
 #ifdef CONFIG_MIPS_CPS
+void output_cps_defines(void);
 void output_cps_defines(void)
 {
 	COMMENT(" MIPS CPS offsets. ");
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] mips: provide unxlate_dev_mem_ptr() in asm/io.h
  2023-05-16 19:39 [PATCH 1/2] mips: provide unxlate_dev_mem_ptr() in asm/io.h Arnd Bergmann
  2023-05-16 19:39 ` [PATCH 2/2] mips: asm-offsets: add missing prototypes Arnd Bergmann
@ 2023-06-09  8:16 ` Thomas Bogendoerfer
  2023-06-21 13:52 ` Guenter Roeck
  2 siblings, 0 replies; 7+ messages in thread
From: Thomas Bogendoerfer @ 2023-06-09  8:16 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Geert Uytterhoeven,
	linux-mips, linux-kernel

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.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] mips: asm-offsets: add missing prototypes
  2023-05-16 19:39 ` [PATCH 2/2] mips: asm-offsets: add missing prototypes Arnd Bergmann
@ 2023-06-09  8:19   ` Thomas Bogendoerfer
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Bogendoerfer @ 2023-06-09  8:19 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Arnd Bergmann, Mike Rapoport, Andrew Morton,
	Matthew Wilcox (Oracle),
	Jiaxun Yang, linux-mips, linux-kernel

On Tue, May 16, 2023 at 09:39:43PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> Building with -Werror and W=1 fails entirely because of warnings in
> asm-offsets.c:
> 
> arch/mips/kernel/asm-offsets.c:26:6: error: no previous prototype for 'output_ptreg_defines' [-Werror=missing-prototypes]
> arch/mips/kernel/asm-offsets.c:78:6: error: no previous prototype for 'output_task_defines' [-Werror=missing-prototypes]
> arch/mips/kernel/asm-offsets.c:92:6: error: no previous prototype for 'output_thread_info_defines' [-Werror=missing-prototypes]
> arch/mips/kernel/asm-offsets.c:108:6: error: no previous prototype for 'output_thread_defines' [-Werror=missing-prototypes]
> arch/mips/kernel/asm-offsets.c:136:6: error: no previous prototype for 'output_thread_fpu_defines' [-Werror=missing-prototypes]
> 
> Nothing actually calls these functions, so just add prototypes to shut
> up the warnings.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] mips: provide unxlate_dev_mem_ptr() in asm/io.h
  2023-05-16 19:39 [PATCH 1/2] mips: provide unxlate_dev_mem_ptr() in asm/io.h Arnd Bergmann
  2023-05-16 19:39 ` [PATCH 2/2] mips: asm-offsets: add missing prototypes Arnd Bergmann
  2023-06-09  8:16 ` [PATCH 1/2] mips: provide unxlate_dev_mem_ptr() in asm/io.h Thomas Bogendoerfer
@ 2023-06-21 13:52 ` Guenter Roeck
  2023-06-21 14:05   ` Arnd Bergmann
  2 siblings, 1 reply; 7+ messages in thread
From: Guenter Roeck @ 2023-06-21 13:52 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Thomas Bogendoerfer, Arnd Bergmann, Greg Kroah-Hartman,
	Geert Uytterhoeven, linux-mips, linux-kernel

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] mips: provide unxlate_dev_mem_ptr() in asm/io.h
  2023-06-21 13:52 ` Guenter Roeck
@ 2023-06-21 14:05   ` Arnd Bergmann
  2023-06-23 13:16     ` Thomas Bogendoerfer
  0 siblings, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2023-06-21 14:05 UTC (permalink / raw)
  To: Guenter Roeck, Arnd Bergmann
  Cc: Thomas Bogendoerfer, Greg Kroah-Hartman, Geert Uytterhoeven,
	linux-mips, linux-kernel

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] mips: provide unxlate_dev_mem_ptr() in asm/io.h
  2023-06-21 14:05   ` Arnd Bergmann
@ 2023-06-23 13:16     ` Thomas Bogendoerfer
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Bogendoerfer @ 2023-06-23 13:16 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Guenter Roeck, Arnd Bergmann, Greg Kroah-Hartman,
	Geert Uytterhoeven, linux-mips, linux-kernel

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.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-06-23 13:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-16 19:39 [PATCH 1/2] mips: provide unxlate_dev_mem_ptr() in asm/io.h Arnd Bergmann
2023-05-16 19:39 ` [PATCH 2/2] mips: asm-offsets: add missing prototypes Arnd Bergmann
2023-06-09  8:19   ` Thomas Bogendoerfer
2023-06-09  8:16 ` [PATCH 1/2] mips: provide unxlate_dev_mem_ptr() in asm/io.h Thomas Bogendoerfer
2023-06-21 13:52 ` Guenter Roeck
2023-06-21 14:05   ` Arnd Bergmann
2023-06-23 13:16     ` Thomas Bogendoerfer

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).