resource: system: Add is_supported ops for memory pressure level attribute 49/288349/1
authorDongwoo Lee <dwoo08.lee@samsung.com>
Wed, 15 Feb 2023 10:43:14 +0000 (19:43 +0900)
committerDongwoo Lee <dwoo08.lee@samsung.com>
Wed, 15 Feb 2023 10:46:00 +0000 (19:46 +0900)
Change-Id: I5730b241965213563552f37ea5aa670968e5eaed
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
src/resource/resource-system.c

index 7148ffb..b9f6fec 100644 (file)
@@ -260,6 +260,12 @@ static int system_get_memory_pressure_level(int resource_id,
        return 0;
 }
 
+static bool system_memory_pressure_level_is_supported(int resource_id,
+               const struct syscommon_resman_resource_attribute *attr)
+{
+       return !access(PSI_MEMORY_GLOBAL, W_OK);
+}
+
 static void
 system_handle_psi_listener(int resource_id,
                           const struct syscommon_resman_resource_attribute *attr,
@@ -457,6 +463,7 @@ static const struct syscommon_resman_resource_attribute system_attrs[] = {
                .flag   = SYSCOMMON_RESMAN_RESOURCE_ATTR_FLAG_PUBLIC,
                .ops    = {
                        .get = system_get_memory_pressure_level,
+                       .is_supported = system_memory_pressure_level_is_supported,
                },
                .listener_ops = {
                        .init = system_init_psi_listener,