diff mbox series

[v2,2/3] RISC-V: pi: Add kernel/pi/pi.h

Message ID 20240626171652.366415-2-jesse@rivosinc.com (mailing list archive)
State Changes Requested
Headers show
Series [v2,1/3] RISC-V: pi: Force hidden visibility for all symbol references | expand

Checks

Context Check Description
conchuod/vmtest-for-next-PR fail PR summary
conchuod/patch-2-test-1 success .github/scripts/patches/tests/build_rv32_defconfig.sh
conchuod/patch-2-test-2 success .github/scripts/patches/tests/build_rv64_clang_allmodconfig.sh
conchuod/patch-2-test-3 success .github/scripts/patches/tests/build_rv64_gcc_allmodconfig.sh
conchuod/patch-2-test-4 success .github/scripts/patches/tests/build_rv64_nommu_k210_defconfig.sh
conchuod/patch-2-test-5 success .github/scripts/patches/tests/build_rv64_nommu_virt_defconfig.sh
conchuod/patch-2-test-6 warning .github/scripts/patches/tests/checkpatch.sh
conchuod/patch-2-test-7 success .github/scripts/patches/tests/dtb_warn_rv64.sh
conchuod/patch-2-test-8 success .github/scripts/patches/tests/header_inline.sh
conchuod/patch-2-test-9 success .github/scripts/patches/tests/kdoc.sh
conchuod/patch-2-test-10 success .github/scripts/patches/tests/module_param.sh
conchuod/patch-2-test-11 success .github/scripts/patches/tests/verify_fixes.sh
conchuod/patch-2-test-12 success .github/scripts/patches/tests/verify_signedoff.sh

Commit Message

Jesse Taube June 26, 2024, 5:16 p.m. UTC
Add pi.h header for declarations of the kernel/pi prefixed functions
and any other related declarations.

Signed-off-by: Jesse Taube <jesse@rivosinc.com>
---
 arch/riscv/kernel/pi/cmdline_early.c | 10 ++--------
 arch/riscv/kernel/pi/fdt_early.c     |  7 +------
 arch/riscv/kernel/pi/pi.h            | 17 +++++++++++++++++
 3 files changed, 20 insertions(+), 14 deletions(-)
 create mode 100644 arch/riscv/kernel/pi/pi.h

Comments

Alexandre Ghiti June 28, 2024, 9:18 a.m. UTC | #1
Hi Jesse,

