Skip to contentSkip to conversation

mips: provide unxlate_dev_mem_ptr() in asm/io.h

PATCH Applied Arnd Bergmann 4 participants 7 messages May 16, 2023 – Jun 23, 2023

Subsystems (2)
lore
Share & tools
lore
#1 lore raw

PATCH 2/2 mips: asm-offsets: add missing prototypes

In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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.

---
 arch/mips/kernel/asm-offsets.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/mips/kernel/asm-offsets.c +14 -0
index 40fd4051bb3d..d1b11f66f748 100644
@@ -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. ");
Signature · 1 line
2.39.2
#0 lore raw

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

From: Arnd Bergmann <[email protected]>

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.

---
 arch/mips/include/asm/io.h | 1 +
 drivers/char/mem.c         | 7 -------
 2 files changed, 1 insertion(+), 7 deletions(-)
arch/mips/include/asm/io.h +1 -0
index cc28d207a061..affd21e9c20b 100644
@@ -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);
 
drivers/char/mem.c +0 -7
index f494d31f2b98..94eff6a2a7b6 100644
@@ -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())
Signature · 1 line
2.39.2
maintainer Applied
#2 lore raw

Re: [PATCH 2/2] mips: asm-offsets: add missing prototypes

In reply to Arnd Bergmann
Quoted 11 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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]

Quoted 4 lines

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

applied to mips-next.

Thomas.

Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]
maintainer Applied
#3 lore raw
In reply to Arnd Bergmann
Quoted 15 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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.

Quoted 5 lines
---
 arch/mips/include/asm/io.h | 1 +
 drivers/char/mem.c         | 7 -------
 2 files changed, 1 insertion(+), 7 deletions(-)

applied to mips-next.

Thomas.

Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]
#4 lore raw
In reply to Arnd Bergmann
Quoted 6 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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:

Quoted 9 lines

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

maintainer
#5 lore raw
Quoted 17 lines · Guenter Roeck
Quoted 6 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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:

Quoted 9 lines

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.

Quoted 5 lines

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/[email protected]/

Arnd

#6 lore raw
Quoted 24 lines · Arnd Bergmann
Quoted 17 lines · Guenter Roeck
Quoted 6 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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:

Quoted 9 lines

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.

Quoted 5 lines

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'

Quoted 7 lines

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/[email protected]/

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

Thomas.

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