sleep: introduce sleep_operation_is_hibernation
This commit is contained in:
@@ -305,7 +305,7 @@ static int sleep_supported_internal(
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IN_SET(operation, SLEEP_HIBERNATE, SLEEP_HYBRID_SLEEP)) {
|
||||
if (sleep_operation_is_hibernation(operation)) {
|
||||
r = sleep_mode_supported(sleep_config->modes[operation]);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -20,6 +20,10 @@ typedef enum SleepOperation {
|
||||
const char* sleep_operation_to_string(SleepOperation s) _const_;
|
||||
SleepOperation sleep_operation_from_string(const char *s) _pure_;
|
||||
|
||||
static inline bool sleep_operation_is_hibernation(SleepOperation operation) {
|
||||
return IN_SET(operation, SLEEP_HIBERNATE, SLEEP_HYBRID_SLEEP);
|
||||
}
|
||||
|
||||
typedef struct SleepConfig {
|
||||
bool allow[_SLEEP_OPERATION_MAX];
|
||||
|
||||
|
||||
+1
-1
@@ -284,7 +284,7 @@ static int execute(
|
||||
setvbuf(f, NULL, _IONBF, 0);
|
||||
|
||||
/* Configure hibernation settings if we are supposed to hibernate */
|
||||
if (!strv_isempty(modes)) {
|
||||
if (sleep_operation_is_hibernation(operation)) {
|
||||
bool resume_set;
|
||||
|
||||
r = find_suitable_hibernation_device(&hibernation_device);
|
||||
|
||||
Reference in New Issue
Block a user