linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/20] sh: Fix missing prototypes
@ 2024-03-01 21:02 Geert Uytterhoeven
  2024-03-01 21:02 ` [PATCH 01/20] sh: pgtable: " Geert Uytterhoeven
                   ` (22 more replies)
  0 siblings, 23 replies; 31+ messages in thread
From: Geert Uytterhoeven @ 2024-03-01 21:02 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz, Arnd Bergmann
  Cc: Steven Rostedt, Masami Hiramatsu, Mark Rutland, Will Deacon,
	Aneesh Kumar K . V, Andrew Morton, Nick Piggin, Peter Zijlstra,
	linux-sh, linux-trace-kernel, Geert Uytterhoeven

	Hi all,

This patch series fixes several "no previous prototype for <foo>"
warnings when building a kernel for SuperH.

Known issues:
  - The various warnings about cache functions are not yet fixed, but
    I didn't want to hold off the rest of this series,
  - sdk7786_defconfig needs "[PATCH/RFC] locking/spinlocks: Make __raw_*
    lock ops static" [1],
  - Probably there are more warnings to fix, I didn't build all
    defconfigs.

This has been boot-tested on landisk and on qemu/rts7751r2d.

Thanks for your comments!

[1] https://lore.kernel.org/linux-sh/c395b02613572131568bc1fd1bc456d20d1a5426.1709325647.git.geert+renesas@glider.be

Geert Uytterhoeven (20):
  sh: pgtable: Fix missing prototypes
  sh: fpu: Add missing forward declarations
  sh: syscall: Add missing forward declaration for sys_cacheflush()
  sh: tlb: Add missing forward declaration for handle_tlbmiss()
  sh: return_address: Add missing #include <asm/ftrace.h>
  sh: traps: Add missing #include <asm/setup.h>
  sh: hw_breakpoint: Add missing forward declaration for
    arch_bp_generic_fields()
  sh: boot: Add proper forward declarations
  sh: ftrace: Fix missing prototypes
  sh: nommu: Add missing #include <asm/cacheflush.h>
  sh: math-emu: Add missing #include <asm/fpu.h>
  sh: dma: Remove unused dmac_search_free_channel()
  sh: sh2a: Add missing #include <asm/processor.h>
  sh: sh7786: Remove unused sh7786_usb_use_exclock()
  sh: smp: Fix missing prototypes
  sh: kprobes: Merge arch_copy_kprobe() into arch_prepare_kprobe()
  sh: kprobes: Make trampoline_probe_handler() static
  sh: kprobes: Remove unneeded kprobe_opcode_t casts
  sh: dwarf: Make dwarf_lookup_fde() static
  [RFC] sh: dma: Remove unused functionality

 arch/sh/boot/compressed/cache.c         |   3 +
 arch/sh/boot/compressed/cache.h         |  10 ++
 arch/sh/boot/compressed/misc.c          |   8 +-
 arch/sh/boot/compressed/misc.h          |   9 ++
 arch/sh/drivers/dma/dma-api.c           | 143 ------------------------
 arch/sh/include/asm/dma.h               |   7 --
 arch/sh/include/asm/fpu.h               |   3 +
 arch/sh/include/asm/ftrace.h            |  10 ++
 arch/sh/include/asm/hw_breakpoint.h     |   2 +
 arch/sh/include/asm/syscalls.h          |   1 +
 arch/sh/include/asm/tlb.h               |   4 +
 arch/sh/kernel/cpu/sh2a/opcode_helper.c |   2 +
 arch/sh/kernel/cpu/sh4a/setup-sh7786.c  |  14 ---
 arch/sh/kernel/dwarf.c                  |   2 +-
 arch/sh/kernel/kprobes.c                |  13 +--
 arch/sh/kernel/return_address.c         |   2 +
 arch/sh/kernel/smp.c                    |   4 +-
 arch/sh/kernel/traps.c                  |  10 +-
 arch/sh/kernel/traps_32.c               |   1 +
 arch/sh/math-emu/math.c                 |   2 +
 arch/sh/mm/nommu.c                      |   2 +
 arch/sh/mm/pgtable.c                    |   4 +-
 arch/sh/mm/tlbex_32.c                   |   1 +
 23 files changed, 68 insertions(+), 189 deletions(-)
 create mode 100644 arch/sh/boot/compressed/cache.h
 create mode 100644 arch/sh/boot/compressed/misc.h

-- 
2.34.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* [PATCH 01/20] sh: pgtable: Fix missing prototypes
  2024-03-01 21:02 [PATCH 00/20] sh: Fix missing prototypes Geert Uytterhoeven
@ 2024-03-01 21:02 ` Geert Uytterhoeven
  2024-03-01 21:02 ` [PATCH 02/20] sh: fpu: Add missing forward declarations Geert Uytterhoeven
                   ` (21 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Geert Uytterhoeven @ 2024-03-01 21:02 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz, Arnd Bergmann
  Cc: Steven Rostedt, Masami Hiramatsu, Mark Rutland, Will Deacon,
	Aneesh Kumar K . V, Andrew Morton, Nick Piggin, Peter Zijlstra,
	linux-sh, linux-trace-kernel, Geert Uytterhoeven

arch/sh/mm/pgtable.c:12:6: warning: no previous prototype for 'pgd_ctor' [-Wmissing-prototypes]
arch/sh/mm/pgtable.c:34:8: warning: no previous prototype for 'pgd_alloc' [-Wmissing-prototypes]
arch/sh/mm/pgtable.c:39:6: warning: no previous prototype for 'pgd_free' [-Wmissing-prototypes]
arch/sh/mm/pgtable.c:45:6: warning: no previous prototype for 'pud_populate' [-Wmissing-prototypes]
arch/sh/mm/pgtable.c:50:8: warning: no previous prototype for 'pmd_alloc_one' [-Wmissing-prototypes]
arch/sh/mm/pgtable.c:55:6: warning: no previous prototype for 'pmd_free' [-Wmissing-prototypes]

Make pgd_ctor() static, as it is only used in this file.
Include <asm/pgalloc.h> to fix the other warnings.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/sh/mm/pgtable.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/sh/mm/pgtable.c b/arch/sh/mm/pgtable.c
index cf7ce4b5735954bf..3a4085ea0161fe56 100644
--- a/arch/sh/mm/pgtable.c
+++ b/arch/sh/mm/pgtable.c
@@ -2,12 +2,14 @@
 #include <linux/mm.h>
 #include <linux/slab.h>
 
+#include <asm/pgalloc.h>
+
 static struct kmem_cache *pgd_cachep;
 #if PAGETABLE_LEVELS > 2
 static struct kmem_cache *pmd_cachep;
 #endif
 
-void pgd_ctor(void *x)
+static void pgd_ctor(void *x)
 {
 	pgd_t *pgd = x;
 
-- 
2.34.1


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

* [PATCH 02/20] sh: fpu: Add missing forward declarations
  2024-03-01 21:02 [PATCH 00/20] sh: Fix missing prototypes Geert Uytterhoeven
  2024-03-01 21:02 ` [PATCH 01/20] sh: pgtable: " Geert Uytterhoeven
