display: Replace proc_change_state() with plugin api 25/313325/1
authorYoungjae Cho <y0.cho@samsung.com>
Wed, 19 Jun 2024 03:59:39 +0000 (12:59 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Mon, 24 Jun 2024 02:05:29 +0000 (11:05 +0900)
Change-Id: I8c0887c50078a9904f0b04996bb6df773154355f
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
plugins/mobile/display/core.c
plugins/tv/display/core.c
plugins/wearable/display/core.c
src/display/display-plugin.c
src/display/display-plugin.h
src/display/display-state-transition.c

index 7302053a9535ea53bf564d9bf1bec1f1864b76fa..b2162fd0954d76854209a9964a3ce02d0c03b742 100644 (file)
@@ -130,8 +130,6 @@ static int display_probe(void *data)
        struct display_plugin *dp = (struct display_plugin *) data;
        assert(dp);
 
-       dp->proc_change_state = NULL;
-
        return 0;
 }
 
index 4009f85c55a16616aaaa1660eb233508c267cdce..d4ba8c914941c62a2e7e217129ee531b42983f00 100644 (file)
@@ -129,8 +129,6 @@ static int display_probe(void *data)
        struct display_plugin *dp = (struct display_plugin *) data;
        assert(dp);
 
-       dp->proc_change_state = NULL;
-
        return 0;
 }
 
index 36d23cd2dda6509d566f5511357f950e954d5d14..80c0773d29f182c3f75bec4cf3d79e3a325f3be7 100644 (file)
@@ -474,6 +474,8 @@ static int display_off_by_reason(const char *reason)
        return 0;
 }
 
+/* FIXME: register to plugin .proc_change_state interface */
+__attribute__((unused))
 static int default_proc_change_state(unsigned int cond, pid_t pid)
 {
        enum syscommon_deviced_display_state next;
@@ -864,8 +866,8 @@ static int display_probe(void *data)
         * dp->custom_lcd_off = custom_lcdoff;
         * dp->display_on_by_reason = display_on_by_reason;
         * dp->display_off_by_reason = display_off_by_reason;
+        * dp->proc_change_state = default_proc_change_state;
         */
-       dp->proc_change_state = default_proc_change_state;
 
        return 0;
 }
index 503d8904f5b7fe999b9504bb66b83f5355325f0a..9fd019714caa97c3a8aa15b4c2d4850f02c9fc96 100644 (file)
 #include "display-config.h"
 #include "shared/log-macro.h"
 
-struct display_plugin g_display_plugin;
-
-/* FIXME: Below functions are temorary to separtate display state transition functions */
-
-bool display_plugin_state_is_there_proc_change_state(void)
-{
-       return (g_display_plugin.proc_change_state != NULL);
-}
-
-int display_plugin_state_proc_change_state(unsigned int cond, pid_t pid)
-{
-       if (!g_display_plugin.proc_change_state)
-               return -EOPNOTSUPP;
-
-       return g_display_plugin.proc_change_state(cond, pid);
-}
\ No newline at end of file
+struct display_plugin g_display_plugin;
\ No newline at end of file
index e8261cfc912ee8f594690cfdf02269e2a5fd890a..8e39b2fda6b94f718c8097d7aec9ee471e34819c 100644 (file)
 #include "shared/devices.h"
 
 struct display_plugin {
-       int (*proc_change_state) (unsigned int cond, pid_t pid);
 };
 extern struct display_plugin g_display_plugin;
 
-/* FIXME: This function used in the display lock related functions */
-bool display_plugin_state_is_there_proc_change_state(void);
-int display_plugin_state_proc_change_state(unsigned int cond, pid_t pid);
-
 #endif //__DISPLAY_PLUGIN_H__
index d5fc524c1682762bf45cc6b31ebd7fae0296550c..641727f71fd7a6b16419ab63f5c1af22e2e1949d 100644 (file)
@@ -890,9 +890,19 @@ int display_state_transition_do_proc_change_state(unsigned int cond, pid_t pid)
         */
        enum syscommon_deviced_display_state next;
        const char *state_name = NULL;
+       int ret;
 
-       if (display_plugin_state_is_there_proc_change_state())
-               return display_plugin_state_proc_change_state(cond, pid);
+       ret = syscommon_plugin_deviced_display_proc_change_state(cond, pid);
+       if (ret == -ENOTSUP) {
+               _D("Take default operation as there is no found plugin backend");
+       } else if (ret == -EOPNOTSUPP) {
+               _D("Take default operation as there is no found plugin backend operation");
+       } else if (ret < 0) {
+               _E("Failed to plugin operation, ret=%d", ret);
+               return ret;
+       } else {
+               return 0;
+       }
 
        next = GET_COND_STATE(cond);
        display_state_get_name(next, &state_name);