lib: sbi: Only register available extensions

When an extension implements a probe function it means there's a
chance that the extension is not available. Use this function in the
register_extensions callback to determine if the extension should be
registered at all. Where the probe implementation is simple, just
open code the check.

Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Andrew Jones
2023-05-15 13:12:37 +02:00
committed by Anup Patel
parent 042f0c3ea2
commit 8b952d4fcd
6 changed files with 35 additions and 22 deletions

View File

@@ -44,6 +44,12 @@ struct sbi_ecall_extension ecall_susp;
static int sbi_ecall_susp_register_extensions(void)
{
unsigned long out_val;
sbi_ecall_susp_probe(SBI_EXT_SUSP, &out_val);
if (!out_val)
return 0;
return sbi_ecall_register_extension(&ecall_susp);
}