From 516161c46f0d3c73bf6a57e551d6e2489912fc03 Mon Sep 17 00:00:00 2001 From: Nikita Shubin <n.shubin@yadro.com> Date: Fri, 1 Oct 2021 11:31:16 +0300 Subject: lib: sbi: convert reset to list To support different handlers for different types of resets, we are adding a sbi_list of restart handlers. Instead of sbi_system_reset_set_device we use sbi_system_reset_add_device to reflect the actual meaning. Signed-off-by: Nikita Shubin <n.shubin@yadro.com> Reviewed-by: Anup Patel <anup.patel@wdc.com> --- include/sbi/sbi_system.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'include/sbi/sbi_system.h') diff --git a/include/sbi/sbi_system.h b/include/sbi/sbi_system.h index a9fa546..84c2813 100644 --- a/include/sbi/sbi_system.h +++ b/include/sbi/sbi_system.h @@ -11,6 +11,7 @@ #define __SBI_SYSTEM_H__ #include <sbi/sbi_types.h> +#include <sbi/sbi_list.h> /** System reset hardware device */ struct sbi_system_reset_device { @@ -22,11 +23,21 @@ struct sbi_system_reset_device { /** Reset the system */ void (*system_reset)(u32 reset_type, u32 reset_reason); + + /** List */ + struct sbi_dlist node; }; -const struct sbi_system_reset_device *sbi_system_reset_get_device(void); +static inline struct sbi_system_reset_device *to_system_reset_device( + struct sbi_dlist *node) +{ + return container_of(node, struct sbi_system_reset_device, node); +} + +const struct sbi_system_reset_device *sbi_system_reset_get_device( + u32 reset_type, u32 reset_reason); -void sbi_system_reset_set_device(const struct sbi_system_reset_device *dev); +void sbi_system_reset_add_device(struct sbi_system_reset_device *dev); bool sbi_system_reset_supported(u32 reset_type, u32 reset_reason); -- cgit v1.2.3