summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYunmi Ha <yunmi.ha@samsung.com>2020-08-13 15:17:59 +0900
committerYunmi Ha <yunmi.ha@samsung.com>2020-08-13 17:50:40 +0900
commit23a4276cef9262f0d072c982e7ff18915c717ac9 (patch)
treeae86c45046dc3a752fa209079b635003d44934f8
parentdb75fef04accc5a5ea41eb203c00d10224d7b506 (diff)
downloaddeviced-23a4276cef9262f0d072c982e7ff18915c717ac9.tar.gz
deviced-23a4276cef9262f0d072c982e7ff18915c717ac9.tar.bz2
deviced-23a4276cef9262f0d072c982e7ff18915c717ac9.zip
Add initialize constructor for variable init.
Change-Id: I0c469e3609f4c99a36531d1a2a9adbcea48aab50 Signed-off-by: Yunmi Ha <yunmi.ha@samsung.com>
-rw-r--r--plugins/iot/display/core.c18
-rw-r--r--plugins/iot/display/key-filter.c11
-rw-r--r--plugins/mobile/battery/battery-notification.c12
-rw-r--r--plugins/mobile/display/core.c19
-rw-r--r--plugins/mobile/display/key-filter.c11
-rw-r--r--plugins/tv/display/core.c18
-rw-r--r--plugins/tv/display/key-filter.c11
-rw-r--r--plugins/tv/display/state-tv.c12
-rw-r--r--plugins/wearable/display/auto-brightness-sensorhub.c14
-rw-r--r--plugins/wearable/display/bezel.c14
-rw-r--r--plugins/wearable/display/core.c19
-rw-r--r--plugins/wearable/display/key-filter.c11
-rw-r--r--plugins/wearable/display/swim.c20
-rw-r--r--src/apps/apps.c7
-rw-r--r--src/apps/apps.h1
-rw-r--r--src/battery/battery-time.c13
-rw-r--r--src/battery/lowbat-handler.c25
-rw-r--r--src/battery/power-supply.c26
-rw-r--r--src/display/ambient-mode.c12
-rw-r--r--src/display/display-dbus.c13
-rw-r--r--src/display/display-signal.c7
-rw-r--r--src/display/display-signal.h2
-rw-r--r--src/display/poll.c12
-rw-r--r--src/display/setting.c13
-rw-r--r--src/extcon/cradle.c12
-rw-r--r--src/extcon/earjack.c16
-rw-r--r--src/extcon/hdmi.c12
-rw-r--r--src/led/touch-key.c14
-rw-r--r--src/power/boot.c21
-rw-r--r--src/power/power-handler.c24
-rw-r--r--src/time/time-handler.c19
-rw-r--r--src/touchscreen/touchscreen.c13
-rw-r--r--src/usb/usb.c12
-rw-r--r--src/usbhost/usb-host.c32
34 files changed, 251 insertions, 245 deletions
diff --git a/plugins/iot/display/core.c b/plugins/iot/display/core.c
index 2b5880ab..0fe3a8ab 100644
--- a/plugins/iot/display/core.c
+++ b/plugins/iot/display/core.c
@@ -2185,16 +2185,6 @@ static void add_timer_for_init_dpms(void)
* Power manager Main
*
*/
-static void set_module_display_plugin(void)
-{
- disp_plgn = get_display_plugin(); /* self */
- if (!disp_plgn)
- _E("Failed to get display plugin.");
-
- set_apps_display_plugin(disp_plgn); /* apps */
- set_display_signal_display_plugin(disp_plgn); /* display-signal */
-}
-
static int display_probe(void *data)
{
int ret;
@@ -2210,7 +2200,6 @@ static int display_probe(void *data)
/* display_plugin instance initialization */
init_pm_internal();
- set_module_display_plugin();
disp_plgn->device_flags_to_string = __device_flags_to_string;
return 0;
@@ -2512,6 +2501,13 @@ static const struct device_ops display_device_ops = {
DEVICE_OPS_REGISTER(&display_device_ops)
+static void __CONSTRUCTOR__ initialize(void)
+{
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
+}
/**
* @}
*/
diff --git a/plugins/iot/display/key-filter.c b/plugins/iot/display/key-filter.c
index 66ab61ca..186a1157 100644
--- a/plugins/iot/display/key-filter.c
+++ b/plugins/iot/display/key-filter.c
@@ -757,10 +757,6 @@ static struct display_actor_ops display_menukey_actor = {
static void keyfilter_init(void)
{
- disp_plgn = get_display_plugin();
- if (!disp_plgn)
- _E("Failed to get display plugin.");
-
display_add_actor(&display_powerkey_actor);
display_add_actor(&display_menukey_actor);
@@ -795,3 +791,10 @@ static const struct display_keyfilter_ops normal_keyfilter_ops = {
const struct display_keyfilter_ops *keyfilter_ops = &normal_keyfilter_ops;
+static void __CONSTRUCTOR__ initialize(void)
+{
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
+}
diff --git a/plugins/mobile/battery/battery-notification.c b/plugins/mobile/battery/battery-notification.c
index 3903c0da..d72c2874 100644
--- a/plugins/mobile/battery/battery-notification.c
+++ b/plugins/mobile/battery/battery-notification.c
@@ -381,10 +381,6 @@ static void battery_notification_init(void *data)
if (!plugin)
return;
- disp_plgn = get_display_plugin();
- if (!disp_plgn)
- _E("Failed to get display plugin.");
-
_D("Add plugins for battery notification.");
plugin->lowbat_noti_launch = launch_lowbat_noti;
plugin->lowbat_noti_clean = clean_lowbat_noti;
@@ -410,3 +406,11 @@ static const struct battery_ops battery_notification_ops = {
};
BATTERY_OPS_REGISTER(&battery_notification_ops)
+
+static void __CONSTRUCTOR__ initialize(void)
+{
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
+}
diff --git a/plugins/mobile/display/core.c b/plugins/mobile/display/core.c
index ec011021..80cef01c 100644
--- a/plugins/mobile/display/core.c
+++ b/plugins/mobile/display/core.c
@@ -2195,17 +2195,6 @@ static void add_timer_for_init_dpms(void)
* Power manager Main
*
*/
-
-static void set_module_display_plugin(void)
-{
- disp_plgn = get_display_plugin(); /* self */
- if (!disp_plgn)
- _E("Failed to get display plugin.");
-
- set_apps_display_plugin(disp_plgn); /* apps */
- set_display_signal_display_plugin(disp_plgn); /* display-signal */
-}
-
static int display_probe(void *data)
{
int ret;
@@ -2221,7 +2210,6 @@ static int display_probe(void *data)
/* display_plugin instance initialization */
init_pm_internal();
- set_module_display_plugin();
disp_plgn->device_flags_to_string = __device_flags_to_string;
return 0;
@@ -2528,6 +2516,13 @@ static const struct device_ops display_device_ops = {
DEVICE_OPS_REGISTER(&display_device_ops)
+static void __CONSTRUCTOR__ initialize(void)
+{
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
+}
/**
* @}
*/
diff --git a/plugins/mobile/display/key-filter.c b/plugins/mobile/display/key-filter.c
index 546d4e1b..bd939ff6 100644
--- a/plugins/mobile/display/key-filter.c
+++ b/plugins/mobile/display/key-filter.c
@@ -784,10 +784,6 @@ static struct display_actor_ops display_menukey_actor = {
static void keyfilter_init(void)
{
- disp_plgn = get_display_plugin();
- if (!disp_plgn)
- _E("Failed to get display plugin.");
-
display_add_actor(&display_powerkey_actor);
display_add_actor(&display_menukey_actor);
@@ -822,3 +818,10 @@ static const struct display_keyfilter_ops normal_keyfilter_ops = {
const struct display_keyfilter_ops *keyfilter_ops = &normal_keyfilter_ops;
+static void __CONSTRUCTOR__ initialize(void)
+{
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
+}
diff --git a/plugins/tv/display/core.c b/plugins/tv/display/core.c
index 058fa835..f997dd14 100644
--- a/plugins/tv/display/core.c
+++ b/plugins/tv/display/core.c
@@ -2186,16 +2186,6 @@ static void add_timer_for_init_dpms(void)
*
*/
-static void set_module_display_plugin(void)
-{
- disp_plgn = get_display_plugin(); /* self */
- if (!disp_plgn)
- _E("Failed to get display plugin.");
-
- set_apps_display_plugin(disp_plgn); /* apps */
- set_display_signal_display_plugin(disp_plgn); /* display-signal */
-}
-
static int display_probe(void *data)
{
int ret;
@@ -2211,7 +2201,6 @@ static int display_probe(void *data)
/* display_plugin instance initialization */
init_pm_internal();
- set_module_display_plugin();
disp_plgn->device_flags_to_string = __device_flags_to_string;
return 0;
@@ -2513,6 +2502,13 @@ static const struct device_ops display_device_ops = {
DEVICE_OPS_REGISTER(&display_device_ops)
+static void __CONSTRUCTOR__ initialize(void)
+{
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
+}
/**
* @}
*/
diff --git a/plugins/tv/display/key-filter.c b/plugins/tv/display/key-filter.c
index d88ff6b3..3874dbaf 100644
--- a/plugins/tv/display/key-filter.c
+++ b/plugins/tv/display/key-filter.c
@@ -751,10 +751,6 @@ static struct display_actor_ops display_menukey_actor = {
static void keyfilter_init(void)
{
- disp_plgn = get_display_plugin();
- if (!disp_plgn)
- _E("Failed to get display plugin.");
-
display_add_actor(&display_powerkey_actor);
display_add_actor(&display_menukey_actor);
@@ -789,3 +785,10 @@ static const struct display_keyfilter_ops normal_keyfilter_ops = {
const struct display_keyfilter_ops *keyfilter_ops = &normal_keyfilter_ops;
+static void __CONSTRUCTOR__ initialize(void)
+{
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
+}
diff --git a/plugins/tv/display/state-tv.c b/plugins/tv/display/state-tv.c
index fdf48c6e..f8f1df13 100644
--- a/plugins/tv/display/state-tv.c
+++ b/plugins/tv/display/state-tv.c
@@ -551,10 +551,6 @@ void state_tv_init(void)
_I("TV Profile !!");
- disp_plgn = get_display_plugin();
- if (!disp_plgn)
- _E("Failed to get display plugin.");
-
for (i = 0 ; i < ARRAY_SIZE(tv_states) ; i++)
set_tv_operations(tv_states[i].state,
tv_states[i].name,
@@ -571,3 +567,11 @@ void state_tv_deinit(void)
{
unregister_notifier(DEVICE_NOTIFIER_DISPLAY_LOCK, display_lock_changed);
}
+
+static void __CONSTRUCTOR__ initialize(void)
+{
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
+}
diff --git a/plugins/wearable/display/auto-brightness-sensorhub.c b/plugins/wearable/display/auto-brightness-sensorhub.c
index 2d102853..502c86f2 100644
--- a/plugins/wearable/display/auto-brightness-sensorhub.c
+++ b/plugins/wearable/display/auto-brightness-sensorhub.c
@@ -339,12 +339,6 @@ int prepare_level_handler(void)
{
int status, ret;
- disp_plgn = get_display_plugin();
- if (!disp_plgn) {
- _E("Failed to get display plugin.");
- return -1;
- }
-
display_info.set_brightness_level = set_brightness_level;
disp_plgn->auto_brightness_control = auto_brightness_control;
@@ -370,3 +364,11 @@ void exit_level_handler(void)
unregister_notifier(DEVICE_NOTIFIER_LCD_OFF, display_off_changed);
unregister_notifier(DEVICE_NOTIFIER_LCD_OFF_COMPLETE, display_off_complete_changed);
}
+
+static void __CONSTRUCTOR__ initialize(void)
+{
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
+}
diff --git a/plugins/wearable/display/bezel.c b/plugins/wearable/display/bezel.c
index 5c96a3ec..bb22d8f9 100644
--- a/plugins/wearable/display/bezel.c
+++ b/plugins/wearable/display/bezel.c
@@ -161,12 +161,6 @@ static int bezel_probe(void *data)
struct hw_info *info;
int ret;
- disp_plgn = get_display_plugin();
- if (!disp_plgn) {
- _E("Failed to get display plugin.");
- return -1;
- }
-
if (bezel_dev)
return 0;
@@ -321,3 +315,11 @@ static const struct device_ops bezel_device_ops = {
};
DEVICE_OPS_REGISTER(&bezel_device_ops)
+
+static void __CONSTRUCTOR__ initialize(void)
+{
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
+}
diff --git a/plugins/wearable/display/core.c b/plugins/wearable/display/core.c
index dda1739f..60d1db2d 100644
--- a/plugins/wearable/display/core.c
+++ b/plugins/wearable/display/core.c
@@ -2277,17 +2277,6 @@ static void add_timer_for_init_dpms(void)
* Power manager Main
*
*/
-
-static void set_module_display_plugin(void)
-{
- disp_plgn = get_display_plugin(); /* self */
- if (!disp_plgn)
- _E("Failed to get display plugin.");
-
- set_apps_display_plugin(disp_plgn); /* apps */
- set_display_signal_display_plugin(disp_plgn); /* display-signal */
-}
-
static int display_probe(void *data)
{
int ret;
@@ -2303,7 +2292,6 @@ static int display_probe(void *data)
/* display_plugin instance initialization */
init_pm_internal();
- set_module_display_plugin();
disp_plgn->device_flags_to_string = __device_flags_to_string;
return 0;
@@ -2642,6 +2630,13 @@ static const struct device_ops display_device_ops = {
DEVICE_OPS_REGISTER(&display_device_ops)
+static void __CONSTRUCTOR__ initialize(void)
+{
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
+}
/**
* @}
*/
diff --git a/plugins/wearable/display/key-filter.c b/plugins/wearable/display/key-filter.c
index a609cd1a..b543a8ac 100644
--- a/plugins/wearable/display/key-filter.c
+++ b/plugins/wearable/display/key-filter.c
@@ -731,10 +731,6 @@ static struct display_actor_ops display_menukey_actor = {
static void keyfilter_init(void)
{
- disp_plgn = get_display_plugin();
- if (!disp_plgn)
- _E("Failed to get display plugin.");
-
display_add_actor(&display_powerkey_actor);
display_add_actor(&display_menukey_actor);
@@ -769,3 +765,10 @@ static const struct display_keyfilter_ops normal_keyfilter_ops = {
const struct display_keyfilter_ops *keyfilter_ops = &normal_keyfilter_ops;
+static void __CONSTRUCTOR__ initialize(void)
+{
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
+}
diff --git a/plugins/wearable/display/swim.c b/plugins/wearable/display/swim.c
index 3407fc02..36514561 100644
--- a/plugins/wearable/display/swim.c
+++ b/plugins/wearable/display/swim.c
@@ -112,17 +112,6 @@ static int swim_restore_cb(void *data)
return 0;
}
-static int swim_probe(void *data)
-{
- disp_plgn = get_display_plugin();
- if (!disp_plgn) {
- _E("Failed to get display plugin.");
- return -1;
- }
-
- return 0;
-}
-
static void swim_init(void *data)
{
int ret;
@@ -143,9 +132,16 @@ static void swim_init(void *data)
static const struct device_ops swim_device_ops = {
DECLARE_NAME_LEN("swim"),
- .probe = swim_probe,
.init = swim_init,
.execute = swim_execute,
};
DEVICE_OPS_REGISTER(&swim_device_ops)
+
+static void __CONSTRUCTOR__ initialize(void)
+{
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
+}
diff --git a/src/apps/apps.c b/src/apps/apps.c
index b92e6931..72deb24a 100644
--- a/src/apps/apps.c
+++ b/src/apps/apps.c
@@ -173,7 +173,10 @@ int remove_notification(char *type, int id)
__cb, -1, NULL);
}
-void set_apps_display_plugin(struct display_plugin *dp)
+static void __CONSTRUCTOR__ initialize(void)
{
- disp_plgn = dp;
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
}
diff --git a/src/apps/apps.h b/src/apps/apps.h
index d455c8cc..5e1b3930 100644
--- a/src/apps/apps.h
+++ b/src/apps/apps.h
@@ -36,7 +36,6 @@ int launch_system_app(char *type, int num, ...);
int launch_message_post(char *type);
int add_async_notification(char *type, dbus_pending_cb func, char *sig, ...);
int remove_notification(char *type, int id);
-void set_apps_display_plugin(struct display_plugin *dp);
#endif /* __APPS_H__ */
diff --git a/src/battery/battery-time.c b/src/battery/battery-time.c
index 92bd6d72..154be9ac 100644
--- a/src/battery/battery-time.c
+++ b/src/battery/battery-time.c
@@ -398,12 +398,6 @@ static int battery_probe(void *data)
struct hw_info *info;
int ret;
- disp_plgn = get_display_plugin();
- if (!disp_plgn) {
- _E("Failed to get display plugin.");
- return -1;
- }
-
ret = hw_get_info(BATTERY_HARDWARE_DEVICE_ID,
(const struct hw_info **)&info);
@@ -438,3 +432,10 @@ static const struct device_ops battery_time_device_ops = {
DEVICE_OPS_REGISTER(&battery_time_device_ops)
+static void __CONSTRUCTOR__ initialize(void)
+{
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
+}
diff --git a/src/battery/lowbat-handler.c b/src/battery/lowbat-handler.c
index b80d8acf..e8e32a29 100644
--- a/src/battery/lowbat-handler.c
+++ b/src/battery/lowbat-handler.c
@@ -697,18 +697,6 @@ static int lowbat_probe(void *data)
static const struct device_ops *ops;
int ret = -EINVAL;
- disp_plgn = get_display_plugin();
- if (!disp_plgn) {
- _E("Failed to get display plugin.");
- return ret;
- }
-
- battery_plgn = get_battery_plugin();
- if (!battery_plgn) {
- _E("Failed to get battery plugin.");
- return ret;
- }
-
FIND_DEVICE_INT(ops, "power_supply");
ret = ops->probe(data);
if (ret == 0)
@@ -787,3 +775,16 @@ static const struct device_ops lowbat_device_ops = {
};
DEVICE_OPS_REGISTER(&lowbat_device_ops)
+
+static void __CONSTRUCTOR__ initialize(void)
+{
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
+
+ battery_plgn = get_battery_plugin();
+ if (!battery_plgn) {
+ _E("Failed to get battery plugin.");
+ }
+}
diff --git a/src/battery/power-supply.c b/src/battery/power-supply.c
index e91a8535..44f0711f 100644
--- a/src/battery/power-supply.c
+++ b/src/battery/power-supply.c
@@ -1597,18 +1597,6 @@ static int power_supply_probe(void *data)
struct hw_info *info;
int ret, r;
- disp_plgn = get_display_plugin();
- if (!disp_plgn) {
- _E("Failed to get display plugin.");
- return -1;
- }
-
- battery_plgn = get_battery_plugin();
- if (!battery_plgn) {
- _E("Failed to get battery plugin.");
- return -1;
- }
-
if (battery_dev)
return 0;
@@ -1746,3 +1734,17 @@ static const struct device_ops power_supply_ops = {
};
DEVICE_OPS_REGISTER(&power_supply_ops)
+
+static void __CONSTRUCTOR__ initialize(void)
+{
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
+
+ battery_plgn = get_battery_plugin();
+ if (!battery_plgn) {
+ _E("Failed to get battery plugin.");
+ }
+}
+
diff --git a/src/display/ambient-mode.c b/src/display/ambient-mode.c
index 05777e31..fb8809b9 100644
--- a/src/display/ambient-mode.c
+++ b/src/display/ambient-mode.c
@@ -261,10 +261,6 @@ static void ambient_init(void *data)
{
int ret;
- disp_plgn = get_display_plugin();
- if (!disp_plgn)
- _E("Failed to get display plugin.");
-
ret = vconf_get_bool("db/starter/always_on_display", &ambient_condition);
if (ret < 0) {
_E("Failed to get initial AOD condition. AOD is not going to work.");
@@ -307,3 +303,11 @@ static const struct display_ops ambient_ops = {
};
DISPLAY_OPS_REGISTER(&ambient_ops)
+
+static void __CONSTRUCTOR__ initialize(void)
+{
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
+}
diff --git a/src/display/display-dbus.c b/src/display/display-dbus.c
index e66c78eb..3cd7f200 100644
--- a/src/display/display-dbus.c
+++ b/src/display/display-dbus.c
@@ -1278,12 +1278,6 @@ int init_pm_dbus(void)
{
int ret;
- disp_plgn = get_display_plugin();
- if (!disp_plgn) {
- _E("Failed to get display plugin.");
- return -1;
- }
-
display_add_actor(&display_api_actor);
display_add_actor(&display_gesture_actor);
@@ -1304,3 +1298,10 @@ int init_pm_dbus(void)
return 0;
}
+static void __CONSTRUCTOR__ initialize(void)
+{
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
+}
diff --git a/src/display/display-signal.c b/src/display/display-signal.c
index 0abfb043..e695e995 100644
--- a/src/display/display-signal.c
+++ b/src/display/display-signal.c
@@ -174,7 +174,10 @@ void set_process_active(bool flag, pid_t pid)
_E("Failed to send dbus signal to resourced.");
}
-void set_display_signal_display_plugin(struct display_plugin *dp)
+static void __CONSTRUCTOR__ initialize(void)
{
- disp_plgn = dp;
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
}
diff --git a/src/display/display-signal.h b/src/display/display-signal.h
index 35c367df..f68b0b22 100644
--- a/src/display/display-signal.h
+++ b/src/display/display-signal.h
@@ -23,7 +23,6 @@
#include <libsyscommon/dbus-system.h>
#include "util.h"
-#include "display-ops.h"
#include "core/devices.h"
#include "core/device-notifier.h"
@@ -58,6 +57,5 @@ void broadcast_lcd_on(enum signal_type type, enum device_flags flags);
void broadcast_lcd_off(enum signal_type type, enum device_flags flags);
void broadcast_lcd_off_late(enum device_flags flags);
void set_process_active(bool flag, pid_t pid);
-void set_display_signal_display_plugin(struct display_plugin *dp);
#endif /* __DISPLAY_SIGNAL_H__ */
diff --git a/src/display/poll.c b/src/display/poll.c
index 548f186e..279675c5 100644
--- a/src/display/poll.c
+++ b/src/display/poll.c
@@ -177,13 +177,15 @@ static int __pm_change_internal(pid_t pid, int s_bits)
void init_pm_internal()
{
+ disp_plgn->pm_lock_internal = __pm_lock_internal;
+ disp_plgn->pm_unlock_internal = __pm_unlock_internal;
+ disp_plgn->pm_change_internal = __pm_change_internal;
+}
+
+static void __CONSTRUCTOR__ initialize(void)
+{
disp_plgn = get_display_plugin();
if (!disp_plgn) {
_E("Failed to get display plugin.");
- return ;
}
-
- disp_plgn->pm_lock_internal = __pm_lock_internal;
- disp_plgn->pm_unlock_internal = __pm_unlock_internal;
- disp_plgn->pm_change_internal = __pm_change_internal;
}
diff --git a/src/display/setting.c b/src/display/setting.c
index 30065cc4..05520014 100644
--- a/src/display/setting.c
+++ b/src/display/setting.c
@@ -248,12 +248,6 @@ int init_setting(int (*func) (int key_idx, int val))
{
int i;
- disp_plgn = get_display_plugin();
- if (!disp_plgn) {
- _E("Failed to get display plugin.");
- return -1;
- }
-
if (func != NULL)
disp_plgn->update_pm_setting = func;
@@ -281,3 +275,10 @@ int exit_setting(void)
return 0;
}
+static void __CONSTRUCTOR__ initialize(void)
+{
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
+}
diff --git a/src/extcon/cradle.c b/src/extcon/cradle.c
index 9bc51d70..72e368c3 100644
--- a/src/extcon/cradle.c
+++ b/src/extcon/cradle.c
@@ -125,10 +125,6 @@ static void cradle_init(void *data)
{
int ret;
- disp_plgn = get_display_plugin();
- if (!disp_plgn)
- _E("Failed to get display plugin.");
-
register_notifier(DEVICE_NOTIFIER_LCD, display_changed);
ret = dbus_handle_add_dbus_object(NULL, DEVICED_PATH_SYSNOTI, &dbus_interface);
@@ -149,3 +145,11 @@ static struct extcon_ops cradle_extcon_ops = {
};
EXTCON_OPS_REGISTER(cradle_extcon_ops)
+
+static void __CONSTRUCTOR__ initialize(void)
+{
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
+}
diff --git a/src/extcon/earjack.c b/src/extcon/earjack.c
index fe8e5f92..003b7bb1 100644
--- a/src/extcon/earjack.c
+++ b/src/extcon/earjack.c
@@ -88,17 +88,17 @@ static int earjack_update(int status)
return 0;
}
-static void earjack_init(void *data)
-{
- disp_plgn = get_display_plugin();
- if (!disp_plgn)
- _E("Failed to get display plugin.");
-}
-
static struct extcon_ops earjack_extcon_ops = {
.name = EXTCON_CABLE_HEADPHONE_OUT,
- .init = earjack_init,
.update = earjack_update,
};
EXTCON_OPS_REGISTER(earjack_extcon_ops)
+
+static void __CONSTRUCTOR__ initialize(void)
+{
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
+}
diff --git a/src/extcon/hdmi.c b/src/extcon/hdmi.c
index a94e2009..9eac710d 100644
--- a/src/extcon/hdmi.c
+++ b/src/extcon/hdmi.c
@@ -120,10 +120,6 @@ static void hdmi_init(void *data)
{
int ret;
- disp_plgn = get_display_plugin();
- if (!disp_plgn)
- _E("Failed to get display plugin.");
-
register_notifier(DEVICE_NOTIFIER_LCD, display_changed);
ret = dbus_handle_add_dbus_object(NULL, DEVICED_PATH_SYSNOTI, &dbus_interface);
@@ -144,3 +140,11 @@ static struct extcon_ops hdmi_extcon_ops = {
};
EXTCON_OPS_REGISTER(hdmi_extcon_ops)
+
+static void __CONSTRUCTOR__ initialize(void)
+{
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
+}
diff --git a/src/led/touch-key.c b/src/led/touch-key.c
index 0e677163..6f679be0 100644
--- a/src/led/touch-key.c
+++ b/src/led/touch-key.c
@@ -260,12 +260,6 @@ static int touchled_service_free(void)
static int touchled_probe(void *data)
{
- disp_plgn = get_display_plugin();
- if (!disp_plgn) {
- _E("Failed to get display plugin.");
- return -1;
- }
-
/* load led device */
return touchled_service_load();
}
@@ -333,3 +327,11 @@ static const struct device_ops touchled_device_ops = {
};
DEVICE_OPS_REGISTER(&touchled_device_ops)
+
+static void __CONSTRUCTOR__ initialize(void)
+{
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
+}
diff --git a/src/power/boot.c b/src/power/boot.c
index feadbd8d..24fc3ead 100644
--- a/src/power/boot.c
+++ b/src/power/boot.c
@@ -79,16 +79,9 @@ static void booting_done_received(GDBusConnection *conn,
remove_booting_done_handler(NULL);
- if (!disp_plgn)
- disp_plgn = get_display_plugin();
-
- if (!disp_plgn)
- _E("Failed to get display plugin.");
- else {
- _I("Real booting done. Unlock LCD_OFF.");
- if (disp_plgn->pm_unlock_internal)
- disp_plgn->pm_unlock_internal(INTERNAL_LOCK_BOOTING, LCD_OFF, PM_SLEEP_MARGIN);
- }
+ _I("Real booting done. Unlock LCD_OFF.");
+ if (disp_plgn->pm_unlock_internal)
+ disp_plgn->pm_unlock_internal(INTERNAL_LOCK_BOOTING, LCD_OFF, PM_SLEEP_MARGIN);
_I("Signal booting done.");
@@ -120,3 +113,11 @@ void add_booting_done_handler(void *data)
if (sig_id[1] <= 0)
_E("Failed to init dbus signal(%s).", SYSTEMD_DBUS_SIGNAL_USER_STARTUP_FINISHED);
}
+
+static void __CONSTRUCTOR__ initialize(void)
+{
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
+}
diff --git a/src/power/power-handler.c b/src/power/power-handler.c
index 6300c843..4376b577 100644
--- a/src/power/power-handler.c
+++ b/src/power/power-handler.c
@@ -750,25 +750,10 @@ out:
return done;
}
-static int power_probe(void *data)
-{
- disp_plgn = get_display_plugin();
- if (!disp_plgn) {
- _E("Failed to get display plugin.");
- return -1;
- }
-
- return 0;
-}
-
static void power_init(void *data)
{
int ret;
- disp_plgn = get_display_plugin();
- if (!disp_plgn)
- _E("Failed to get display plugin.");
-
/* init dbus interface */
ret = dbus_handle_add_dbus_object(NULL, DEVICED_PATH_POWEROFF, &dbus_interface);
if (ret < 0)
@@ -791,9 +776,16 @@ static void power_init(void *data)
static const struct device_ops power_device_ops = {
DECLARE_NAME_LEN(POWER_OPS_NAME),
- .probe = power_probe,
.init = power_init,
.execute = power_execute,
};
DEVICE_OPS_REGISTER(&power_device_ops)
+
+static void __CONSTRUCTOR__ initialize(void)
+{
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
+}
diff --git a/src/time/time-handler.c b/src/time/time-handler.c
index 0d8d2ff4..bac2374c 100644
--- a/src/time/time-handler.c
+++ b/src/time/time-handler.c
@@ -387,16 +387,6 @@ out:
return 0;
}
-static int time_probe(void *data)
-{
- disp_plgn = get_display_plugin();
- if (!disp_plgn) {
- _E("Failed to get display plugin.");
- return -1;
- }
- return 0;
-}
-
static void time_init(void *data)
{
int ret;
@@ -416,8 +406,15 @@ static void time_init(void *data)
static const struct device_ops time_device_ops = {
.name = "time",
- .probe = time_probe,
.init = time_init,
};
DEVICE_OPS_REGISTER(&time_device_ops)
+
+static void __CONSTRUCTOR__ initialize(void)
+{
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
+}
diff --git a/src/touchscreen/touchscreen.c b/src/touchscreen/touchscreen.c
index 2be7c1c5..295503bb 100644
--- a/src/touchscreen/touchscreen.c
+++ b/src/touchscreen/touchscreen.c
@@ -103,12 +103,6 @@ static int touchscreen_probe(void *data)
int ret;
struct hw_info *info;
- disp_plgn = get_display_plugin();
- if (!disp_plgn) {
- _E("Failed to get display plugin.");
- return -1;
- }
-
if (touchscreen_dev)
return 0;
@@ -366,3 +360,10 @@ static const struct device_ops touchscreen_device_ops = {
DEVICE_OPS_REGISTER(&touchscreen_device_ops)
+static void __CONSTRUCTOR__ initialize(void)
+{
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
+}
diff --git a/src/usb/usb.c b/src/usb/usb.c
index b82534db..691d0c33 100644
--- a/src/usb/usb.c
+++ b/src/usb/usb.c
@@ -450,10 +450,6 @@ static void usb_init(void *data)
{
int ret;
- disp_plgn = get_display_plugin();
- if (!disp_plgn)
- _E("Failed to get display plugin.");
-
usb_state_retrieve_selected_mode();
ret = usb_probe();
@@ -501,3 +497,11 @@ static struct extcon_ops extcon_usb_ops = {
};
EXTCON_OPS_REGISTER(extcon_usb_ops)
+
+static void __CONSTRUCTOR__ initialize(void)
+{
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
+}
diff --git a/src/usbhost/usb-host.c b/src/usbhost/usb-host.c
index 12f8d060..fd076fee 100644
--- a/src/usbhost/usb-host.c
+++ b/src/usbhost/usb-host.c
@@ -1128,19 +1128,6 @@ static int booting_done(void *data)
return 0;
}
-static int usbhost_probe(void *data)
-{
- if (!disp_plgn)
- disp_plgn = get_display_plugin();
-
- if (!disp_plgn) {
- _E("Failed to get display plugin.");
- return -1;
- }
-
- return 0;
-}
-
static void usbhost_init(void *data)
{
int ret;
@@ -1195,22 +1182,12 @@ static void usbhost_exit(void *data)
static const struct device_ops usbhost_device_ops = {
.name = "usbhost",
- .probe = usbhost_probe,
.init = usbhost_init,
.exit = usbhost_exit,
};
DEVICE_OPS_REGISTER(&usbhost_device_ops)
-static void extcon_usbhost_init()
-{
- if (!disp_plgn)
- disp_plgn = get_display_plugin();
-
- if (!disp_plgn)
- _E("Failed to get display plugin.");
-}
-
static int extcon_usbhost_state_changed(int status)
{
if (status == USBHOST_DISCONNECTED) {
@@ -1227,8 +1204,15 @@ static int extcon_usbhost_state_changed(int status)
static struct extcon_ops extcon_usbhost_ops = {
.name = EXTCON_CABLE_USB_HOST,
- .init = extcon_usbhost_init,
.update = extcon_usbhost_state_changed,
};
EXTCON_OPS_REGISTER(extcon_usbhost_ops)
+
+static void __CONSTRUCTOR__ initialize(void)
+{
+ disp_plgn = get_display_plugin();
+ if (!disp_plgn) {
+ _E("Failed to get display plugin.");
+ }
+}