summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Jones <[email protected]>2023-06-01 09:48:10 +0200
committerAnup Patel <[email protected]>2023-06-04 15:18:40 +0530
commitbdde2ecd27af1ac158669809f6658376fb5137ab (patch)
tree61a9aa92e7ac60ae573786394ffd9df4e8b48191 /include
parentdf75e0995689842b3022a4a8d4d69e980430c129 (diff)
lib: sbi: Align system suspend errors with spec
The spec says sbi_system_suspend() will return SBI_ERR_INVALID_PARAM when "sleep_type is reserved or is platform-specific and unimplemented" and SBI_ERR_NOT_SUPPORTED when sleep_type "is not reserved and is implemented, but the platform does not support it due to one or more missing dependencies." Ensure SBI_ERR_INVALID_PARAM is returned for reserved sleep types and that the system suspend driver can choose which of the two error types to return itself by returning an error from its check function rather than a boolean. Signed-off-by: Andrew Jones <[email protected]> Reviewed-by: Anup Patel <[email protected]>
Diffstat (limited to 'include')
-rw-r--r--include/sbi/sbi_system.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/sbi/sbi_system.h b/include/sbi/sbi_system.h
index 33ff7f1a..0fdcc98c 100644
--- a/include/sbi/sbi_system.h
+++ b/include/sbi/sbi_system.h
@@ -48,7 +48,14 @@ struct sbi_system_suspend_device {
/** Name of the system suspend device */
char name[32];
- /* Check whether sleep type is supported by the device */
+ /**
+ * Check whether sleep type is supported by the device
+ *
+ * Returns 0 when @sleep_type supported, SBI_ERR_INVALID_PARAM
+ * when @sleep_type is reserved, or SBI_ERR_NOT_SUPPORTED when
+ * @sleep_type is not reserved and is implemented, but the
+ * platform doesn't support it due to missing dependencies.
+ */
int (*system_suspend_check)(u32 sleep_type);
/**