@ 2024-03-01 21:02 ` Geert Uytterhoeven
  2024-03-01 21:02 ` [PATCH 03/20] sh: syscall: Add missing forward declaration for sys_cacheflush() Geert Uytterhoeven
                   ` (20 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Geert Uytterhoeven @ 2024-03-01 21:02 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz, Arnd Bergmann
  Cc: Steven Rostedt, Masami Hiramatsu, Mark Rutland, Will Deacon,
	Aneesh Kumar K . V, Andrew Morton, Nick Piggin, Peter Zijlstra,
	linux-sh, linux-trace-kernel, Geert Uytterhoeven

arch/sh/kernel/cpu/sh4/fpu.c:389:6: warning: no previous prototype for ‘float_raise’ [-Wmissing-prototypes]
arch/sh/kernel/cpu/sh4/fpu.c:394:5: warning: no previous prototype for ‘float_rounding_mode’ [-Wmissing-prototypes]

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/sh/include/asm/fpu.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/sh/include/asm/fpu.h b/arch/sh/include/asm/fpu.h
index 04584be8986c418a..0379f4cce5ed25fb 100644
--- a/arch/sh/include/asm/fpu.h
+++ b/arch/sh/include/asm/fpu.h
@@ -64,6 +64,9 @@ static inline void clear_fpu(struct task_struct *tsk, struct pt_regs *regs)
 	preempt_enable();
 }
 
+void float_raise(unsigned int flags);
+int float_rounding_mode(void);
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __ASM_SH_FPU_H */
-- 
2.34.1


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

* [PATCH 03/20] sh: syscall: Add missing forward declaration for sys_cacheflush()
  2024-03-01 21:02 [PATCH 00/20] sh: Fix missing prototypes Geert Uytterhoeven
  2024-03-01 21:02 ` [PATCH 01/20] sh: pgtable: " Geert Uytterhoeven
  2024-03-01 21:02 ` [PATCH 02/20] sh: fpu: Add missing forward declarations Geert Uytterhoeven
@ 2024-03-01 21:02 ` Geert Uytterhoeven
  2024-03-01 21:02 ` [PATCH 04/20] sh: tlb: Add missing forward declaration for handle_tlbmiss() Geert Uytterhoeven
                   ` (19 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Geert Uytterhoeven @ 2024-03-01 21:02 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz, Arnd Bergmann
  Cc: Steven Rostedt, Masami Hiramatsu, Mark Rutland, Will Deacon,
	Aneesh Kumar K . V, Andrew Morton, Nick Piggin, Peter Zijlstra,
	linux-sh, linux-trace-kernel, Geert Uytterhoeven

arch/sh/kernel/sys_sh.c:58:16: warning: no previous prototype for ‘sys_cacheflush’ [-Wmissing-prototypes]

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/sh/include/asm/syscalls.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/sh/include/asm/syscalls.h b/arch/sh/include/asm/syscalls.h
index 387105316d2882fe..39240e06e8aa5f6b 100644
--- a/arch/sh/include/asm/syscalls.h
+++ b/arch/sh/include/asm/syscalls.h
@@ -8,6 +8,7 @@ asmlinkage int old_mmap(unsigned long addr, unsigned long len,
 asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
 			  unsigned long prot, unsigned long flags,
 			  unsigned long fd, unsigned long pgoff);
+asmlinkage int sys_cacheflush(unsigned long addr, unsigned long len, int op);
 
 #include <asm/syscalls_32.h>
 
-- 
2.34.1


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

* [PATCH 04/20] sh: tlb: Add missing forward declaration for handle_tlbmiss()
  2024-03-01 21:02 [PATCH 00/20] sh: Fix missing prototypes Geert Uytterhoeven
                   ` (2 preceding siblings ...)
  2024-03-01 21:02 ` [PATCH 03/20] sh: syscall: Add missing forward declaration for sys_cacheflush() Geert Uytterhoeven
@ 2024-03-01 21:02 ` Geert Uytterhoeven
  2024-03-01 21:02 ` [PATCH 05/20] sh: return_address: Add missing #include <asm/ftrace.h> Geert Uytterhoeven
                   ` (18 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Geert Uytterhoeven @ 2024-03-01 21:02 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz, Arnd Bergmann
  Cc: Steven Rostedt, Masami Hiramatsu, Mark Rutland, Will Deacon,
	Aneesh Kumar K . V, Andrew Morton, Nick Piggin, Peter Zijlstra,
	linux-sh, linux-trace-kernel, Geert Uytterhoeven

arch/sh/mm/tlbex_32.c:22:1: warning: no previous prototype for ‘handle_tlbmiss’ [-Wmissing-prototypes]

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/sh/include/asm/tlb.h | 4 ++++
 arch/sh/mm/tlbex_32.c     | 1 +
 2 files changed, 5 insertions(+)

diff --git a/arch/sh/include/asm/tlb.h b/arch/sh/include/asm/tlb.h
index aeb8915e92549609..ddf324bfb9a09721 100644
--- a/arch/sh/include/asm/tlb.h
+++ b/arch/sh/include/asm/tlb.h
@@ -24,6 +24,10 @@ static inline void tlb_unwire_entry(void)
 	BUG();
 }
 #endif /* CONFIG_CPU_SH4 */
+
+asmlinkage int handle_tlbmiss(struct pt_regs *regs, unsigned long error_code,
+			      unsigned long address);
+
 #endif /* CONFIG_MMU */
 #endif /* __ASSEMBLY__ */
 #endif /* __ASM_SH_TLB_H */
diff --git a/arch/sh/mm/tlbex_32.c b/arch/sh/mm/tlbex_32.c
index 1c53868632ee4c69..7d58578c15f4ef55 100644
--- a/arch/sh/mm/tlbex_32.c
+++ b/arch/sh/mm/tlbex_32.c
@@ -14,6 +14,7 @@
 #include <linux/kdebug.h>
 #include <asm/mmu_context.h>
 #include <asm/thread_info.h>
+#include <asm/tlb.h>
 
 /*
  * Called with interrupts disabled.
-- 
2.34.1


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

* [PATCH 05/20] sh: return_address: Add missing #include <asm/ftrace.h>
  2024-03-01 21:02 [PATCH 00/20] sh: Fix missing prototypes Geert Uytterhoeven
                   ` (3 preceding siblings ...)
  2024-03-01 21:02 ` [PATCH 04/20] sh: tlb: Add missing forward declaration for handle_tlbmiss() Geert Uytterhoeven
@ 2024-03-01 21:02 ` Geert Uytterhoeven
  2024-03-01 21:02 ` [PATCH 06/20] sh: traps: Add missing #include <asm/setup.h> Geert Uytterhoeven
                   ` (17 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Geert Uytterhoeven @ 2024-03-01 21:02 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz, Arnd Bergmann
  Cc: Steven Rostedt, Masami Hiramatsu, Mark Rutland, Will Deacon,
	Aneesh Kumar K . V, Andrew Morton, Nick Piggin, Peter Zijlstra,
	linux-sh, linux-trace-kernel, Geert Uytterhoeven

arch/sh/kernel/return_address.c:49:7: warning: no previous prototype for ‘return_address’ [-Wmissing-prototypes]

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/sh/kernel/return_address.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/sh/kernel/return_address.c b/arch/sh/kernel/return_address.c
index 8838094c9ff9444f..2ce22f11eab37839 100644
--- a/arch/sh/kernel/return_address.c
+++ b/arch/sh/kernel/return_address.c
@@ -7,7 +7,9 @@
  */
 #include <linux/kernel.h>
 #include <linux/module.h>
+
 #include <asm/dwarf.h>
+#include <asm/ftrace.h>
 
 #ifdef CONFIG_DWARF_UNWINDER
 
-- 
2.34.1


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

* [PATCH 06/20] sh: traps: Add missing #include <asm/setup.h>
  2024-03-01 21:02 [PATCH 00/20] sh: Fix missing prototypes Geert Uytterhoeven
                   ` (4 preceding siblings ...)
  2024-03-01 21:02 ` [PATCH 05/20] sh: return_address: Add missing #include <asm/ftrace.h> Geert Uytterhoeven
@ 2024-03-01 21:02 ` Geert Uytterhoeven
  2024-03-01 21:02 ` [PATCH 07/20] sh: hw_breakpoint: Add missing forward declaration for arch_bp_generic_fields() Geert Uytterhoeven
                   ` (16 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Geert Uytterhoeven @ 2024-03-01 21:02 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz, Arnd Bergmann
  Cc: Steven Rostedt, Masami Hiramatsu, Mark Rutland, Will Deacon,
	Aneesh Kumar K . V, Andrew Morton, Nick Piggin, Peter Zijlstra,
	linux-sh, linux-trace-kernel, Geert Uytterhoeven

arch/sh/kernel/traps_32.c:735:6: warning: no previous prototype for ‘per_cpu_trap_init’ [-Wmissing-prototypes]

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/sh/kernel/traps_32.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/sh/kernel/traps_32.c b/arch/sh/kernel/traps_32.c
index 6cdda3a621a1e577..8cd4b05df75c3e07 100644
--- a/arch/sh/kernel/traps_32.c
+++ b/arch/sh/kernel/traps_32.c
@@ -27,6 +27,7 @@
 #include <asm/alignment.h>
 #include <asm/fpu.h>
 #include <asm/kprobes.h>
+#include <asm/setup.h>
 #include <asm/traps.h>
 #include <asm/bl_bit.h>
 
-- 
2.34.1


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

* [PATCH 07/20] sh: hw_breakpoint: Add missing forward declaration for arch_bp_generic_fields()
  2024-03-01 21:02 [PATCH 00/20] sh: Fix missing prototypes Geert Uytterhoeven
                   ` (5 preceding siblings ...)
  2024-03-01 21:02 ` [PATCH 06/20] sh: traps: Add missing #include <asm/setup.h> Geert Uytterhoeven
@ 2024-03-01 21:02 ` Geert Uytterhoeven
  2024-03-01 21:02 ` [PATCH 08/20] sh: boot: Add proper forward declarations Geert Uytterhoeven
                   ` (15 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Geert Uytterhoeven @ 2024-03-01 21:02 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz, Arnd Bergmann
  Cc: Steven Rostedt, Masami Hiramatsu, Mark Rutland, Will Deacon,
	Aneesh Kumar K . V, Andrew Morton, Nick Piggin, Peter Zijlstra,
	linux-sh, linux-trace-kernel, Geert Uytterhoeven

arch/sh/kernel/hw_breakpoint.c:135:5: warning: no previous prototype for ‘arch_bp_generic_fields’ [-Wmissing-prototypes]

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/sh/include/asm/hw_breakpoint.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/sh/include/asm/hw_breakpoint.h b/arch/sh/include/asm/hw_breakpoint.h
index 361a0f57bdebda6e..74a438cea6559efd 100644
--- a/arch/sh/include/asm/hw_breakpoint.h
+++ b/arch/sh/include/asm/hw_breakpoint.h
@@ -52,6 +52,8 @@ struct pmu;
 
 /* arch/sh/kernel/hw_breakpoint.c */
 extern int arch_check_bp_in_kernelspace(struct arch_hw_breakpoint *hw);
+extern int arch_bp_generic_fields(int sh_len, int sh_type, int *gen_len,
+				  int *gen_type);
 extern int hw_breakpoint_arch_parse(struct perf_event *bp,
 				    const struct perf_event_attr *attr,
 				    struct arch_hw_breakpoint *hw);
-- 
2.34.1


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

* [PATCH 08/20] sh: boot: Add proper forward declarations
  2024-03-01 21:02 [PATCH 00/20] sh: Fix missing prototypes Geert Uytterhoeven
                   ` (6 preceding siblings ...)
  2024-03-01 21:02 ` [PATCH 07/20] sh: hw_breakpoint: Add missing forward declaration for arch_bp_generic_fields() Geert Uytterhoeven
@ 2024-03-01 21:02 ` Geert Uytterhoeven
  2024-03-05  6:56   ` Yoshinori Sato
  2024-03-01 21:02 ` [PATCH 09/20] sh: ftrace: Fix missing prototypes Geert Uytterhoeven
                   ` (14 subsequent siblings)
  22 siblings, 1 reply; 31+ messages in thread
From: Geert Uytterhoeven @ 2024-03-01 21:02 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz, Arnd Bergmann
  Cc: Steven Rostedt, Masami Hiramatsu, Mark Rutland, Will Deacon,
	Aneesh Kumar K . V, Andrew Morton, Nick Piggin, Peter Zijlstra,
	linux-sh, linux-trace-kernel, Geert Uytterhoeven

arch/sh/boot/compressed/cache.c:2:5: warning: no previous prototype for ‘cache_control’ [-Wmissing-prototypes]
arch/sh/boot/compressed/misc.c:115:6: warning: no previous prototype for ‘ftrace_stub’ [-Wmissing-prototypes]
arch/sh/boot/compressed/misc.c:118:6: warning: no previous prototype for ‘arch_ftrace_ops_list_func’ [-Wmissing-prototypes]
arch/sh/boot/compressed/misc.c:128:6: warning: no previous prototype for ‘decompress_kernel’ [-Wmissing-prototypes]

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/sh/boot/compressed/cache.c |  3 +++
 arch/sh/boot/compressed/cache.h | 10 ++++++++++
 arch/sh/boot/compressed/misc.c  |  8 +++-----
 arch/sh/boot/compressed/misc.h  |  9 +++++++++
 4 files changed, 25 insertions(+), 5 deletions(-)
 create mode 100644 arch/sh/boot/compressed/cache.h
 create mode 100644 arch/sh/boot/compressed/misc.h

diff --git a/arch/sh/boot/compressed/cache.c b/arch/sh/boot/compressed/cache.c
index 31e04ff4841ed084..95c1e73ccbb7e011 100644
--- a/arch/sh/boot/compressed/cache.c
+++ b/arch/sh/boot/compressed/cache.c
@@ -1,4 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
+
+#include "cache.h"
+
 int cache_control(unsigned int command)
 {
 	volatile unsigned int *p = (volatile unsigned int *) 0x80000000;
diff --git a/arch/sh/boot/compressed/cache.h b/arch/sh/boot/compressed/cache.h
new file mode 100644
index 0000000000000000..b622b68c87f59b97
--- /dev/null
+++ b/arch/sh/boot/compressed/cache.h
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef CACHE_H
+#define CACHE_H
+
+#define CACHE_ENABLE	0
+#define CACHE_DISABLE	1
+
+int cache_control(unsigned int command);
+
+#endif /* CACHE_H */
diff --git a/arch/sh/boot/compressed/misc.c b/arch/sh/boot/compressed/misc.c
index ca05c99a3d5b488d..5178150ca6650dcf 100644
--- a/arch/sh/boot/compressed/misc.c
+++ b/arch/sh/boot/compressed/misc.c
@@ -16,6 +16,9 @@
 #include <asm/addrspace.h>
 #include <asm/page.h>
 
+#include "cache.h"
+#include "misc.h"
+
 /*
  * gzip declarations
  */
@@ -26,11 +29,6 @@
 #undef memcpy
 #define memzero(s, n)     memset ((s), 0, (n))
 
-/* cache.c */
-#define CACHE_ENABLE      0
-#define CACHE_DISABLE     1
-int cache_control(unsigned int command);
-
 extern char input_data[];
 extern int input_len;
 static unsigned char *output;
diff --git a/arch/sh/boot/compressed/misc.h b/arch/sh/boot/compressed/misc.h
new file mode 100644
index 0000000000000000..2b4534faa3052857
--- /dev/null
+++ b/arch/sh/boot/compressed/misc.h
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef MISC_H
+#define MISC_H
+
+void arch_ftrace_ops_list_func(void);
+void decompress_kernel(void);
+void ftrace_stub(void);
+
+#endif /* MISC_H */
-- 
2.34.1


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

* [PATCH 09/20] sh: ftrace: Fix missing prototypes
  2024-03-01 21:02 [PATCH 00/20] sh: Fix missing prototypes Geert Uytterhoeven
                   ` (7 preceding siblings ...)
  2024-03-01 21:02 ` [PATCH 08/20] sh: boot: Add proper forward declarations Geert Uytterhoeven
@ 2024-03-01 21:02 ` Geert Uytterhoeven
  2024-03-01 21:02 ` [PATCH 10/20] sh: nommu: Add missing #include <asm/cacheflush.h> Geert Uytterhoeven
                   ` (13 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Geert Uytterhoeven @ 2024-03-01 21:02 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz, Arnd Bergmann
  Cc: Steven Rostedt, Masami Hiramatsu, Mark Rutland, Will Deacon,
	Aneesh Kumar K . V, Andrew Morton, Nick Piggin, Peter Zijlstra,
	linux-sh, linux-trace-kernel, Geert Uytterhoeven

arch/sh/kernel/ftrace.c:130:6: warning: no previous prototype for ‘arch_ftrace_nmi_enter’ [-Wmissing-prototypes]
arch/sh/kernel/ftrace.c:140:6: warning: no previous prototype for ‘arch_ftrace_nmi_exit’ [-Wmissing-prototypes]
arch/sh/kernel/ftrace.c:316:6: warning: no previous prototype for ‘prepare_ftrace_return’ [-Wmissing-prototypes]

Fix this by moving existing forward declarations to <asm/ftrace.h>, and
adding the missing forward declaration for prepare_ftrace_return().

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/sh/include/asm/ftrace.h | 10 ++++++++++
 arch/sh/kernel/traps.c       | 10 ++--------
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/arch/sh/include/asm/ftrace.h b/arch/sh/include/asm/ftrace.h
index b1c1dc0cc261d1db..1c10e106639098fc 100644
--- a/arch/sh/include/asm/ftrace.h
+++ b/arch/sh/include/asm/ftrace.h
@@ -33,6 +33,8 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr)
 	return addr;
 }
 
+void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr);
+
 #endif /* __ASSEMBLY__ */
 #endif /* CONFIG_FUNCTION_TRACER */
 
@@ -43,6 +45,14 @@ extern void *return_address(unsigned int);
 
 #define ftrace_return_address(n) return_address(n)
 
+#ifdef CONFIG_DYNAMIC_FTRACE
+extern void arch_ftrace_nmi_enter(void);
+extern void arch_ftrace_nmi_exit(void);
+#else
+static inline void arch_ftrace_nmi_enter(void) { }
+static inline void arch_ftrace_nmi_exit(void) { }
+#endif
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __ASM_SH_FTRACE_H */
diff --git a/arch/sh/kernel/traps.c b/arch/sh/kernel/traps.c
index 01884054aeb2bd30..4339c4cafa79ce2a 100644
--- a/arch/sh/kernel/traps.c
+++ b/arch/sh/kernel/traps.c
@@ -15,6 +15,8 @@
 
 #include <linux/extable.h>
 #include <linux/module.h>	/* print_modules */
+
+#include <asm/ftrace.h>
 #include <asm/unwinder.h>
 #include <asm/traps.h>
 
@@ -170,14 +172,6 @@ BUILD_TRAP_HANDLER(bug)
 	force_sig(SIGTRAP);
 }
 
-#ifdef CONFIG_DYNAMIC_FTRACE
-extern void arch_ftrace_nmi_enter(void);
-extern void arch_ftrace_nmi_exit(void);
-#else
-static inline void arch_ftrace_nmi_enter(void) { }
-static inline void arch_ftrace_nmi_exit(void) { }
-#endif
-
 BUILD_TRAP_HANDLER(nmi)
 {
 	TRAP_HANDLER_DECL;
-- 
2.34.1


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

* [PATCH 10/20] sh: nommu: Add missing #include <asm/cacheflush.h>
  2024-03-01 21:02 [PATCH 00/20] sh: Fix missing prototypes Geert Uytterhoeven
                   ` (8 preceding siblings ...)
  2024-03-01 21:02 ` [PATCH 09/20] sh: ftrace: Fix missing prototypes Geert Uytterhoeven
@ 2024-03-01 21:02 ` Geert Uytterhoeven
  2024-03-01 21:02 ` [PATCH 11/20] sh: math-emu: Add missing #include <asm/fpu.h> Geert Uytterhoeven
                   ` (12 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Geert Uytterhoeven @ 2024-03-01 21:02 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz, Arnd Bergmann
  Cc: Steven Rostedt, Masami Hiramatsu, Mark Rutland, Will Deacon,
	Aneesh Kumar K . V, Andrew Morton, Nick Piggin, Peter Zijlstra,
	linux-sh, linux-trace-kernel, Geert Uytterhoeven

arch/sh/mm/nommu.c:76:13: warning: no previous prototype for 'kmap_coherent_init' [-Wmissing-prototypes]
arch/sh/mm/nommu.c:80:7: warning: no previous prototype for 'kmap_coherent' [-Wmissing-prototypes]
arch/sh/mm/nommu.c:86:6: warning: no previous prototype for 'kunmap_coherent' [-Wmissing-prototypes]

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/sh/mm/nommu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/sh/mm/nommu.c b/arch/sh/mm/nommu.c
index 78c4b6e6d33ba3af..fa3dc9428a737ffe 100644
--- a/arch/sh/mm/nommu.c
+++ b/arch/sh/mm/nommu.c
@@ -10,6 +10,8 @@
 #include <linux/init.h>
 #include <linux/string.h>
 #include <linux/mm.h>
+
+#include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
 #include <asm/page.h>
 #include <linux/uaccess.h>
-- 
2.34.1


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

* [PATCH 11/20] sh: math-emu: Add missing #include <asm/fpu.h>
  2024-03-01 21:02 [PATCH 00/20] sh: Fix missing prototypes Geert Uytterhoeven
                   ` (9 preceding siblings ...)
  2024-03-01 21:02 ` [PATCH 10/20] sh: nommu: Add missing #include <asm/cacheflush.h> Geert Uytterhoeven
@ 2024-03-01 21:02 ` Geert Uytterhoeven
  2024-03-01 21:02 ` [PATCH 12/20] sh: dma: Remove unused dmac_search_free_channel() Geert Uytterhoeven
                   ` (11 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Geert Uytterhoeven @ 2024-03-01 21:02 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz, Arnd Bergmann
  Cc: Steven Rostedt, Masami Hiramatsu, Mark Rutland, Will Deacon,
	Aneesh Kumar K . V, Andrew Morton, Nick Piggin, Peter Zijlstra,
	linux-sh, linux-trace-kernel, Geert Uytterhoeven

arch/sh/math-emu/math.c:492:5: warning: no previous prototype for 'do_fpu_inst' [-Wmissing-prototypes]

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/sh/math-emu/math.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/sh/math-emu/math.c b/arch/sh/math-emu/math.c
index cdaef6501d764a0c..b65703e065735663 100644
--- a/arch/sh/math-emu/math.c
+++ b/arch/sh/math-emu/math.c
@@ -15,6 +15,8 @@
 #include <linux/perf_event.h>
 
 #include <linux/uaccess.h>
+
+#include <asm/fpu.h>
 #include <asm/processor.h>
 #include <asm/io.h>
 
-- 
2.34.1


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

* [PATCH 12/20] sh: dma: Remove unused dmac_search_free_channel()
  2024-03-01 21:02 [PATCH 00/20] sh: Fix missing prototypes Geert Uytterhoeven
                   ` (10 preceding siblings ...)
  2024-03-01 21:02 ` [PATCH 11/20] sh: math-emu: Add missing #include <asm/fpu.h> Geert Uytterhoeven
@ 2024-03-01 21:02 ` Geert Uytterhoeven
  2024-05-01  9:09   ` John Paul Adrian Glaubitz
  2024-03-01 21:02 ` [PATCH 13/20] sh: sh2a: Add missing #include <asm/processor.h> Geert Uytterhoeven
                   ` (10 subsequent siblings)
  22 siblings, 1 reply; 31+ messages in thread
From: Geert Uytterhoeven @ 2024-03-01 21:02 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz, Arnd Bergmann
  Cc: Steven Rostedt, Masami Hiramatsu, Mark Rutland, Will Deacon,
	Aneesh Kumar K . V, Andrew Morton, Nick Piggin, Peter Zijlstra,
	linux-sh, linux-trace-kernel, Geert Uytterhoeven

arch/sh/drivers/dma/dma-api.c:164:5: warning: no previous prototype for 'dmac_search_free_channel' [-Wmissing-prototypes]

dmac_search_free_channel() never had a user in upstream, remove it.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
dma_extend(), get_dma_info_by_name(), register_chan_caps(), and
request_dma_bycap() are also unused, but don't trigger warnings
---
 arch/sh/drivers/dma/dma-api.c | 27 ---------------------------
 1 file changed, 27 deletions(-)

diff --git a/arch/sh/drivers/dma/dma-api.c b/arch/sh/drivers/dma/dma-api.c
index 89cd4a3b4ccafbe2..f49097fa634c36d4 100644
--- a/arch/sh/drivers/dma/dma-api.c
+++ b/arch/sh/drivers/dma/dma-api.c
@@ -161,33 +161,6 @@ int request_dma_bycap(const char **dmac, const char **caps, const char *dev_id)
 }
 EXPORT_SYMBOL(request_dma_bycap);
 
-int dmac_search_free_channel(const char *dev_id)
-{
-	struct dma_channel *channel = { 0 };
-	struct dma_info *info = get_dma_info(0);
-	int i;
-
-	for (i = 0; i < info->nr_channels; i++) {
-		channel = &info->channels[i];
-		if (unlikely(!channel))
-			return -ENODEV;
-
-		if (atomic_read(&channel->busy) == 0)
-			break;
-	}
-
-	if (info->ops->request) {
-		int result = info->ops->request(channel);
-		if (result)
-			return result;
-
-		atomic_set(&channel->busy, 1);
-		return channel->chan;
-	}
-
-	return -ENOSYS;
-}
-
 int request_dma(unsigned int chan, const char *dev_id)
 {
 	struct dma_channel *channel = { 0 };
-- 
2.34.1


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

* [PATCH 13/20] sh: sh2a: Add missing #include <asm/processor.h>
  2024-03-01 21:02 [PATCH 00/20] sh: Fix missing prototypes Geert Uytterhoeven
                   ` (11 preceding siblings ...)
  2024-03-01 21:02 ` [PATCH 12/20] sh: dma: Remove unused dmac_search_free_channel() Geert Uytterhoeven
@ 2024-03-01 21:02 ` Geert Uytterhoeven
  2024-03-01 21:02 ` [PATCH 14/20] sh: sh7786: Remove unused sh7786_usb_use_exclock() Geert Uytterhoeven
                   ` (9 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Geert Uytterhoeven @ 2024-03-01 21:02 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz, Arnd Bergmann
  Cc: Steven Rostedt, Masami Hiramatsu, Mark Rutland, Will Deacon,
	Aneesh Kumar K . V, Andrew Morton, Nick Piggin, Peter Zijlstra,
	linux-sh, linux-trace-kernel, Geert Uytterhoeven

arch/sh/kernel/cpu/sh2a/opcode_helper.c:34:14: warning: no previous prototype for 'instruction_size' [-Wmissing-prototypes]

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/sh/kernel/cpu/sh2a/opcode_helper.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/sh/kernel/cpu/sh2a/opcode_helper.c b/arch/sh/kernel/cpu/sh2a/opcode_helper.c
index c509081d90b9affe..fcf53f5827eb286c 100644
--- a/arch/sh/kernel/cpu/sh2a/opcode_helper.c
+++ b/arch/sh/kernel/cpu/sh2a/opcode_helper.c
@@ -8,6 +8,8 @@
  */
 #include <linux/kernel.h>
 
+#include <asm/processor.h>
+
 /*
  * Instructions on SH are generally fixed at 16-bits, however, SH-2A
  * introduces some 32-bit instructions. Since there are no real
-- 
2.34.1


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

* [PATCH 14/20] sh: sh7786: Remove unused sh7786_usb_use_exclock()
  2024-03-01 21:02 [PATCH 00/20] sh: Fix missing prototypes Geert Uytterhoeven
                   ` (12 preceding siblings ...)
  2024-03-01 21:02 ` [PATCH 13/20] sh: sh2a: Add missing #include <asm/processor.h> Geert Uytterhoeven
@ 2024-03-01 21:02 ` Geert Uytterhoeven
  2024-03-01 21:02 ` [PATCH 15/20] sh: smp: Fix missing prototypes Geert Uytterhoeven
                   ` (8 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Geert Uytterhoeven @ 2024-03-01 21:02 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz, Arnd Bergmann
  Cc: Steven Rostedt, Masami Hiramatsu, Mark Rutland, Will Deacon,
	Aneesh Kumar K . V, Andrew Morton, Nick Piggin, Peter Zijlstra,
	linux-sh, linux-trace-kernel, Geert Uytterhoeven

arch/sh/kernel/cpu/sh4a/setup-sh7786.c:411:13: warning: no previous prototype for 'sh7786_usb_use_exclock' [-Wmissing-prototypes]

Upstream never had a user of sh7786_usb_use_exclock(), remove it.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/sh/kernel/cpu/sh4a/setup-sh7786.c | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
index 74620f30b19badbd..c048842d8a589866 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
@@ -400,20 +400,6 @@ static struct platform_device *sh7786_devices[] __initdata = {
 	&usb_ohci_device,
 };
 
-/*
- * Please call this function if your platform board
- * use external clock for USB
- * */
-#define USBCTL0		0xffe70858
-#define CLOCK_MODE_MASK 0xffffff7f
-#define EXT_CLOCK_MODE  0x00000080
-
-void __init sh7786_usb_use_exclock(void)
-{
-	u32 val = __raw_readl(USBCTL0) & CLOCK_MODE_MASK;
-	__raw_writel(val | EXT_CLOCK_MODE, USBCTL0);
-}
-
 #define USBINITREG1	0xffe70094
 #define USBINITREG2	0xffe7009c
 #define USBINITVAL1	0x00ff0040
-- 
2.34.1


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

* [PATCH 15/20] sh: smp: Fix missing prototypes
  2024-03-01 21:02 [PATCH 00/20] sh: Fix missing prototypes Geert Uytterhoeven
                   ` (13 preceding siblings ...)
  2024-03-01 21:02 ` [PATCH 14/20] sh: sh7786: Remove unused sh7786_usb_use_exclock() Geert Uytterhoeven
@ 2024-03-01 21:02 ` Geert Uytterhoeven
  2024-03-01 21:02 ` [PATCH 16/20] sh: kprobes: Merge arch_copy_kprobe() into arch_prepare_kprobe() Geert Uytterhoeven
                   ` (7 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Geert Uytterhoeven @ 2024-03-01 21:02 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz, Arnd Bergmann
  Cc: Steven Rostedt, Masami Hiramatsu, Mark Rutland, Will Deacon,
	Aneesh Kumar K . V, Andrew Morton, Nick Piggin, Peter Zijlstra,
	linux-sh, linux-trace-kernel, Geert Uytterhoeven

arch/sh/kernel/smp.c:173:17: warning: no previous prototype for 'start_secondary' [-Wmissing-prototypes]
arch/sh/kernel/smp.c:324:5: warning: no previous prototype for 'setup_profiling_timer' [-Wmissing-prototypes]

Make start_secondary() static, as it is only used in this file.
Include <linux/profile.h> to fix the other warning.

There are no users outside this file, so make it static.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/sh/kernel/smp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/sh/kernel/smp.c b/arch/sh/kernel/smp.c
index 5cf35a774dc70082..b3ea50aabba3d7f2 100644
--- a/arch/sh/kernel/smp.c
+++ b/arch/sh/kernel/smp.c
@@ -21,6 +21,8 @@
 #include <linux/sched/hotplug.h>
 #include <linux/atomic.h>
 #include <linux/clockchips.h>
+#include <linux/profile.h>
+
 #include <asm/processor.h>
 #include <asm/mmu_context.h>
 #include <asm/smp.h>
@@ -170,7 +172,7 @@ void native_play_dead(void)
 }
 #endif
 
-asmlinkage void start_secondary(void)
+static asmlinkage void start_secondary(void)
 {
 	unsigned int cpu = smp_processor_id();
 	struct mm_struct *mm = &init_mm;
-- 
2.34.1


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

* [PATCH 16/20] sh: kprobes: Merge arch_copy_kprobe() into arch_prepare_kprobe()
  2024-03-01 21:02 [PATCH 00/20] sh: Fix missing prototypes Geert Uytterhoeven
                   ` (14 preceding siblings ...)
  2024-03-01 21:02 ` [PATCH 15/20] sh: smp: Fix missing prototypes Geert Uytterhoeven
@ 2024-03-01 21:02 ` Geert Uytterhoeven
  2024-03-01 21:02 ` [PATCH 17/20] sh: kprobes: Make trampoline_probe_handler() static Geert Uytterhoeven
                   ` (6 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Geert Uytterhoeven @ 2024-03-01 21:02 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz, Arnd Bergmann
  Cc: Steven Rostedt, Masami Hiramatsu, Mark Rutland, Will Deacon,
	Aneesh Kumar K . V, Andrew Morton, Nick Piggin, Peter Zijlstra,
	linux-sh, linux-trace-kernel, Geert Uytterhoeven

arch/sh/kernel/kprobes.c:52:16: warning: no previous prototype for 'arch_copy_kprobe' [-Wmissing-prototypes]

Although SH kprobes support was only merged in v2.6.28, it missed the
earlier removal of the arch_copy_kprobe() callback in v2.6.15.

Based on the powerpc part of commit 49a2a1b83ba6fa40 ("[PATCH] kprobes:
changed from using spinlock to mutex").

Fixes: d39f5450146ff39f ("sh: Add kprobes support.")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Compile-tested only.
---
 arch/sh/kernel/kprobes.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/arch/sh/kernel/kprobes.c b/arch/sh/kernel/kprobes.c
index aed1ea8e2c2f063b..74051b8ddf3e7bf9 100644
--- a/arch/sh/kernel/kprobes.c
+++ b/arch/sh/kernel/kprobes.c
@@ -44,17 +44,12 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
 	if (OPCODE_RTE(opcode))
 		return -EFAULT;	/* Bad breakpoint */
 
+	memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t));
 	p->opcode = opcode;
 
 	return 0;
 }
 
-void __kprobes arch_copy_kprobe(struct kprobe *p)
-{
-	memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t));
-	p->opcode = *p->addr;
-}
-
 void __kprobes arch_arm_kprobe(struct kprobe *p)
 {
 	*p->addr = BREAKPOINT_INSTRUCTION;
-- 
2.34.1


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

* [PATCH 17/20] sh: kprobes: Make trampoline_probe_handler() static
  2024-03-01 21:02 [PATCH 00/20] sh: Fix missing prototypes Geert Uytterhoeven
                   ` (15 preceding siblings ...)
  2024-03-01 21:02 ` [PATCH 16/20] sh: kprobes: Merge arch_copy_kprobe() into arch_prepare_kprobe() Geert Uytterhoeven
@ 2024-03-01 21:02 ` Geert Uytterhoeven
  2024-03-01 21:02 ` [PATCH 18/20] sh: kprobes: Remove unneeded kprobe_opcode_t casts Geert Uytterhoeven
                   ` (5 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Geert Uytterhoeven @ 2024-03-01 21:02 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz, Arnd Bergmann
  Cc: Steven Rostedt, Masami Hiramatsu, Mark Rutland, Will Deacon,
	Aneesh Kumar K . V, Andrew Morton, Nick Piggin, Peter Zijlstra,
	linux-sh, linux-trace-kernel, Geert Uytterhoeven

arch/sh/kernel/kprobes.c:299:15: warning: no previous prototype for 'trampoline_probe_handler' [-Wmissing-prototypes]

There are no users outside this file, so make it static.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/sh/kernel/kprobes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sh/kernel/kprobes.c b/arch/sh/kernel/kprobes.c
index 74051b8ddf3e7bf9..d8c2e399d6e50794 100644
--- a/arch/sh/kernel/kprobes.c
+++ b/arch/sh/kernel/kprobes.c
@@ -296,7 +296,7 @@ static void __used kretprobe_trampoline_holder(void)
 /*
  * Called when we hit the probe point at __kretprobe_trampoline
  */
-int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
+static int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
 {
 	regs->pc = __kretprobe_trampoline_handler(regs, NULL);
 
-- 
2.34.1


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

* [PATCH 18/20] sh: kprobes: Remove unneeded kprobe_opcode_t casts
  2024-03-01 21:02 [PATCH 00/20] sh: Fix missing prototypes Geert Uytterhoeven
                   ` (16 preceding siblings ...)
  2024-03-01 21:02 ` [PATCH 17/20] sh: kprobes: Make trampoline_probe_handler() static Geert Uytterhoeven
@ 2024-03-01 21:02 ` Geert Uytterhoeven
  2024-03-01 21:02 ` [PATCH 19/20] sh: dwarf: Make dwarf_lookup_fde() static Geert Uytterhoeven
                   ` (4 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Geert Uytterhoeven @ 2024-03-01 21:02 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz, Arnd Bergmann
  Cc: Steven Rostedt, Masami Hiramatsu, Mark Rutland, Will Deacon,
	Aneesh Kumar K . V, Andrew Morton, Nick Piggin, Peter Zijlstra,
	linux-sh, linux-trace-kernel, Geert Uytterhoeven

There is no need to cast a kprobe_opcode_t pointer to a kprobe_opcode_t
pointer.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/sh/kernel/kprobes.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/sh/kernel/kprobes.c b/arch/sh/kernel/kprobes.c
index d8c2e399d6e50794..49c4ffd782d6d6c5 100644
--- a/arch/sh/kernel/kprobes.c
+++ b/arch/sh/kernel/kprobes.c
@@ -39,7 +39,7 @@ static DEFINE_PER_CPU(struct kprobe, saved_next_opcode2);
 
 int __kprobes arch_prepare_kprobe(struct kprobe *p)
 {
-	kprobe_opcode_t opcode = *(kprobe_opcode_t *) (p->addr);
+	kprobe_opcode_t opcode = *p->addr;
 
 	if (OPCODE_RTE(opcode))
 		return -EFAULT;	/* Bad breakpoint */
@@ -248,7 +248,7 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
 	p = get_kprobe(addr);
 	if (!p) {
 		/* Not one of ours: let kernel handle it */
-		if (*(kprobe_opcode_t *)addr != BREAKPOINT_INSTRUCTION) {
+		if (*addr != BREAKPOINT_INSTRUCTION) {
 			/*
 			 * The breakpoint instruction was removed right
 			 * after we hit it. Another cpu has removed
-- 
2.34.1


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

* [PATCH 19/20] sh: dwarf: Make dwarf_lookup_fde() static
  2024-03-01 21:02 [PATCH 00/20] sh: Fix missing prototypes Geert Uytterhoeven
                   ` (17 preceding siblings ...)
  2024-03-01 21:02 ` [PATCH 18/20] sh: kprobes: Remove unneeded kprobe_opcode_t casts Geert Uytterhoeven
@ 2024-03-01 21:02 ` Geert Uytterhoeven
  2024-03-01 21:02 ` [PATCH 20/20] [RFC] sh: dma: Remove unused functionality Geert Uytterhoeven
                   ` (3 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Geert Uytterhoeven @ 2024-03-01 21:02 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz, Arnd Bergmann
  Cc: Steven Rostedt, Masami Hiramatsu, Mark Rutland, Will Deacon,
	Aneesh Kumar K . V, Andrew Morton, Nick Piggin, Peter Zijlstra,
	linux-sh, linux-trace-kernel, Geert Uytterhoeven

arch/sh/kernel/dwarf.c:347:19: warning: no previous prototype for 'dwarf_lookup_fde' [-Wmissing-prototypes]

There are no users outside this file, so make it static.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/sh/kernel/dwarf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sh/kernel/dwarf.c b/arch/sh/kernel/dwarf.c
index bf8682e718303051..45c8ae20d10957db 100644
--- a/arch/sh/kernel/dwarf.c
+++ b/arch/sh/kernel/dwarf.c
@@ -344,7 +344,7 @@ static struct dwarf_cie *dwarf_lookup_cie(unsigned long cie_ptr)
  *	dwarf_lookup_fde - locate the FDE that covers pc
  *	@pc: the program counter
  */
-struct dwarf_fde *dwarf_lookup_fde(unsigned long pc)
+static struct dwarf_fde *dwarf_lookup_fde(unsigned long pc)
 {
 	struct rb_node **rb_node = &fde_root.rb_node;
 	struct dwarf_fde *fde = NULL;
-- 
2.34.1


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

* [PATCH 20/20] [RFC] sh: dma: Remove unused functionality
  2024-03-01 21:02 [PATCH 00/20] sh: Fix missing prototypes Geert Uytterhoeven
                   ` (18 preceding siblings ...)
  2024-03-01 21:02 ` [PATCH 19/20] sh: dwarf: Make dwarf_lookup_fde() static Geert Uytterhoeven
@ 2024-03-01 21:02 ` Geert Uytterhoeven
  2024-05-01  9:12   ` John Paul Adrian Glaubitz
  2024-04-24 12:05 ` [PATCH 00/20] sh: Fix missing prototypes Geert Uytterhoeven
                   ` (2 subsequent siblings)
  22 siblings, 1 reply; 31+ messages in thread
From: Geert Uytterhoeven @ 2024-03-01 21:02 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz, Arnd Bergmann
  Cc: Steven Rostedt, Masami Hiramatsu, Mark Rutland, Will Deacon,
	Aneesh Kumar K . V, Andrew Morton, Nick Piggin, Peter Zijlstra,
	linux-sh, linux-trace-kernel, Geert Uytterhoeven

dma_extend(), get_dma_info_by_name(), register_chan_caps(), and
request_dma_bycap() are unused.  Remove them, and all related code.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/sh/drivers/dma/dma-api.c | 116 ----------------------------------
 arch/sh/include/asm/dma.h     |   7 --
 2 files changed, 123 deletions(-)

diff --git a/arch/sh/drivers/dma/dma-api.c b/arch/sh/drivers/dma/dma-api.c
index f49097fa634c36d4..87e5a892887360f5 100644
--- a/arch/sh/drivers/dma/dma-api.c
+++ b/arch/sh/drivers/dma/dma-api.c
@@ -41,21 +41,6 @@ struct dma_info *get_dma_info(unsigned int chan)
 }
 EXPORT_SYMBOL(get_dma_info);
 
-struct dma_info *get_dma_info_by_name(const char *dmac_name)
-{
-	struct dma_info *info;
-
-	list_for_each_entry(info, &registered_dmac_list, list) {
-		if (dmac_name && (strcmp(dmac_name, info->name) != 0))
-			continue;
-		else
-			return info;
-	}
-
-	return NULL;
-}
-EXPORT_SYMBOL(get_dma_info_by_name);
-
 static unsigned int get_nr_channels(void)
 {
 	struct dma_info *info;
@@ -101,66 +86,6 @@ int get_dma_residue(unsigned int chan)
 }
 EXPORT_SYMBOL(get_dma_residue);
 
-static int search_cap(const char **haystack, const char *needle)
-{
-	const char **p;
-
-	for (p = haystack; *p; p++)
-		if (strcmp(*p, needle) == 0)
-			return 1;
-
-	return 0;
-}
-
-/**
- * request_dma_bycap - Allocate a DMA channel based on its capabilities
- * @dmac: List of DMA controllers to search
- * @caps: List of capabilities
- *
- * Search all channels of all DMA controllers to find a channel which
- * matches the requested capabilities. The result is the channel
- * number if a match is found, or %-ENODEV if no match is found.
- *
- * Note that not all DMA controllers export capabilities, in which
- * case they can never be allocated using this API, and so
- * request_dma() must be used specifying the channel number.
- */
-int request_dma_bycap(const char **dmac, const char **caps, const char *dev_id)
-{
-	unsigned int found = 0;
-	struct dma_info *info;
-	const char **p;
-	int i;
-
-	BUG_ON(!dmac || !caps);
-
-	list_for_each_entry(info, &registered_dmac_list, list)
-		if (strcmp(*dmac, info->name) == 0) {
-			found = 1;
-			break;
-		}
-
-	if (!found)
-		return -ENODEV;
-
-	for (i = 0; i < info->nr_channels; i++) {
-		struct dma_channel *channel = &info->channels[i];
-
-		if (unlikely(!channel->caps))
-			continue;
-
-		for (p = caps; *p; p++) {
-			if (!search_cap(channel->caps, *p))
-				break;
-			if (request_dma(channel->chan, dev_id) == 0)
-				return channel->chan;
-		}
-	}
-
-	return -EINVAL;
-}
-EXPORT_SYMBOL(request_dma_bycap);
-
 int request_dma(unsigned int chan, const char *dev_id)
 {
 	struct dma_channel *channel = { 0 };
@@ -213,35 +138,6 @@ void dma_wait_for_completion(unsigned int chan)
 }
 EXPORT_SYMBOL(dma_wait_for_completion);
 
-int register_chan_caps(const char *dmac, struct dma_chan_caps *caps)
-{
-	struct dma_info *info;
-	unsigned int found = 0;
-	int i;
-
-	list_for_each_entry(info, &registered_dmac_list, list)
-		if (strcmp(dmac, info->name) == 0) {
-			found = 1;
-			break;
-		}
-
-	if (unlikely(!found))
-		return -ENODEV;
-
-	for (i = 0; i < info->nr_channels; i++, caps++) {
-		struct dma_channel *channel;
-
-		if ((info->first_channel_nr + i) != caps->ch_num)
-			return -EINVAL;
-
-		channel = &info->channels[i];
-		channel->caps = caps->caplist;
-	}
-
-	return 0;
-}
-EXPORT_SYMBOL(register_chan_caps);
-
 void dma_configure_channel(unsigned int chan, unsigned long flags)
 {
 	struct dma_info *info = get_dma_info(chan);
@@ -267,18 +163,6 @@ int dma_xfer(unsigned int chan, unsigned long from,
 }
 EXPORT_SYMBOL(dma_xfer);
 
-int dma_extend(unsigned int chan, unsigned long op, void *param)
-{
-	struct dma_info *info = get_dma_info(chan);
-	struct dma_channel *channel = get_dma_channel(chan);
-
-	if (info->ops->extend)
-		return info->ops->extend(channel, op, param);
-
-	return -ENOSYS;
-}
-EXPORT_SYMBOL(dma_extend);
-
 static int dma_proc_show(struct seq_file *m, void *v)
 {
 	struct dma_info *info = v;
diff --git a/arch/sh/include/asm/dma.h b/arch/sh/include/asm/dma.h
index c8bee3f985a29393..6b6d409956d17f09 100644
--- a/arch/sh/include/asm/dma.h
+++ b/arch/sh/include/asm/dma.h
@@ -56,7 +56,6 @@ struct dma_ops {
 	int (*get_residue)(struct dma_channel *chan);
 	int (*xfer)(struct dma_channel *chan);
 	int (*configure)(struct dma_channel *chan, unsigned long flags);
-	int (*extend)(struct dma_channel *chan, unsigned long op, void *param);
 };
 
 struct dma_channel {
@@ -118,8 +117,6 @@ extern int dma_xfer(unsigned int chan, unsigned long from,
 #define dma_read_page(chan, from, to)	\
 	dma_read(chan, from, to, PAGE_SIZE)
 
-extern int request_dma_bycap(const char **dmac, const char **caps,
-			     const char *dev_id);
 extern int get_dma_residue(unsigned int chan);
 extern struct dma_info *get_dma_info(unsigned int chan);
 extern struct dma_channel *get_dma_channel(unsigned int chan);
@@ -128,10 +125,6 @@ extern void dma_configure_channel(unsigned int chan, unsigned long flags);
 
 extern int register_dmac(struct dma_info *info);
 extern void unregister_dmac(struct dma_info *info);
-extern struct dma_info *get_dma_info_by_name(const char *dmac_name);
-
-extern int dma_extend(unsigned int chan, unsigned long op, void *param);
-extern int register_chan_caps(const char *dmac, struct dma_chan_caps *capslist);
 
 /* arch/sh/drivers/dma/dma-sysfs.c */
 extern int dma_create_sysfs_files(struct dma_channel *, struct dma_info *);
-- 
2.34.1


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

* Re: [PATCH 08/20] sh: boot: Add proper forward declarations
  2024-03-01 21:02 ` [PATCH 08/20] sh: boot: Add proper forward declarations Geert Uytterhoeven
@ 2024-03-05  6:56   ` Yoshinori Sato
  0 siblings, 0 replies; 31+ messages in thread
From: Yoshinori Sato @ 2024-03-05  6:56 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rich Felker, John Paul Adrian Glaubitz, Arnd Bergmann,
	Steven Rostedt, Masami Hiramatsu, Mark Rutland, Will Deacon,
	Aneesh Kumar K . V, Andrew Morton, Nick Piggin, Peter Zijlstra,
	linux-sh, linux-trace-kernel

On Sat, 02 Mar 2024 06:02:22 +0900,
Geert Uytterhoeven wrote:
> 
> arch/sh/boot/compressed/cache.c:2:5: warning: no previous prototype for ‘cache_control’ [-Wmissing-prototypes]
> arch/sh/boot/compressed/misc.c:115:6: warning: no previous prototype for ‘ftrace_stub’ [-Wmissing-prototypes]
> arch/sh/boot/compressed/misc.c:118:6: warning: no previous prototype for ‘arch_ftrace_ops_list_func’ [-Wmissing-prototypes]
> arch/sh/boot/compressed/misc.c:128:6: warning: no previous prototype for ‘decompress_kernel’ [-Wmissing-prototypes]
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  arch/sh/boot/compressed/cache.c |  3 +++
>  arch/sh/boot/compressed/cache.h | 10 ++++++++++
>  arch/sh/boot/compressed/misc.c  |  8 +++-----
>  arch/sh/boot/compressed/misc.h  |  9 +++++++++
>  4 files changed, 25 insertions(+), 5 deletions(-)
>  create mode 100644 arch/sh/boot/compressed/cache.h
>  create mode 100644 arch/sh/boot/compressed/misc.h
> 
> diff --git a/arch/sh/boot/compressed/cache.c b/arch/sh/boot/compressed/cache.c
> index 31e04ff4841ed084..95c1e73ccbb7e011 100644
> --- a/arch/sh/boot/compressed/cache.c
> +++ b/arch/sh/boot/compressed/cache.c
> @@ -1,4 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0
> +
> +#include "cache.h"
> +
>  int cache_control(unsigned int command)
>  {
>  	volatile unsigned int *p = (volatile unsigned int *) 0x80000000;
> diff --git a/arch/sh/boot/compressed/cache.h b/arch/sh/boot/compressed/cache.h
> new file mode 100644
> index 0000000000000000..b622b68c87f59b97
> --- /dev/null
> +++ b/arch/sh/boot/compressed/cache.h
> @@ -0,0 +1,10 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef CACHE_H
> +#define CACHE_H
> +
> +#define CACHE_ENABLE	0
> +#define CACHE_DISABLE	1
> +
> +int cache_control(unsigned int command);
> +
> +#endif /* CACHE_H */
> diff --git a/arch/sh/boot/compressed/misc.c b/arch/sh/boot/compressed/misc.c
> index ca05c99a3d5b488d..5178150ca6650dcf 100644
> --- a/arch/sh/boot/compressed/misc.c
> +++ b/arch/sh/boot/compressed/misc.c
> @@ -16,6 +16,9 @@
>  #include <asm/addrspace.h>
>  #include <asm/page.h>
>  
> +#include "cache.h"
> +#include "misc.h"
> +
>  /*
>   * gzip declarations
>   */
> @@ -26,11 +29,6 @@
>  #undef memcpy
>  #define memzero(s, n)     memset ((s), 0, (n))
>  
> -/* cache.c */
> -#define CACHE_ENABLE      0
> -#define CACHE_DISABLE     1
> -int cache_control(unsigned int command);
> -
>  extern char input_data[];
>  extern int input_len;
>  static unsigned char *output;
> diff --git a/arch/sh/boot/compressed/misc.h b/arch/sh/boot/compressed/misc.h
> new file mode 100644
> index 0000000000000000..2b4534faa3052857
> --- /dev/null
> +++ b/arch/sh/boot/compressed/misc.h
> @@ -0,0 +1,9 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef MISC_H
> +#define MISC_H
> +
> +void arch_ftrace_ops_list_func(void);
> +void decompress_kernel(void);
> +void ftrace_stub(void);
> +
> +#endif /* MISC_H */
> -- 
> 2.34.1
> 
> 

This cache control is from SH5, so it is no longer needed.
I think it's better to simply delete chace.c and cache_control.

-- 
Yosinori Sato

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

* Re: [PATCH 00/20] sh: Fix missing prototypes
  2024-03-01 21:02 [PATCH 00/20] sh: Fix missing prototypes Geert Uytterhoeven
                   ` (19 preceding siblings ...)
  2024-03-01 21:02 ` [PATCH 20/20] [RFC] sh: dma: Remove unused functionality Geert Uytterhoeven
@ 2024-04-24 12:05 ` Geert Uytterhoeven
  2024-05-01  9:14 ` John Paul Adrian Glaubitz
  2024-05-02 10:26 ` John Paul Adrian Glaubitz
  22 siblings, 0 replies; 31+ messages in thread
From: Geert Uytterhoeven @ 2024-04-24 12:05 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz; +Cc: Linux-sh list

(reducing the audience)

On Fri, Mar 1, 2024 at 10:02 PM Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> This patch series fixes several "no previous prototype for <foo>"
> warnings when building a kernel for SuperH.

This series is still valid, except for [PATCH 08/20][1], which got a v2[2].
Please let me know if you want me to resend a v2 of the full series.

Thanks!

[1] "[PATCH 08/20] sh: boot: Add proper forward declarations"
    https://lore.kernel.org/r/2614d991c816ece903ef47c715bcc53881d34f3f.1709326528.git.geert+renesas@glider.be

[2] "[PATCH v2] sh: boot: Add proper forward declarations"
    https://lore.kernel.org/r/b7ea770a3bf26fb2a5f59f4bb83072b2526f7134.1713959841.git.geert+renesas@glider.be

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 12/20] sh: dma: Remove unused dmac_search_free_channel()
  2024-03-01 21:02 ` [PATCH 12/20] sh: dma: Remove unused dmac_search_free_channel() Geert Uytterhoeven
@ 2024-05-01  9:09   ` John Paul Adrian Glaubitz
  2024-05-02  7:00     ` Geert Uytterhoeven
  0 siblings, 1 reply; 31+ messages in thread
From: John Paul Adrian Glaubitz @ 2024-05-01  9:09 UTC (permalink / raw)
  To: Geert Uytterhoeven, Yoshinori Sato, Rich Felker, Arnd Bergmann
  Cc: Steven Rostedt, Masami Hiramatsu, Mark Rutland, Will Deacon,
	Aneesh Kumar K . V, Andrew Morton, Nick Piggin, Peter Zijlstra,
	linux-sh, linux-trace-kernel

Hi Geert,

On Fri, 2024-03-01 at 22:02 +0100, Geert Uytterhoeven wrote:
> arch/sh/drivers/dma/dma-api.c:164:5: warning: no previous prototype for 'dmac_search_free_channel' [-Wmissing-prototypes]
> 
> dmac_search_free_channel() never had a user in upstream, remove it.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> dma_extend(), get_dma_info_by_name(), register_chan_caps(), and
> request_dma_bycap() are also unused, but don't trigger warnings
> ---

I assume the other functions didn't trigger a warning because their symbols
were exported. Correct me if I'm wrong.

Adrian

>  arch/sh/drivers/dma/dma-api.c | 27 ---------------------------
>  1 file changed, 27 deletions(-)
> 
> diff --git a/arch/sh/drivers/dma/dma-api.c b/arch/sh/drivers/dma/dma-api.c
> index 89cd4a3b4ccafbe2..f49097fa634c36d4 100644
> --- a/arch/sh/drivers/dma/dma-api.c
> +++ b/arch/sh/drivers/dma/dma-api.c
> @@ -161,33 +161,6 @@ int request_dma_bycap(const char **dmac, const char **caps, const char *dev_id)
>  }
>  EXPORT_SYMBOL(request_dma_bycap);
>  
> -int dmac_search_free_channel(const char *dev_id)
> -{
> -	struct dma_channel *channel = { 0 };
> -	struct dma_info *info = get_dma_info(0);
> -	int i;
> -
> -	for (i = 0; i < info->nr_channels; i++) {
> -		channel = &info->channels[i];
> -		if (unlikely(!channel))
> -			return -ENODEV;
> -
> -		if (atomic_read(&channel->busy) == 0)
> -			break;
> -	}
> -
> -	if (info->ops->request) {
> -		int result = info->ops->request(channel);
> -		if (result)
> -			return result;
> -
> -		atomic_set(&channel->busy, 1);
> -		return channel->chan;
> -	}
> -
> -	return -ENOSYS;
> -}
> -
>  int request_dma(unsigned int chan, const char *dev_id)
>  {
>  	struct dma_channel *channel = { 0 };

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

* Re: [PATCH 20/20] [RFC] sh: dma: Remove unused functionality
  2024-03-01 21:02 ` [PATCH 20/20] [RFC] sh: dma: Remove unused functionality Geert Uytterhoeven
@ 2024-05-01  9:12   ` John Paul Adrian Glaubitz
  2024-05-01 13:58     ` John Paul Adrian Glaubitz
  0 siblings, 1 reply; 31+ messages in thread
From: John Paul Adrian Glaubitz @ 2024-05-01  9:12 UTC (permalink / raw)
  To: Geert Uytterhoeven, Yoshinori Sato, Rich Felker, Arnd Bergmann
  Cc: Steven Rostedt, Masami Hiramatsu, Mark Rutland, Will Deacon,
	Aneesh Kumar K . V, Andrew Morton, Nick Piggin, Peter Zijlstra,
	linux-sh, linux-trace-kernel

Hi Geert,

On Fri, 2024-03-01 at 22:02 +0100, Geert Uytterhoeven wrote:
> dma_extend(), get_dma_info_by_name(), register_chan_caps(), and
> request_dma_bycap() are unused.  Remove them, and all related code.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  arch/sh/drivers/dma/dma-api.c | 116 ----------------------------------
>  arch/sh/include/asm/dma.h     |   7 --
>  2 files changed, 123 deletions(-)
> 
> diff --git a/arch/sh/drivers/dma/dma-api.c b/arch/sh/drivers/dma/dma-api.c
> index f49097fa634c36d4..87e5a892887360f5 100644
> --- a/arch/sh/drivers/dma/dma-api.c
> +++ b/arch/sh/drivers/dma/dma-api.c
> @@ -41,21 +41,6 @@ struct dma_info *get_dma_info(unsigned int chan)
>  }
>  EXPORT_SYMBOL(get_dma_info);
>  
> -struct dma_info *get_dma_info_by_name(const char *dmac_name)
> -{
> -	struct dma_info *info;
> -
> -	list_for_each_entry(info, &registered_dmac_list, list) {
> -		if (dmac_name && (strcmp(dmac_name, info->name) != 0))
> -			continue;
> -		else
> -			return info;
> -	}
> -
> -	return NULL;
> -}
> -EXPORT_SYMBOL(get_dma_info_by_name);
> -
>  static unsigned int get_nr_channels(void)
>  {
>  	struct dma_info *info;
> @@ -101,66 +86,6 @@ int get_dma_residue(unsigned int chan)
>  }
>  EXPORT_SYMBOL(get_dma_residue);
>  
> -static int search_cap(const char **haystack, const char *needle)
> -{
> -	const char **p;
> -
> -	for (p = haystack; *p; p++)
> -		if (strcmp(*p, needle) == 0)
> -			return 1;
> -
> -	return 0;
> -}
> -
> -/**
> - * request_dma_bycap - Allocate a DMA channel based on its capabilities
> - * @dmac: List of DMA controllers to search
> - * @caps: List of capabilities
> - *
> - * Search all channels of all DMA controllers to find a channel which
> - * matches the requested capabilities. The result is the channel
> - * number if a match is found, or %-ENODEV if no match is found.
> - *
> - * Note that not all DMA controllers export capabilities, in which
> - * case they can never be allocated using this API, and so
> - * request_dma() must be used specifying the channel number.
> - */
> -int request_dma_bycap(const char **dmac, const char **caps, const char *dev_id)
> -{
> -	unsigned int found = 0;
> -	struct dma_info *info;
> -	const char **p;
> -	int i;
> -
> -	BUG_ON(!dmac || !caps);
> -
> -	list_for_each_entry(info, &registered_dmac_list, list)
> -		if (strcmp(*dmac, info->name) == 0) {
> -			found = 1;
> -			break;
> -		}
> -
> -	if (!found)
> -		return -ENODEV;
> -
> -	for (i = 0; i < info->nr_channels; i++) {
> -		struct dma_channel *channel = &info->channels[i];
> -
> -		if (unlikely(!channel->caps))
> -			continue;
> -
> -		for (p = caps; *p; p++) {
> -			if (!search_cap(channel->caps, *p))
> -				break;
> -			if (request_dma(channel->chan, dev_id) == 0)
> -				return channel->chan;
> -		}
> -	}
> -
> -	return -EINVAL;
> -}
> -EXPORT_SYMBOL(request_dma_bycap);
> -
>  int request_dma(unsigned int chan, const char *dev_id)
>  {
>  	struct dma_channel *channel = { 0 };
> @@ -213,35 +138,6 @@ void dma_wait_for_completion(unsigned int chan)
>  }
>  EXPORT_SYMBOL(dma_wait_for_completion);
>  
> -int register_chan_caps(const char *dmac, struct dma_chan_caps *caps)
> -{
> -	struct dma_info *info;
> -	unsigned int found = 0;
> -	int i;
> -
> -	list_for_each_entry(info, &registered_dmac_list, list)
> -		if (strcmp(dmac, info->name) == 0) {
> -			found = 1;
> -			break;
> -		}
> -
> -	if (unlikely(!found))
> -		return -ENODEV;
> -
> -	for (i = 0; i < info->nr_channels; i++, caps++) {
> -		struct dma_channel *channel;
> -
> -		if ((info->first_channel_nr + i) != caps->ch_num)
> -			return -EINVAL;
> -
> -		channel = &info->channels[i];
> -		channel->caps = caps->caplist;
> -	}
> -
> -	return 0;
> -}
> -EXPORT_SYMBOL(register_chan_caps);
> -
>  void dma_configure_channel(unsigned int chan, unsigned long flags)
>  {
>  	struct dma_info *info = get_dma_info(chan);
> @@ -267,18 +163,6 @@ int dma_xfer(unsigned int chan, unsigned long from,
>  }
>  EXPORT_SYMBOL(dma_xfer);
>  
> -int dma_extend(unsigned int chan, unsigned long op, void *param)
> -{
> -	struct dma_info *info = get_dma_info(chan);
> -	struct dma_channel *channel = get_dma_channel(chan);
> -
> -	if (info->ops->extend)
> -		return info->ops->extend(channel, op, param);
> -
> -	return -ENOSYS;
> -}
> -EXPORT_SYMBOL(dma_extend);
> -
>  static int dma_proc_show(struct seq_file *m, void *v)
>  {
>  	struct dma_info *info = v;
> diff --git a/arch/sh/include/asm/dma.h b/arch/sh/include/asm/dma.h
> index c8bee3f985a29393..6b6d409956d17f09 100644
> --- a/arch/sh/include/asm/dma.h
> +++ b/arch/sh/include/asm/dma.h
> @@ -56,7 +56,6 @@ struct dma_ops {
>  	int (*get_residue)(struct dma_channel *chan);
>  	int (*xfer)(struct dma_channel *chan);
>  	int (*configure)(struct dma_channel *chan, unsigned long flags);
> -	int (*extend)(struct dma_channel *chan, unsigned long op, void *param);
>  };
>  
>  struct dma_channel {
> @@ -118,8 +117,6 @@ extern int dma_xfer(unsigned int chan, unsigned long from,
>  #define dma_read_page(chan, from, to)	\
>  	dma_read(chan, from, to, PAGE_SIZE)
>  
> -extern int request_dma_bycap(const char **dmac, const char **caps,
> -			     const char *dev_id);
>  extern int get_dma_residue(unsigned int chan);
>  extern struct dma_info *get_dma_info(unsigned int chan);
>  extern struct dma_channel *get_dma_channel(unsigned int chan);
> @@ -128,10 +125,6 @@ extern void dma_configure_channel(unsigned int chan, unsigned long flags);
>  
>  extern int register_dmac(struct dma_info *info);
>  extern void unregister_dmac(struct dma_info *info);
> -extern struct dma_info *get_dma_info_by_name(const char *dmac_name);
> -
> -extern int dma_extend(unsigned int chan, unsigned long op, void *param);
> -extern int register_chan_caps(const char *dmac, struct dma_chan_caps *capslist);
>  
>  /* arch/sh/drivers/dma/dma-sysfs.c */
>  extern int dma_create_sysfs_files(struct dma_channel *, struct dma_info *);

I assume we could re-add these again in case we need them, but it would be good
if Yoshinori could comment on whether we should keep these functions or not.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

* Re: [PATCH 00/20] sh: Fix missing prototypes
  2024-03-01 21:02 [PATCH 00/20] sh: Fix missing prototypes Geert Uytterhoeven
                   ` (20 preceding siblings ...)
  2024-04-24 12:05 ` [PATCH 00/20] sh: Fix missing prototypes Geert Uytterhoeven
@ 2024-05-01  9:14 ` John Paul Adrian Glaubitz
  2024-05-02 10:26 ` John Paul Adrian Glaubitz
  22 siblings, 0 replies; 31+ messages in thread
From: John Paul Adrian Glaubitz @ 2024-05-01  9:14 UTC (permalink / raw)
  To: Geert Uytterhoeven, Yoshinori Sato, Rich Felker, Arnd Bergmann
  Cc: Steven Rostedt, Masami Hiramatsu, Mark Rutland, Will Deacon,
	Aneesh Kumar K . V, Andrew Morton, Nick Piggin, Peter Zijlstra,
	linux-sh, linux-trace-kernel

Hi Geert,

On Fri, 2024-03-01 at 22:02 +0100, Geert Uytterhoeven wrote:
> 	Hi all,
> 
> This patch series fixes several "no previous prototype for <foo>"
> warnings when building a kernel for SuperH.
> 
> Known issues:
>   - The various warnings about cache functions are not yet fixed, but
>     I didn't want to hold off the rest of this series,
>   - sdk7786_defconfig needs "[PATCH/RFC] locking/spinlocks: Make __raw_*
>     lock ops static" [1],
>   - Probably there are more warnings to fix, I didn't build all
>     defconfigs.
> 
> This has been boot-tested on landisk and on qemu/rts7751r2d.
> 
> Thanks for your comments!
> 
> [1] https://lore.kernel.org/linux-sh/c395b02613572131568bc1fd1bc456d20d1a5426.1709325647.git.geert+renesas@glider.be
> 
> Geert Uytterhoeven (20):
>   sh: pgtable: Fix missing prototypes
>   sh: fpu: Add missing forward declarations
>   sh: syscall: Add missing forward declaration for sys_cacheflush()
>   sh: tlb: Add missing forward declaration for handle_tlbmiss()
>   sh: return_address: Add missing #include <asm/ftrace.h>
>   sh: traps: Add missing #include <asm/setup.h>
>   sh: hw_breakpoint: Add missing forward declaration for
>     arch_bp_generic_fields()
>   sh: boot: Add proper forward declarations
>   sh: ftrace: Fix missing prototypes
>   sh: nommu: Add missing #include <asm/cacheflush.h>
>   sh: math-emu: Add missing #include <asm/fpu.h>
>   sh: dma: Remove unused dmac_search_free_channel()
>   sh: sh2a: Add missing #include <asm/processor.h>
>   sh: sh7786: Remove unused sh7786_usb_use_exclock()
>   sh: smp: Fix missing prototypes
>   sh: kprobes: Merge arch_copy_kprobe() into arch_prepare_kprobe()
>   sh: kprobes: Make trampoline_probe_handler() static
>   sh: kprobes: Remove unneeded kprobe_opcode_t casts
>   sh: dwarf: Make dwarf_lookup_fde() static
>   [RFC] sh: dma: Remove unused functionality
> 
>  arch/sh/boot/compressed/cache.c         |   3 +
>  arch/sh/boot/compressed/cache.h         |  10 ++
>  arch/sh/boot/compressed/misc.c          |   8 +-
>  arch/sh/boot/compressed/misc.h          |   9 ++
>  arch/sh/drivers/dma/dma-api.c           | 143 ------------------------
>  arch/sh/include/asm/dma.h               |   7 --
>  arch/sh/include/asm/fpu.h               |   3 +
>  arch/sh/include/asm/ftrace.h            |  10 ++
>  arch/sh/include/asm/hw_breakpoint.h     |   2 +
>  arch/sh/include/asm/syscalls.h          |   1 +
>  arch/sh/include/asm/tlb.h               |   4 +
>  arch/sh/kernel/cpu/sh2a/opcode_helper.c |   2 +
>  arch/sh/kernel/cpu/sh4a/setup-sh7786.c  |  14 ---
>  arch/sh/kernel/dwarf.c                  |   2 +-
>  arch/sh/kernel/kprobes.c                |  13 +--
>  arch/sh/kernel/return_address.c         |   2 +
>  arch/sh/kernel/smp.c                    |   4 +-
>  arch/sh/kernel/traps.c                  |  10 +-
>  arch/sh/kernel/traps_32.c               |   1 +
>  arch/sh/math-emu/math.c                 |   2 +
>  arch/sh/mm/nommu.c                      |   2 +
>  arch/sh/mm/pgtable.c                    |   4 +-
>  arch/sh/mm/tlbex_32.c                   |   1 +
>  23 files changed, 68 insertions(+), 189 deletions(-)
>  create mode 100644 arch/sh/boot/compressed/cache.h
>  create mode 100644 arch/sh/boot/compressed/misc.h
> 

For the whole series:

Reviewed-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>

I would still like to get feedback from Yoshinori on patch #20 though, i.e.

	"sh: dma: Remove unused functionality".

On the other hand, we could just merge this series and re-add the functions
later if we decide they're still needed.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

* Re: [PATCH 20/20] [RFC] sh: dma: Remove unused functionality
  2024-05-01  9:12   ` John Paul Adrian Glaubitz
@ 2024-05-01 13:58     ` John Paul Adrian Glaubitz
  2024-05-02  7:03       ` Geert Uytterhoeven
  0 siblings, 1 reply; 31+ messages in thread
From: John Paul Adrian Glaubitz @ 2024-05-01 13:58 UTC (permalink / raw)
  To: Geert Uytterhoeven, Yoshinori Sato, Rich Felker, Arnd Bergmann
  Cc: Steven Rostedt, Masami Hiramatsu, Mark Rutland, Will Deacon,
	Aneesh Kumar K . V, Andrew Morton, Nick Piggin, Peter Zijlstra,
	linux-sh, linux-trace-kernel

Hi Geert,

On Wed, 2024-05-01 at 11:12 +0200, John Paul Adrian Glaubitz wrote:
> Hi Geert,
> 
> On Fri, 2024-03-01 at 22:02 +0100, Geert Uytterhoeven wrote:
> > dma_extend(), get_dma_info_by_name(), register_chan_caps(), and
> > request_dma_bycap() are unused.  Remove them, and all related code.
> > 
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > ---
> >  arch/sh/drivers/dma/dma-api.c | 116 ----------------------------------
> >  arch/sh/include/asm/dma.h     |   7 --
> >  2 files changed, 123 deletions(-)
> > 
> > diff --git a/arch/sh/drivers/dma/dma-api.c b/arch/sh/drivers/dma/dma-api.c
> > index f49097fa634c36d4..87e5a892887360f5 100644
> > --- a/arch/sh/drivers/dma/dma-api.c
> > +++ b/arch/sh/drivers/dma/dma-api.c
> > @@ -41,21 +41,6 @@ struct dma_info *get_dma_info(unsigned int chan)
> >  }
> >  EXPORT_SYMBOL(get_dma_info);
> >  
> > -struct dma_info *get_dma_info_by_name(const char *dmac_name)
> > -{
> > -	struct dma_info *info;
> > -
> > -	list_for_each_entry(info, &registered_dmac_list, list) {
> > -		if (dmac_name && (strcmp(dmac_name, info->name) != 0))
> > -			continue;
> > -		else
> > -			return info;
> > -	}
> > -
> > -	return NULL;
> > -}
> > -EXPORT_SYMBOL(get_dma_info_by_name);
> > -
> >  static unsigned int get_nr_channels(void)
> >  {
> >  	struct dma_info *info;
> > @@ -101,66 +86,6 @@ int get_dma_residue(unsigned int chan)
> >  }
> >  EXPORT_SYMBOL(get_dma_residue);
> >  
> > -static int search_cap(const char **haystack, const char *needle)
> > -{
> > -	const char **p;
> > -
> > -	for (p = haystack; *p; p++)
> > -		if (strcmp(*p, needle) == 0)
> > -			return 1;
> > -
> > -	return 0;
> > -}
> > -
> > -/**
> > - * request_dma_bycap - Allocate a DMA channel based on its capabilities
> > - * @dmac: List of DMA controllers to search
> > - * @caps: List of capabilities
> > - *
> > - * Search all channels of all DMA controllers to find a channel which
> > - * matches the requested capabilities. The result is the channel
> > - * number if a match is found, or %-ENODEV if no match is found.
> > - *
> > - * Note that not all DMA controllers export capabilities, in which
> > - * case they can never be allocated using this API, and so
> > - * request_dma() must be used specifying the channel number.
> > - */
> > -int request_dma_bycap(const char **dmac, const char **caps, const char *dev_id)
> > -{
> > -	unsigned int found = 0;
> > -	struct dma_info *info;
> > -	const char **p;
> > -	int i;
> > -
> > -	BUG_ON(!dmac || !caps);
> > -
> > -	list_for_each_entry(info, &registered_dmac_list, list)
> > -		if (strcmp(*dmac, info->name) == 0) {
> > -			found = 1;
> > -			break;
> > -		}
> > -
> > -	if (!found)
> > -		return -ENODEV;
> > -
> > -	for (i = 0; i < info->nr_channels; i++) {
> > -		struct dma_channel *channel = &info->channels[i];
> > -
> > -		if (unlikely(!channel->caps))
> > -			continue;
> > -
> > -		for (p = caps; *p; p++) {
> > -			if (!search_cap(channel->caps, *p))
> > -				break;
> > -			if (request_dma(channel->chan, dev_id) == 0)
> > -				return channel->chan;
> > -		}
> > -	}
> > -
> > -	return -EINVAL;
> > -}
> > -EXPORT_SYMBOL(request_dma_bycap);
> > -
> >  int request_dma(unsigned int chan, const char *dev_id)
> >  {
> >  	struct dma_channel *channel = { 0 };
> > @@ -213,35 +138,6 @@ void dma_wait_for_completion(unsigned int chan)
> >  }
> >  EXPORT_SYMBOL(dma_wait_for_completion);
> >  
> > -int register_chan_caps(const char *dmac, struct dma_chan_caps *caps)
> > -{
> > -	struct dma_info *info;
> > -	unsigned int found = 0;
> > -	int i;
> > -
> > -	list_for_each_entry(info, &registered_dmac_list, list)
> > -		if (strcmp(dmac, info->name) == 0) {
> > -			found = 1;
> > -			break;
> > -		}
> > -
> > -	if (unlikely(!found))
> > -		return -ENODEV;
> > -
> > -	for (i = 0; i < info->nr_channels; i++, caps++) {
> > -		struct dma_channel *channel;
> > -
> > -		if ((info->first_channel_nr + i) != caps->ch_num)
> > -			return -EINVAL;
> > -
> > -		channel = &info->channels[i];
> > -		channel->caps = caps->caplist;
> > -	}
> > -
> > -	return 0;
> > -}
> > -EXPORT_SYMBOL(register_chan_caps);
> > -
> >  void dma_configure_channel(unsigned int chan, unsigned long flags)
> >  {
> >  	struct dma_info *info = get_dma_info(chan);
> > @@ -267,18 +163,6 @@ int dma_xfer(unsigned int chan, unsigned long from,
> >  }
> >  EXPORT_SYMBOL(dma_xfer);
> >  
> > -int dma_extend(unsigned int chan, unsigned long op, void *param)
> > -{
> > -	struct dma_info *info = get_dma_info(chan);
> > -	struct dma_channel *channel = get_dma_channel(chan);
> > -
> > -	if (info->ops->extend)
> > -		return info->ops->extend(channel, op, param);
> > -
> > -	return -ENOSYS;
> > -}
> > -EXPORT_SYMBOL(dma_extend);
> > -
> >  static int dma_proc_show(struct seq_file *m, void *v)
> >  {
> >  	struct dma_info *info = v;
> > diff --git a/arch/sh/include/asm/dma.h b/arch/sh/include/asm/dma.h
> > index c8bee3f985a29393..6b6d409956d17f09 100644
> > --- a/arch/sh/include/asm/dma.h
> > +++ b/arch/sh/include/asm/dma.h
> > @@ -56,7 +56,6 @@ struct dma_ops {
> >  	int (*get_residue)(struct dma_channel *chan);
> >  	int (*xfer)(struct dma_channel *chan);
> >  	int (*configure)(struct dma_channel *chan, unsigned long flags);
> > -	int (*extend)(struct dma_channel *chan, unsigned long op, void *param);
> >  };
> >  
> >  struct dma_channel {
> > @@ -118,8 +117,6 @@ extern int dma_xfer(unsigned int chan, unsigned long from,
> >  #define dma_read_page(chan, from, to)	\
> >  	dma_read(chan, from, to, PAGE_SIZE)
> >  
> > -extern int request_dma_bycap(const char **dmac, const char **caps,
> > -			     const char *dev_id);
> >  extern int get_dma_residue(unsigned int chan);
> >  extern struct dma_info *get_dma_info(unsigned int chan);
> >  extern struct dma_channel *get_dma_channel(unsigned int chan);
> > @@ -128,10 +125,6 @@ extern void dma_configure_channel(unsigned int chan, unsigned long flags);
> >  
> >  extern int register_dmac(struct dma_info *info);
> >  extern void unregister_dmac(struct dma_info *info);
> > -extern struct dma_info *get_dma_info_by_name(const char *dmac_name);
> > -
> > -extern int dma_extend(unsigned int chan, unsigned long op, void *param);
> > -extern int register_chan_caps(const char *dmac, struct dma_chan_caps *capslist);
> >  
> >  /* arch/sh/drivers/dma/dma-sysfs.c */
> >  extern int dma_create_sysfs_files(struct dma_channel *, struct dma_info *);
> 
> I assume we could re-add these again in case we need them, but it would be good
> if Yoshinori could comment on whether we should keep these functions or not.

I was wondering: Could there be any userland tools using these DMA functions?

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

* Re: [PATCH 12/20] sh: dma: Remove unused dmac_search_free_channel()
  2024-05-01  9:09   ` John Paul Adrian Glaubitz
@ 2024-05-02  7:00     ` Geert Uytterhoeven
  0 siblings, 0 replies; 31+ messages in thread
From: Geert Uytterhoeven @ 2024-05-02  7:00 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz
  Cc: Geert Uytterhoeven, Yoshinori Sato, Rich Felker, Arnd Bergmann,
	Steven Rostedt, Masami Hiramatsu, Mark Rutland, Will Deacon,
	Aneesh Kumar K . V, Andrew Morton, Nick Piggin, Peter Zijlstra,
	linux-sh, linux-trace-kernel

Hi Adrian,

On Wed, May 1, 2024 at 11:09 AM John Paul Adrian Glaubitz
<glaubitz@physik.fu-berlin.de> wrote:
> On Fri, 2024-03-01 at 22:02 +0100, Geert Uytterhoeven wrote:
> > arch/sh/drivers/dma/dma-api.c:164:5: warning: no previous prototype for 'dmac_search_free_channel' [-Wmissing-prototypes]
> >
> > dmac_search_free_channel() never had a user in upstream, remove it.
> >
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > ---
> > dma_extend(), get_dma_info_by_name(), register_chan_caps(), and
> > request_dma_bycap() are also unused, but don't trigger warnings
> > ---
>
> I assume the other functions didn't trigger a warning because their symbols
> were exported. Correct me if I'm wrong.

No, because they have a forward declaration in arch/sh/include/asm/dma.h.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 20/20] [RFC] sh: dma: Remove unused functionality
  2024-05-01 13:58     ` John Paul Adrian Glaubitz
@ 2024-05-02  7:03       ` Geert Uytterhoeven
  2024-05-02  7:08         ` John Paul Adrian Glaubitz
  0 siblings, 1 reply; 31+ messages in thread
From: Geert Uytterhoeven @ 2024-05-02  7:03 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz
  Cc: Yoshinori Sato, Rich Felker, Arnd Bergmann, Steven Rostedt,
	Masami Hiramatsu, Mark Rutland, Will Deacon, Aneesh Kumar K . V,
	Andrew Morton, Nick Piggin, Peter Zijlstra, linux-sh,
	linux-trace-kernel

Hi Adrian,

On Wed, May 1, 2024 at 3:58 PM John Paul Adrian Glaubitz
<glaubitz@physik.fu-berlin.de> wrote:
> On Wed, 2024-05-01 at 11:12 +0200, John Paul Adrian Glaubitz wrote:
> > On Fri, 2024-03-01 at 22:02 +0100, Geert Uytterhoeven wrote:
> > > dma_extend(), get_dma_info_by_name(), register_chan_caps(), and
> > > request_dma_bycap() are unused.  Remove them, and all related code.
> > >
> > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

> > I assume we could re-add these again in case we need them, but it would be good
> > if Yoshinori could comment on whether we should keep these functions or not.
>
> I was wondering: Could there be any userland tools using these DMA functions?

They cannot be called from userspace, as there is no API for that.
They can only be called from inside the kernel, or from a kernel module
(possibly out-of-tree).

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 20/20] [RFC] sh: dma: Remove unused functionality
  2024-05-02  7:03       ` Geert Uytterhoeven
@ 2024-05-02  7:08         ` John Paul Adrian Glaubitz
  0 siblings, 0 replies; 31+ messages in thread
From: John Paul Adrian Glaubitz @ 2024-05-02  7:08 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Yoshinori Sato, Rich Felker, Arnd Bergmann, Steven Rostedt,
	Masami Hiramatsu, Mark Rutland, Will Deacon, Aneesh Kumar K . V,
	Andrew Morton, Nick Piggin, Peter Zijlstra, linux-sh,
	linux-trace-kernel

Hi Geert,

On Thu, 2024-05-02 at 09:03 +0200, Geert Uytterhoeven wrote:
> On Wed, May 1, 2024 at 3:58 PM John Paul Adrian Glaubitz
> <glaubitz@physik.fu-berlin.de> wrote:
> > On Wed, 2024-05-01 at 11:12 +0200, John Paul Adrian Glaubitz wrote:
> > > On Fri, 2024-03-01 at 22:02 +0100, Geert Uytterhoeven wrote:
> > > > dma_extend(), get_dma_info_by_name(), register_chan_caps(), and
> > > > request_dma_bycap() are unused.  Remove them, and all related code.
> > > > 
> > > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> 
> > > I assume we could re-add these again in case we need them, but it would be good
> > > if Yoshinori could comment on whether we should keep these functions or not.
> > 
> > I was wondering: Could there be any userland tools using these DMA functions?
> 
> They cannot be called from userspace, as there is no API for that.
> They can only be called from inside the kernel, or from a kernel module
> (possibly out-of-tree).

OK, thanks for the confirmation. Then I think it's safe to remove them.

I will apply both your series tonight and the rest of the patches except
for the one that moves the paging_init() around as it turns out the current
positioning is intentional.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

* Re: [PATCH 00/20] sh: Fix missing prototypes
  2024-03-01 21:02 [PATCH 00/20] sh: Fix missing prototypes Geert Uytterhoeven
                   ` (21 preceding siblings ...)
  2024-05-01  9:14 ` John Paul Adrian Glaubitz
@ 2024-05-02 10:26 ` John Paul Adrian Glaubitz
  22 siblings, 0 replies; 31+ messages in thread
From: John Paul Adrian Glaubitz @ 2024-05-02 10:26 UTC (permalink / raw)
  To: Geert Uytterhoeven, Yoshinori Sato, Rich Felker, Arnd Bergmann
  Cc: Steven Rostedt, Masami Hiramatsu, Mark Rutland, Will Deacon,
	Aneesh Kumar K . V, Andrew Morton, Nick Piggin, Peter Zijlstra,
	linux-sh, linux-trace-kernel

On Fri, 2024-03-01 at 22:02 +0100, Geert Uytterhoeven wrote:
> 	Hi all,
> 
> This patch series fixes several "no previous prototype for <foo>"
> warnings when building a kernel for SuperH.
> 
> Known issues:
>   - The various warnings about cache functions are not yet fixed, but
>     I didn't want to hold off the rest of this series,
>   - sdk7786_defconfig needs "[PATCH/RFC] locking/spinlocks: Make __raw_*
>     lock ops static" [1],
>   - Probably there are more warnings to fix, I didn't build all
>     defconfigs.
> 
> This has been boot-tested on landisk and on qemu/rts7751r2d.
> 
> Thanks for your comments!
> 
> [1] https://lore.kernel.org/linux-sh/c395b02613572131568bc1fd1bc456d20d1a5426.1709325647.git.geert+renesas@glider.be
> 
> Geert Uytterhoeven (20):
>   sh: pgtable: Fix missing prototypes
>   sh: fpu: Add missing forward declarations
>   sh: syscall: Add missing forward declaration for sys_cacheflush()
>   sh: tlb: Add missing forward declaration for handle_tlbmiss()
>   sh: return_address: Add missing #include <asm/ftrace.h>
>   sh: traps: Add missing #include <asm/setup.h>
>   sh: hw_breakpoint: Add missing forward declaration for
>     arch_bp_generic_fields()
>   sh: boot: Add proper forward declarations
>   sh: ftrace: Fix missing prototypes
>   sh: nommu: Add missing #include <asm/cacheflush.h>
>   sh: math-emu: Add missing #include <asm/fpu.h>
>   sh: dma: Remove unused dmac_search_free_channel()
>   sh: sh2a: Add missing #include <asm/processor.h>
>   sh: sh7786: Remove unused sh7786_usb_use_exclock()
>   sh: smp: Fix missing prototypes
>   sh: kprobes: Merge arch_copy_kprobe() into arch_prepare_kprobe()
>   sh: kprobes: Make trampoline_probe_handler() static
>   sh: kprobes: Remove unneeded kprobe_opcode_t casts
>   sh: dwarf: Make dwarf_lookup_fde() static
>   [RFC] sh: dma: Remove unused functionality
> 
>  arch/sh/boot/compressed/cache.c         |   3 +
>  arch/sh/boot/compressed/cache.h         |  10 ++
>  arch/sh/boot/compressed/misc.c          |   8 +-
>  arch/sh/boot/compressed/misc.h          |   9 ++
>  arch/sh/drivers/dma/dma-api.c           | 143 ------------------------
>  arch/sh/include/asm/dma.h               |   7 --
>  arch/sh/include/asm/fpu.h               |   3 +
>  arch/sh/include/asm/ftrace.h            |  10 ++
>  arch/sh/include/asm/hw_breakpoint.h     |   2 +
>  arch/sh/include/asm/syscalls.h          |   1 +
>  arch/sh/include/asm/tlb.h               |   4 +
>  arch/sh/kernel/cpu/sh2a/opcode_helper.c |   2 +
>  arch/sh/kernel/cpu/sh4a/setup-sh7786.c  |  14 ---
>  arch/sh/kernel/dwarf.c                  |   2 +-
>  arch/sh/kernel/kprobes.c                |  13 +--
>  arch/sh/kernel/return_address.c         |   2 +
>  arch/sh/kernel/smp.c                    |   4 +-
>  arch/sh/kernel/traps.c                  |  10 +-
>  arch/sh/kernel/traps_32.c               |   1 +
>  arch/sh/math-emu/math.c                 |   2 +
>  arch/sh/mm/nommu.c                      |   2 +
>  arch/sh/mm/pgtable.c                    |   4 +-
>  arch/sh/mm/tlbex_32.c                   |   1 +
>  23 files changed, 68 insertions(+), 189 deletions(-)
>  create mode 100644 arch/sh/boot/compressed/cache.h
>  create mode 100644 arch/sh/boot/compressed/misc.h

Applied to my sh-linux tree in the for-next branch.

Thanks,
Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

end of thread, other threads:[~2024-05-02 10:26 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-01 21:02 [PATCH 00/20] sh: Fix missing prototypes Geert Uytterhoeven
2024-03-01 21:02 ` [PATCH 01/20] sh: pgtable: " Geert Uytterhoeven
2024-03-01 21:02 ` [PATCH 02/20] sh: fpu: Add missing forward declarations Geert Uytterhoeven
2024-03-01 21:02 ` [PATCH 03/20] sh: syscall: Add missing forward declaration for sys_cacheflush() Geert Uytterhoeven
2024-03-01 21:02 ` [PATCH 04/20] sh: tlb: Add missing forward declaration for handle_tlbmiss() Geert Uytterhoeven
2024-03-01 21:02 ` [PATCH 05/20] sh: return_address: Add missing #include <asm/ftrace.h> Geert Uytterhoeven
2024-03-01 21:02 ` [PATCH 06/20] sh: traps: Add missing #include <asm/setup.h> Geert Uytterhoeven
2024-03-01 21:02 ` [PATCH 07/20] sh: hw_breakpoint: Add missing forward declaration for arch_bp_generic_fields() Geert Uytterhoeven
2024-03-01 21:02 ` [PATCH 08/20] sh: boot: Add proper forward declarations Geert Uytterhoeven
2024-03-05  6:56   ` Yoshinori Sato
2024-03-01 21:02 ` [PATCH 09/20] sh: ftrace: Fix missing prototypes Geert Uytterhoeven
2024-03-01 21:02 ` [PATCH 10/20] sh: nommu: Add missing #include <asm/cacheflush.h> Geert Uytterhoeven
2024-03-01 21:02 ` [PATCH 11/20] sh: math-emu: Add missing #include <asm/fpu.h> Geert Uytterhoeven
2024-03-01 21:02 ` [PATCH 12/20] sh: dma: Remove unused dmac_search_free_channel() Geert Uytterhoeven
2024-05-01  9:09   ` John Paul Adrian Glaubitz
2024-05-02  7:00     ` Geert Uytterhoeven
2024-03-01 21:02 ` [PATCH 13/20] sh: sh2a: Add missing #include <asm/processor.h> Geert Uytterhoeven
2024-03-01 21:02 ` [PATCH 14/20] sh: sh7786: Remove unused sh7786_usb_use_exclock() Geert Uytterhoeven
2024-03-01 21:02 ` [PATCH 15/20] sh: smp: Fix missing prototypes Geert Uytterhoeven
2024-03-01 21:02 ` [PATCH 16/20] sh: kprobes: Merge arch_copy_kprobe() into arch_prepare_kprobe() Geert Uytterhoeven
2024-03-01 21:02 ` [PATCH 17/20] sh: kprobes: Make trampoline_probe_handler() static Geert Uytterhoeven
2024-03-01 21:02 ` [PATCH 18/20] sh: kprobes: Remove unneeded kprobe_opcode_t casts Geert Uytterhoeven
2024-03-01 21:02 ` [PATCH 19/20] sh: dwarf: Make dwarf_lookup_fde() static Geert Uytterhoeven
2024-03-01 21:02 ` [PATCH 20/20] [RFC] sh: dma: Remove unused functionality Geert Uytterhoeven
2024-05-01  9:12   ` John Paul Adrian Glaubitz
2024-05-01 13:58     ` John Paul Adrian Glaubitz
2024-05-02  7:03       ` Geert Uytterhoeven
2024-05-02  7:08         ` John Paul Adrian Glaubitz
2024-04-24 12:05 ` [PATCH 00/20] sh: Fix missing prototypes Geert Uytterhoeven
2024-05-01  9:14 ` John Paul Adrian Glaubitz
2024-05-02 10:26 ` John Paul Adrian Glaubitz

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