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 authored and Anup Patel committed 2023-05-21 16:53:02 +05:30
1 parent 042f0c3ea2
commit 8b952d4fcd
6 files changed
+35 -22

No files matched your search

+3
View File
@@ -68,6 +68,9 @@ struct sbi_ecall_extension ecall_dbcn;
static int sbi_ecall_dbcn_register_extensions(void)
{
if (!sbi_console_get_device())
return 0;
return sbi_ecall_register_extension(&ecall_dbcn);
}