diff mbox series

[2/3] riscv: sbi: Share the code for unsupported extension warnings

Message ID 20221228161915.13194-3-samuel@sholland.org (mailing list archive)
State Needs ACK, archived
Delegated to: Palmer Dabbelt
Headers show
Series riscv: sbi: Switch to the sys-off handler API | expand

Checks

Context Check Description
conchuod/patch_count success Link
conchuod/cover_letter success Series has a cover letter
conchuod/tree_selection success Guessed tree name to be for-next
conchuod/fixes_present success Fixes tag not required for -next series
conchuod/maintainers_pattern success MAINTAINERS pattern errors before the patch: 13 and now 13
conchuod/verify_signedoff success Signed-off-by tag matches author and committer
conchuod/kdoc success Errors and warnings before: 0 this patch: 0
conchuod/module_param success Was 0 now: 0
conchuod/alphanumeric_selects success Out of order selects before the patch: 57 and now 57
conchuod/build_rv32_defconfig success Build OK
conchuod/build_warn_rv64 success Errors and warnings before: 0 this patch: 0
conchuod/dtb_warn_rv64 success Errors and warnings before: 0 this patch: 0
conchuod/header_inline success No static functions without inline keyword in header files
conchuod/checkpatch success total: 0 errors, 0 warnings, 0 checks, 33 lines checked
conchuod/source_inline success Was 0 now: 0
conchuod/build_rv64_nommu_k210_defconfig success Build OK
conchuod/verify_fixes success No Fixes tag
conchuod/build_rv64_nommu_virt_defconfig success Build OK

Commit Message

Samuel Holland Dec. 28, 2022, 4:19 p.m. UTC
This reduces the code size by sharing most of the code and the format
string across all affected extensions.

Signed-off-by: Samuel Holland <samuel@sholland.org>
---

 arch/riscv/kernel/sbi.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

Comments

Geert Uytterhoeven Jan. 3, 2023, 8:54 a.m. UTC | #1
On Wed, Dec 28, 2022 at 5:19 PM Samuel Holland <samuel@sholland.org> wrote:
> This reduces the code size by sharing most of the code and the format
> string across all affected extensions.
>
> Signed-off-by: Samuel Holland <samuel@sholland.org>

Reviewed-by: Geert Uytterhoeven <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
diff mbox series

Patch

diff --git a/arch/riscv/kernel/sbi.c b/arch/riscv/kernel/sbi.c
index 5c87db8fdff2..1196c12299f6 100644
--- a/arch/riscv/kernel/sbi.c
+++ b/arch/riscv/kernel/sbi.c
@@ -210,16 +210,20 @@  static void sbi_set_power_off(void)
 	pm_power_off = sbi_shutdown;
 }
 #else
+static void __sbi_warn_unsupported(const char *extension)
+{
+	pr_warn("%s extension is not available in SBI v%lu.%lu\n",
+		extension, sbi_major_version(), sbi_minor_version());
+}
+
 static void __sbi_set_timer_v01(uint64_t stime_value)
 {
-	pr_warn("Timer extension is not available in SBI v%lu.%lu\n",
-		sbi_major_version(), sbi_minor_version());
+	__sbi_warn_unsupported("Timer");
 }
 
 static int __sbi_send_ipi_v01(const struct cpumask *cpu_mask)
 {
-	pr_warn("IPI extension is not available in SBI v%lu.%lu\n",
-		sbi_major_version(), sbi_minor_version());
+	__sbi_warn_unsupported("IPI");
 
 	return 0;
 }
@@ -228,8 +232,7 @@  static int __sbi_rfence_v01(int fid, const struct cpumask *cpu_mask,
 			    unsigned long start, unsigned long size,
 			    unsigned long arg4, unsigned long arg5)
 {
-	pr_warn("remote fence extension is not available in SBI v%lu.%lu\n",
-		sbi_major_version(), sbi_minor_version());
+	__sbi_warn_unsupported("Remote fence");
 
 	return 0;
 }