forked from Mirrors/opensbi
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:
@@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user