On Wed, Jun 26, 2024 at 7:17 PM Jesse Taube <jesse@rivosinc.com> wrote:
>
> Add pi.h header for declarations of the kernel/pi prefixed functions
> and any other related declarations.
>
> Signed-off-by: Jesse Taube <jesse@rivosinc.com>
> ---
>  arch/riscv/kernel/pi/cmdline_early.c | 10 ++--------
>  arch/riscv/kernel/pi/fdt_early.c     |  7 +------
>  arch/riscv/kernel/pi/pi.h            | 17 +++++++++++++++++
>  3 files changed, 20 insertions(+), 14 deletions(-)
>  create mode 100644 arch/riscv/kernel/pi/pi.h
>
> diff --git a/arch/riscv/kernel/pi/cmdline_early.c b/arch/riscv/kernel/pi/cmdline_early.c
> index f6d4dedffb84..fbcdc9e4e143 100644
> --- a/arch/riscv/kernel/pi/cmdline_early.c
> +++ b/arch/riscv/kernel/pi/cmdline_early.c
> @@ -6,15 +6,9 @@
>  #include <asm/pgtable.h>
>  #include <asm/setup.h>
>
> -static char early_cmdline[COMMAND_LINE_SIZE];
> +#include "pi.h"
>
> -/*
> - * Declare the functions that are exported (but prefixed) here so that LLVM
> - * does not complain it lacks the 'static' keyword (which, if added, makes
> - * LLVM complain because the function is actually unused in this file).
> - */
> -u64 set_satp_mode_from_cmdline(uintptr_t dtb_pa);
> -bool set_nokaslr_from_cmdline(uintptr_t dtb_pa);
> +static char early_cmdline[COMMAND_LINE_SIZE];
>
>  static char *get_early_cmdline(uintptr_t dtb_pa)
>  {
> diff --git a/arch/riscv/kernel/pi/fdt_early.c b/arch/riscv/kernel/pi/fdt_early.c
> index 899610e042ab..40ee299702bf 100644
> --- a/arch/riscv/kernel/pi/fdt_early.c
> +++ b/arch/riscv/kernel/pi/fdt_early.c
> @@ -3,12 +3,7 @@
>  #include <linux/init.h>
>  #include <linux/libfdt.h>
>
> -/*
> - * Declare the functions that are exported (but prefixed) here so that LLVM
> - * does not complain it lacks the 'static' keyword (which, if added, makes
> - * LLVM complain because the function is actually unused in this file).
> - */
> -u64 get_kaslr_seed(uintptr_t dtb_pa);
> +#include "pi.h"
>
>  u64 get_kaslr_seed(uintptr_t dtb_pa)
>  {
> diff --git a/arch/riscv/kernel/pi/pi.h b/arch/riscv/kernel/pi/pi.h
> new file mode 100644
> index 000000000000..65da99466baf
> --- /dev/null
> +++ b/arch/riscv/kernel/pi/pi.h
> @@ -0,0 +1,17 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef _RISCV_PI_H_
> +#define _RISCV_PI_H_
> +
> +#include <linux/types.h>
> +
> +/*
> + * The folowing functions are exported (but prefixed) declare them here so

s/folowing/following

And it lacks something between "(but prefixed)" and "declare": what
was wrong with the initial comment?

> + * that LLVM does not complain it lacks the 'static' keyword (which, if
> + * added, makes LLVM complain because the function is unused).
> + */
> +
> +u64 get_kaslr_seed(uintptr_t dtb_pa);
> +bool set_nokaslr_from_cmdline(uintptr_t dtb_pa);
> +u64 set_satp_mode_from_cmdline(uintptr_t dtb_pa);
> +
> +#endif /* _RISCV_PI_H_ */
> --
> 2.45.2
>

Suggested-by: Charlie Jenkins <charlie@rivosinc.com>
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>

Thanks,

Alex
diff mbox series

Patch

diff --git a/arch/riscv/kernel/pi/cmdline_early.c b/arch/riscv/kernel/pi/cmdline_early.c
index f6d4dedffb84..fbcdc9e4e143 100644
--- a/arch/riscv/kernel/pi/cmdline_early.c
+++ b/arch/riscv/kernel/pi/cmdline_early.c
@@ -6,15 +6,9 @@ 
 #include <asm/pgtable.h>
 #include <asm/setup.h>
 
-static char early_cmdline[COMMAND_LINE_SIZE];
+#include "pi.h"
 
-/*
- * Declare the functions that are exported (but prefixed) here so that LLVM
- * does not complain it lacks the 'static' keyword (which, if added, makes
- * LLVM complain because the function is actually unused in this file).
- */
-u64 set_satp_mode_from_cmdline(uintptr_t dtb_pa);
-bool set_nokaslr_from_cmdline(uintptr_t dtb_pa);
+static char early_cmdline[COMMAND_LINE_SIZE];
 
 static char *get_early_cmdline(uintptr_t dtb_pa)
 {
diff --git a/arch/riscv/kernel/pi/fdt_early.c b/arch/riscv/kernel/pi/fdt_early.c
index 899610e042ab..40ee299702bf 100644
--- a/arch/riscv/kernel/pi/fdt_early.c
+++ b/arch/riscv/kernel/pi/fdt_early.c
@@ -3,12 +3,7 @@ 
 #include <linux/init.h>
 #include <linux/libfdt.h>
 
-/*
- * Declare the functions that are exported (but prefixed) here so that LLVM
- * does not complain it lacks the 'static' keyword (which, if added, makes
- * LLVM complain because the function is actually unused in this file).
- */
-u64 get_kaslr_seed(uintptr_t dtb_pa);
+#include "pi.h"
 
 u64 get_kaslr_seed(uintptr_t dtb_pa)
 {
diff --git a/arch/riscv/kernel/pi/pi.h b/arch/riscv/kernel/pi/pi.h
new file mode 100644
index 000000000000..65da99466baf
--- /dev/null
+++ b/arch/riscv/kernel/pi/pi.h
@@ -0,0 +1,17 @@ 
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _RISCV_PI_H_
+#define _RISCV_PI_H_
+
+#include <linux/types.h>
+
+/*
+ * The folowing functions are exported (but prefixed) declare them here so
+ * that LLVM does not complain it lacks the 'static' keyword (which, if
+ * added, makes LLVM complain because the function is unused).
+ */
+
+u64 get_kaslr_seed(uintptr_t dtb_pa);
+bool set_nokaslr_from_cmdline(uintptr_t dtb_pa);
+u64 set_satp_mode_from_cmdline(uintptr_t dtb_pa);
+
+#endif /* _RISCV_PI_H_ */