display: remove pm_callback function pointer 95/264695/1
authorYoungjae Cho <y0.cho@samsung.com>
Tue, 28 Sep 2021 09:17:20 +0000 (18:17 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Tue, 28 Sep 2021 09:19:26 +0000 (18:19 +0900)
Instead, invoke poll_callback() function, which is identical to the
pm_callback function pointer.

Change-Id: Ic7a4bc2ea5a5729a39b6333d572621303a00fc95
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
12 files changed:
plugins/iot-headed/display/core.c
plugins/iot-headed/display/key-filter.c
plugins/mobile/display/core.c
plugins/mobile/display/key-filter.c
plugins/tv/display/core.c
plugins/tv/display/key-filter.c
plugins/wearable/display/core.c
plugins/wearable/display/key-filter.c
src/display/core.h
src/display/display-input.c
src/display/poll.c
src/display/poll.h

index 45e0f64..c4e6f18 100644 (file)
@@ -1609,7 +1609,7 @@ static void default_saving_mode(int onoff)
                backlight_ops->update();
 }
 
-static int poll_callback(int condition, PMMsg *data)
+int poll_callback(int condition, PMMsg *data)
 {
        static time_t last_t;
        time_t now;
@@ -2129,7 +2129,6 @@ static void display_init(void *data)
                        break;
                case INIT_POLL:
                        _I("input init");
-                       pm_callback = poll_callback;
                        ret = input_init_handler();
 
                        pm_lock_detector_init();
index 470b513..ccfb22f 100644 (file)
@@ -139,7 +139,7 @@ static void longkey_pressed(void)
                /* change state - LCD on */
                if (disp_plgn->pm_change_internal)
                        disp_plgn->pm_change_internal(INTERNAL_LOCK_POWERKEY, LCD_NORMAL);
-               (*pm_callback)(INPUT_POLL_EVENT, NULL);
+               poll_callback(INPUT_POLL_EVENT, NULL);
        }
 
        if (!display_has_caps(caps, DISPLAY_CAPA_LCDOFF)) {
index fde1087..62b1a9a 100644 (file)
@@ -1619,7 +1619,7 @@ static void default_saving_mode(int onoff)
                backlight_ops->update();
 }
 
-static int poll_callback(int condition, PMMsg *data)
+int poll_callback(int condition, PMMsg *data)
 {
        static time_t last_t;
        time_t now;
@@ -2135,7 +2135,6 @@ static void display_init(void *data)
                        break;
                case INIT_POLL:
                        _I("input init");
-                       pm_callback = poll_callback;
                        ret = input_init_handler();
 
                        pm_lock_detector_init();
index 17bca2c..2054adb 100644 (file)
@@ -130,7 +130,7 @@ static void longkey_pressed(void)
                /* change state - LCD on */
                if (disp_plgn->pm_change_internal)
                        disp_plgn->pm_change_internal(INTERNAL_LOCK_POWERKEY, LCD_NORMAL);
-               (*pm_callback)(INPUT_POLL_EVENT, NULL);
+               poll_callback(INPUT_POLL_EVENT, NULL);
        }
 
        if (!display_has_caps(caps, DISPLAY_CAPA_LCDOFF)) {
@@ -425,8 +425,7 @@ static gboolean display_on_cb(void *data)
                broadcast_lcdon_by_powerkey();
                lcd_on_direct(LCD_ON_BY_POWER_KEY);
 
-               if (pm_callback)
-                       (*pm_callback) (INPUT_POLL_EVENT, NULL);
+               poll_callback(INPUT_POLL_EVENT, NULL);
        }
 
        return G_SOURCE_REMOVE;
index 8120d15..21af9f5 100644 (file)
@@ -1609,7 +1609,7 @@ static void default_saving_mode(int onoff)
                backlight_ops->update();
 }
 
-static int poll_callback(int condition, PMMsg *data)
+int poll_callback(int condition, PMMsg *data)
 {
        static time_t last_t;
        time_t now;
@@ -2126,7 +2126,6 @@ static void display_init(void *data)
                        break;
                case INIT_POLL:
                        _I("input init");
-                       pm_callback = poll_callback;
                        ret = input_init_handler();
 
                        pm_lock_detector_init();
index b0667ec..33214b1 100644 (file)
@@ -139,7 +139,7 @@ static void longkey_pressed(void)
                /* change state - LCD on */
                if (disp_plgn->pm_change_internal)
                        disp_plgn->pm_change_internal(INTERNAL_LOCK_POWERKEY, LCD_NORMAL);
-               (*pm_callback)(INPUT_POLL_EVENT, NULL);
+               poll_callback(INPUT_POLL_EVENT, NULL);
        }
 
        if (!display_has_caps(caps, DISPLAY_CAPA_LCDOFF)) {
index 1326e6c..8d27e91 100644 (file)
@@ -1885,7 +1885,7 @@ static void default_saving_mode(int onoff)
        }
 }
 
-static int poll_callback(int condition, PMMsg *data)
+int poll_callback(int condition, PMMsg *data)
 {
        static time_t last_t;
        time_t now;
@@ -2456,7 +2456,6 @@ static void display_init(void *data)
                        break;
                case INIT_POLL:
                        _I("input init");
-                       pm_callback = poll_callback;
                        ret = input_init_handler();
 
                        pm_lock_detector_init();
index cc9a56b..5b1cf9d 100644 (file)
@@ -129,7 +129,7 @@ static void longkey_pressed(void)
                /* change state - LCD on */
                if (disp_plgn->pm_change_internal)
                        disp_plgn->pm_change_internal(INTERNAL_LOCK_POWERKEY, LCD_NORMAL);
-               (*pm_callback)(INPUT_POLL_EVENT, NULL);
+               poll_callback(INPUT_POLL_EVENT, NULL);
        }
 
        if (!display_has_caps(caps, DISPLAY_CAPA_LCDOFF)) {
index 43d71f0..e001f65 100644 (file)
@@ -173,6 +173,14 @@ struct display_keyfilter_ops {
 extern const struct display_keyfilter_ops *keyfilter_ops;
 extern GList *lcdon_ops;
 
+typedef struct {
+       pid_t pid;
+       unsigned int cond;
+       unsigned int timeout;
+       unsigned int timeout2;
+} PMMsg;
+extern int poll_callback(int condition, PMMsg *data);
+
 /* If the bit in a condition variable is set,
  *  we cannot transit the state until clear this bit. */
 int check_processes(enum state_t prohibit_state);
index a43db2d..9b86aff 100644 (file)
@@ -30,8 +30,6 @@
 
 #define SEAT_NAME   "seat0"
 
-int (*pm_callback) (int, PMMsg *);
-
 static void process_event(struct libinput_event *ev)
 {
        static const struct device_ops *display_device_ops;
@@ -46,9 +44,6 @@ static void process_event(struct libinput_event *ev)
                return;
        }
 
-       if (!pm_callback)
-               return;
-
        if (!display_device_ops) {
                display_device_ops = find_device("display");
                if (!display_device_ops)
@@ -107,7 +102,7 @@ static void process_event(struct libinput_event *ev)
                return;
 
        /* lcd on or update lcd timeout */
-       (*pm_callback) (INPUT_POLL_EVENT, NULL);
+       poll_callback(INPUT_POLL_EVENT, NULL);
 }
 
 gboolean display_input_init(gpointer data)
index 0e3ab28..600c2ef 100644 (file)
@@ -84,9 +84,6 @@ static int __pm_lock_internal(pid_t pid, int s_bits, int flag, int timeout)
 {
        int cond;
 
-       if (!pm_callback)
-               return -1;
-
        cond = get_state(s_bits);
        if (cond < 0)
                return cond;
@@ -107,7 +104,7 @@ static int __pm_lock_internal(pid_t pid, int s_bits, int flag, int timeout)
        recv_data.cond = cond;
        recv_data.timeout = timeout;
 
-       (*pm_callback)(PM_CONTROL_EVENT, &recv_data);
+       poll_callback(PM_CONTROL_EVENT, &recv_data);
 
        return 0;
 }
@@ -116,9 +113,6 @@ static int __pm_unlock_internal(pid_t pid, int s_bits, int flag)
 {
        int cond;
 
-       if (!pm_callback)
-               return -1;
-
        cond = get_state(s_bits);
        if (cond < 0)
                return cond;
@@ -138,7 +132,7 @@ static int __pm_unlock_internal(pid_t pid, int s_bits, int flag)
        recv_data.cond = cond;
        recv_data.timeout = 0;
 
-       (*pm_callback)(PM_CONTROL_EVENT, &recv_data);
+       poll_callback(PM_CONTROL_EVENT, &recv_data);
 
        return 0;
 }
@@ -148,9 +142,6 @@ static int __pm_change_internal(pid_t pid, int s_bits)
        int cond, ret;
        const int display_on = LCD_NORMAL | LCD_DIM;
 
-       if (!pm_callback)
-               return -1;
-
        cond = get_state(s_bits);
        if (cond < 0)
                return cond;
@@ -170,7 +161,7 @@ static int __pm_change_internal(pid_t pid, int s_bits)
        recv_data.cond = cond;
        recv_data.timeout = 0;
 
-       (*pm_callback)(PM_CONTROL_EVENT, &recv_data);
+       poll_callback(PM_CONTROL_EVENT, &recv_data);
 
        return 0;
 }
index 83bba86..096316d 100644 (file)
@@ -143,15 +143,6 @@ enum cond_flags_e {
 #define RESET_TIMER_STR  "resettimer"
 #define KEEP_TIMER_STR   "keeptimer"
 
-typedef struct {
-       pid_t pid;
-       unsigned int cond;
-       unsigned int timeout;
-       unsigned int timeout2;
-} PMMsg;
-
-extern int (*pm_callback) (int, PMMsg *);
-
 gboolean display_input_init(gpointer data);
 int display_input_exit(void);