apply device registration 85/14685/1
authorjy910.yun <jy910.yun@samsung.com>
Sun, 30 Jun 2013 08:57:59 +0000 (17:57 +0900)
committerKrzysztof Sasiak <k.sasiak@samsung.com>
Thu, 9 Jan 2014 16:36:13 +0000 (17:36 +0100)
details:
sysnoti, noti, core, signal, predefine, lowmem, lowbat, device change handler,
power, bs, process monitor, time handler, cpu, usb, ta, process manager, mmc,
heynoti, powermanager and vibrator changed

before changing, to invoke a initialize function, it must call directly in main func.
So if some function deleted, we have to delete related part on each files.
but after applying this patchset, we only have to delete just one file regarding function you want delete.

Change-Id: I7283b9ed48afbf0c3ba05d383993610a4ac154d5
Signed-off-by: jy910.yun <jy910.yun@samsung.com>
41 files changed:
CMakeLists.txt
display/core.c
display/core.h
display/display-dbus.c
packaging/system-server.spec
src/battery/lowbat-handler.c
src/battery/lowbat-handler.h [deleted file]
src/bs/bs.c
src/core/common.h
src/core/core.c
src/core/core.h
src/core/device-change-handler.c
src/core/device-handler.h
src/core/devices.c [new file with mode: 0644]
src/core/devices.h [new file with mode: 0644]
src/core/edbus-handler.c
src/core/edbus-handler.h
src/core/main.c
src/core/noti.c
src/core/noti.h
src/core/predefine.c
src/core/predefine.h
src/core/queue.c
src/core/queue.h
src/core/sig-handler.c
src/core/sysnoti.c
src/core/sysnoti.h
src/cpu/cpu-handler.c
src/led/led.c
src/led/led.h [deleted file]
src/mmc/mmc-handler.c
src/power/power-handler.c
src/proc/lowmem-handler.c
src/proc/lowmem-handler.h [deleted file]
src/proc/pmon-handler.c
src/proc/proc-handler.c
src/proc/proc-handler.h
src/ta/ta-handler.c
src/time/time-handler.c
src/usb/usb-handler.c
src/vibrator/vibrator.c

index e600905..de34f2b 100755 (executable)
@@ -18,6 +18,7 @@ SET(SRCS
        src/core/launch.c
        src/core/queue.c
        src/core/core.c
+       src/core/devices.c
        src/core/sig-handler.c
        src/core/log.c
        src/core/device-change-handler.c
index ea1512b..6257492 100644 (file)
@@ -45,6 +45,7 @@
 #include "device-node.h"
 #include "core/queue.h"
 #include "core/data.h"
+#include "core/devices.h"
 
 #define USB_CON_PIDFILE                        "/var/run/.system_server.pid"
 #define PM_STATE_LOG_FILE              "/var/log/pm_state.log"
@@ -1554,7 +1555,7 @@ static int noti_fd = -1;
  * Power manager Main
  *
  */
-void start_pm_main(void)
+static void start_pm_main(void *data)
 {
        int ret, i;
        unsigned int flags = (WITHOUT_STARTNOTI | FLAG_X_DPMS);
@@ -1618,7 +1619,7 @@ void start_pm_main(void)
        }
 }
 
-void end_pm_main(void)
+static void end_pm_main(void *data)
 {
        int i;
 
@@ -1646,6 +1647,11 @@ void end_pm_main(void)
        LOGINFO("Stop power manager");
 }
 
+const struct device_ops display_device_ops = {
+       .init = start_pm_main,
+       .exit = end_pm_main,
+};
+
 /**
  * @}
  */
index db4bcd2..46cfd12 100644 (file)
@@ -115,16 +115,6 @@ int (*pm_init_extention) (void *data);             /**< extention init function */
 void (*pm_exit_extention) (void);              /**< extention exit function */
 int check_processes(enum state_t prohibit_state);
 
-/*
- * Power manager Main loop
- *
- * @internal
- * @param[in] flags If the first bit of this is set, start managing without Start notification.
- *                                     If the second bit of ths is set, use unified device manager functions.
- */
-void start_pm_main(void);
-void end_pm_main(void);
-
 /**
  * @}
  */
index da490d9..bbc4189 100644 (file)
 #include "core.h"
 #include "device-node.h"
 #include "core/common.h"
-
+#include "core/devices.h"
 
 #define DISP_INDEX_BIT 4
 #define COMBINE_DISP_CMD(cmd, prop, index) (cmd = (prop | (index << DISP_INDEX_BIT)))
 
 static DBusMessage *e_dbus_start_cb(E_DBus_Object *obj, DBusMessage *msg)
 {
-       start_pm_main();
+       display_device_ops.init(NULL);
        return dbus_message_new_method_return(msg);
 }
 
 static DBusMessage *e_dbus_stop_cb(E_DBus_Object *obj, DBusMessage *msg)
 {
-       end_pm_main();
+       display_device_ops.exit(NULL);
        return dbus_message_new_method_return(msg);
 }
 
index 011051a..1333bd1 100755 (executable)
@@ -76,7 +76,7 @@ Requires:   %{name} = %{version}-%{release}
 sysman internal devel library.
 
 %package -n libslp-pm
-Summary:    power manager client
+Summary:    Power manager client
 Group:      System/Libraries
 Requires:   %{name} = %{version}-%{release}
 
@@ -84,7 +84,7 @@ Requires:   %{name} = %{version}-%{release}
 power-manager library.
 
 %package -n libslp-pm-devel
-Summary:    power manager client (devel)
+Summary:    Power manager client (devel)
 Group:      System/Development
 Requires:   %{name} = %{version}-%{release}
 #Requires:   libslp-pm
index 5d8e527..85a5869 100644 (file)
@@ -27,6 +27,8 @@
 #include "core/noti.h"
 #include "core/queue.h"
 #include "core/data.h"
+#include "core/devices.h"
+#include "device-node.h"
 #include "display/setting.h"
 
 #define PREDEF_LOWBAT                  "lowbat"
@@ -473,8 +475,10 @@ int lowbat_def_predefine_action(int argc, char **argv)
        return 0;
 }
 
-void ss_predefine_lowbat_init(void)
+static void lowbat_init(void *data)
 {
+       struct ss_main_data *ad = (struct ss_main_data*)data;
+
        ss_action_entry_add_internal(PREDEF_LOWBAT, lowbat_def_predefine_action,
                                     NULL, NULL);
 }
@@ -492,6 +496,8 @@ int ss_lowbat_init(struct ss_main_data *ad)
        ss_lowbat_is_charge_in_now();
 
        vconf_notify_key_changed(VCONFKEY_PM_STATE, (void *)wakeup_cb, NULL);
-
-       return 0;
 }
+
+const struct device_ops lowbat_device_ops = {
+       .init = lowbat_init,
+};
diff --git a/src/battery/lowbat-handler.h b/src/battery/lowbat-handler.h
deleted file mode 100644 (file)
index b7b36c6..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- *  system-server
- *
- * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
-*/ 
-
-
-#ifndef __LOWBAT_HANDLER_H__
-#define __LOWBAT_HANDLER_H__
-
-void ss_predefine_lowbat_init(void);
-#endif /* __LOWBAT_HANDLER_H__ */
index d5bfd59..485ad27 100644 (file)
@@ -30,6 +30,7 @@
 #include <Ecore_File.h>
 #include "core/log.h"
 #include "core/launch.h"
+#include "core/devices.h"
 
 #define CRASH_PID_MAX 7
 #define CRASH_MODE_MAX 2
@@ -407,7 +408,7 @@ static int _check_disk_available(void)
        return 1;
 }
 
-int ss_bs_init(void)
+static void bs_init(void *data)
 {
        if (make_noti_file(CRASH_NOTI_DIR, CRASH_NOTI_FILE) < 0) {
                _E("make_noti_file() failed");
@@ -434,8 +435,10 @@ int ss_bs_init(void)
        if (!crash_file_monitor) {
                _E("ecore_file_monitor_add() failed");
                launch_crash_worker(CRASH_NOTI_PATH, CRASH_POPUP_OFF);
-               return -1;
+               return;
        }
-
-       return 0;
 }
+
+const struct device_ops bs_device_ops = {
+       .init = bs_init,
+};
index f04bcea..f3c80f4 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _SS_COMMON_H
 #define _SS_COMMON_H
 
+#include <unistd.h>
+
 #define ARRAY_SIZE(name) (sizeof(name)/sizeof(name[0]))
 
 FILE * open_proc_oom_adj_file(int pid, const char *mode);
index 6a9cdd7..de53625 100644 (file)
@@ -20,6 +20,7 @@
 #include "log.h"
 #include "predefine.h"
 #include "core.h"
+#include "devices.h"
 
 enum ss_core_cmd_type {
        SS_CORE_ACT_RUN,
@@ -129,18 +130,6 @@ int ss_core_action_clear(int pid)
        return 0;
 }
 
-int ss_core_init(struct ss_main_data *ad)
-{
-       __pipe_stop(core_pipe[0]);
-       __pipe_stop(core_pipe[1]);
-
-       if (__pipe_start(ad) == -1) {
-               _E("fail pipe control fd init");
-               return -1;
-       }
-       return 0;
-}
-
 static int __pipe_start(struct ss_main_data *ad)
 {
        if (pipe(core_pipe) < 0) {
@@ -168,3 +157,18 @@ static int __pipe_stop(int fd)
 
        return 0;
 }
+
+static void core_init(void *data)
+{
+       struct ss_main_data *ad = (struct ss_main_data*)data;
+
+       __pipe_stop(core_pipe[0]);
+       __pipe_stop(core_pipe[1]);
+
+       if (__pipe_start(ad) == -1)
+               PRT_TRACE_ERR("fail pipe control fd init");
+}
+
+const struct device_ops core_device_ops = {
+       .init = core_init,
+};
index 34f5501..86a27cd 100644 (file)
 #ifndef __CORE_H__
 #define __CORE_H__
 
-#include "data.h"
-
 int ss_core_action_run();
 int ss_core_action_clear(int pid);
-int ss_core_init(struct ss_main_data *ad);
 
 #endif /* __CORE_H__ */
index c5cb5ab..7cc0fb7 100644 (file)
 #include <aul.h>
 #include <bundle.h>
 #include <dirent.h>
-#include "dd-deviced.h"
 #include <libudev.h>
+#include "dd-deviced.h"
 #include <device-node.h>
 #include "queue.h"
 #include "log.h"
 #include "device-handler.h"
 #include "noti.h"
 #include "data.h"
-#include "sys_pci_noti/sys_pci_noti.h"
 #include "predefine.h"
 #include "display/poll.h"
+#include "devices.h"
+#include "sys_pci_noti/sys_pci_noti.h"
 
 #define PREDEF_USBCON                  "usbcon"
 #define PREDEF_EARJACKCON              "earjack_predef_internal"
@@ -709,39 +710,32 @@ static void pci_keyboard_remove_cb(struct ss_main_data *ad)
        ss_launch_if_noexist("/usr/bin/sys_pci_noti", params);
 }
 
-void ss_predefine_device_change_init(void)
+static void device_change_init(void *data)
 {
        ss_action_entry_add_internal(PREDEF_USBCON, usbcon_def_predefine_action, NULL, NULL);
        ss_action_entry_add_internal(PREDEF_EARJACKCON, earjackcon_def_predefine_action, NULL, NULL);
        ss_action_entry_add_internal(PREDEF_BATTERY_CF_OPENED, battery_def_cf_opened_actioin, NULL, NULL);
-}
-
-int ss_device_change_init(struct ss_main_data *ad)
-{
        ss_action_entry_add_internal(PREDEF_DEVICE_CHANGED, changed_device_def_predefine_action, NULL, NULL);
 
        if (uevent_control_start() == -1) {
                _E("fail uevent control init");
-               return -1;
+               return;
        }
        /* for simple noti change cb */
-       ss_noti_add("device_usb_chgdet", (void *)usb_chgdet_cb, (void *)ad);
-       ss_noti_add("device_ta_chgdet", (void *)ta_chgdet_cb, (void *)ad);
-       ss_noti_add("device_earjack_chgdet", (void *)earjack_chgdet_cb, (void *)ad);
-       ss_noti_add("device_earkey_chgdet", (void *)earkey_chgdet_cb, (void *)ad);
-       ss_noti_add("device_tvout_chgdet", (void *)tvout_chgdet_cb, (void *)ad);
-       ss_noti_add("device_hdmi_chgdet", (void *)hdmi_chgdet_cb, (void *)ad);
-       ss_noti_add("device_keyboard_chgdet", (void *)keyboard_chgdet_cb, (void *)ad);
-
-       ss_noti_add("device_usb_host_add", (void *)usb_host_add_cb, (void *)ad);
+       ss_noti_add("device_usb_chgdet", (void *)usb_chgdet_cb, data);
+       ss_noti_add("device_ta_chgdet", (void *)ta_chgdet_cb, data);
+       ss_noti_add("device_earjack_chgdet", (void *)earjack_chgdet_cb, data);
+       ss_noti_add("device_earkey_chgdet", (void *)earkey_chgdet_cb, data);
+       ss_noti_add("device_tvout_chgdet", (void *)tvout_chgdet_cb, data);
+       ss_noti_add("device_hdmi_chgdet", (void *)hdmi_chgdet_cb, data);
+       ss_noti_add("device_keyboard_chgdet", (void *)keyboard_chgdet_cb, data);
+       ss_noti_add("device_usb_host_add", (void *)usb_host_add_cb, data);
        ss_noti_add("mmcblk_add", (void *)mmc_chgdet_cb, (void *)1);
        ss_noti_add("mmcblk_remove", (void *)mmc_chgdet_cb, NULL);
-
        ss_noti_add("unmount_ums", (void *)ums_unmount_cb, NULL);
-       ss_noti_add("device_charge_chgdet", (void *)charge_cb, (void *)ad);
-
-       ss_noti_add("device_pci_keyboard_add", (void *)pci_keyboard_add_cb, (void *)ad);
-       ss_noti_add("device_pci_keyboard_remove", (void *)pci_keyboard_remove_cb, (void *)ad);
+       ss_noti_add("device_charge_chgdet", (void *)charge_cb, data);
+       ss_noti_add("device_pci_keyboard_add", (void *)pci_keyboard_add_cb, data);
+       ss_noti_add("device_pci_keyboard_remove", (void *)pci_keyboard_remove_cb, data);
 
        if (vconf_notify_key_changed(VCONFKEY_SYSMAN_USB_HOST_STATUS, usb_host_chgdet_cb, NULL) < 0) {
                _E("vconf key notify failed(VCONFKEY_SYSMAN_USB_HOST_STATUS)");
@@ -758,7 +752,7 @@ int ss_device_change_init(struct ss_main_data *ad)
 
        e_dbus_signal_handler_add(conn, NULL, "/system/uevent/xxxxx",
                                  "system.uevent.xxxxx",
-                                 "Change", cb_xxxxx_signaled, ad);
+                                 "Change", cb_xxxxx_signaled, data);
 #endif                         /* ENABLE_EDBUS_USE */
 
        /* set initial state for devices */
@@ -766,6 +760,8 @@ int ss_device_change_init(struct ss_main_data *ad)
        keyboard_chgdet_cb(NULL);
        hdmi_chgdet_cb(NULL);
        system(STORE_DEFAULT_USB_INFO);
-
-       return 0;
 }
+
+const struct device_ops change_device_ops = {
+       .init = device_change_init,
+};
index 7ebafd3..506a136 100644 (file)
@@ -21,7 +21,6 @@
 #include "data.h"
 
 /* MMC functions */
-int ss_mmc_init();
 int ss_mmc_inserted();
 int ss_mmc_removed();
 
@@ -29,21 +28,8 @@ int ss_mmc_removed();
 int _ss_usb_storage_init(void);
 
 /* Battery functions */
-int ss_lowbat_init(struct ss_main_data *ad);
 int ss_lowbat_is_charge_in_now();
 int ss_lowbat_set_charge_on(int onoff);
 int ss_lowbat_monitor(void *data);
 
-/* Low memory functions */
-int ss_lowmem_init(struct ss_main_data *ad);
-
-/* USB functions */
-int ss_usb_init();
-
-/* TA functions */
-int ss_ta_init();
-
-/* device change init */
-int ss_device_change_init(struct ss_main_data *ad);
-
 #endif /* __DEVICE_HANDLER_H__ */
diff --git a/src/core/devices.c b/src/core/devices.c
new file mode 100644 (file)
index 0000000..4373b80
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * deviced
+ * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+
+#include "log.h"
+#include "devices.h"
+#include "common.h"
+
+static const struct device_ops *devices[] = {
+       /* The below devices have init dependency with other module */
+       &edbus_device_ops,
+       &display_device_ops,
+       /* The below devices don't have any init dependency */
+       &sysnoti_device_ops,
+       &noti_device_ops,
+       &core_device_ops,
+       &signal_device_ops,
+       &predefine_device_ops,
+       &lowmem_device_ops,
+       &lowbat_device_ops,
+       &change_device_ops,
+       &power_device_ops,
+       &bs_device_ops,
+       &process_device_ops,
+       &time_device_ops,
+       &cpu_device_ops,
+       &usb_device_ops,
+       &ta_device_ops,
+       &pmon_device_ops,
+       &mmc_device_ops,
+       &led_device_ops,
+       &vibrator_device_ops,
+};
+
+void devices_init(void *data)
+{
+       int i;
+       int size;
+       struct device_ops *dev;
+
+       size = ARRAY_SIZE(devices);
+       for(i = 0; i < size; ++i) {
+               dev = devices[i];
+               if (dev->init)
+                       dev->init(data);
+       }
+}
+
+void devices_exit(void *data)
+{
+       int i;
+       int size;
+       struct device_ops *dev;
+
+       size = ARRAY_SIZE(devices);
+       for(i = 0; i < size; ++i) {
+               dev = devices[i];
+               if (dev->exit)
+                       dev->exit(data);
+       }
+}
diff --git a/src/core/devices.h b/src/core/devices.h
new file mode 100644 (file)
index 0000000..4c98ce2
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * deviced
+ * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __DEVICES_H__
+#define __DEVICES_H__
+
+struct device_ops {
+       void (*init) (void *data);
+       void (*exit) (void *data);
+};
+
+void devices_init(void *data);
+void devices_exit(void *data);
+
+extern const struct device_ops edbus_device_ops;
+extern const struct device_ops display_device_ops;
+extern const struct device_ops sysnoti_device_ops;
+extern const struct device_ops noti_device_ops;
+extern const struct device_ops core_device_ops;
+extern const struct device_ops signal_device_ops;
+extern const struct device_ops predefine_device_ops;
+extern const struct device_ops lowmem_device_ops;
+extern const struct device_ops lowbat_device_ops;
+extern const struct device_ops change_device_ops;
+extern const struct device_ops power_device_ops;
+extern const struct device_ops bs_device_ops;
+extern const struct device_ops process_device_ops;
+extern const struct device_ops time_device_ops;
+extern const struct device_ops cpu_device_ops;
+extern const struct device_ops usb_device_ops;
+extern const struct device_ops ta_device_ops;
+extern const struct device_ops pmon_device_ops;
+extern const struct device_ops mmc_device_ops;
+extern const struct device_ops led_device_ops;
+extern const struct device_ops vibrator_device_ops;
+
+#endif
index 346714c..895343c 100644 (file)
@@ -22,6 +22,7 @@
 #include "core/data.h"
 #include "core/edbus-handler.h"
 #include "core/common.h"
+#include "core/devices.h"
 
 #define EDBUS_INIT_RETRY_COUNT 5
 
@@ -210,14 +211,7 @@ int register_edbus_signal_handler(char *signal_name, E_DBus_Signal_Cb cb)
        return 0;
 }
 
-void edbus_fini(void)
-{
-       unregister_edbus_signal_handle();
-       e_dbus_connection_close(edbus_conn);
-       e_dbus_shutdown();
-}
-
-void edbus_init(void)
+static void edbus_init(void *data)
 {
        int retry = EDBUS_INIT_RETRY_COUNT;
        int i, r;
@@ -273,3 +267,14 @@ err_dbus_shutdown:
        return;
 }
 
+static void edbus_exit(void *data)
+{
+       unregister_edbus_signal_handle();
+       e_dbus_connection_close(edbus_conn);
+       e_dbus_shutdown();
+}
+
+const struct device_ops edbus_device_ops = {
+       .init = edbus_init,
+       .exit = edbus_exit,
+};
index 2060cd9..568c250 100644 (file)
@@ -44,8 +44,6 @@
 #define DEVICED_PATH_DISPLAY           OBJECT_PATH"/Display"
 #define DEVICED_INTERFACE_DISPLAY      INTERFACE_NAME".display"
 
-void edbus_init(void);
-void edbus_fini(void);
 int register_edbus_signal_handler(char *signal_name, E_DBus_Signal_Cb cb);
 E_DBus_Interface *get_edbus_interface(const char *path);
 pid_t get_edbus_sender_pid(DBusMessage *msg);
index 8c0d73e..3deb4ce 100644 (file)
 
 #include <stdio.h>
 #include <fcntl.h>
-#include <heynoti.h>
 #include <sys/reboot.h>
 #include "log.h"
-#include "core.h"
-#include "sig-handler.h"
-#include "device-handler.h"
-#include "proc/pmon-handler.h"
-#include "sysnoti.h"
-#include "noti.h"
-#include "queue.h"
-#include "predefine.h"
-#include "bs/bs.h"
-#include "proc/procmgr.h"
-#include "time/time-handler.h"
-#include "cpu/cpu-handler.h"
 #include "data.h"
-#include "cpu/cpu-handler.h"
-#include "data.h"
-#include "led/led.h"
-#include "proc/lowmem-handler.h"
-#include "battery/lowbat-handler.h"
-#include "proc/pmon-handler.h"
-#include "proc/proc-handler.h"
-#include "time/time-handler.h"
-#include "vibrator/vibrator.h"
-#include "sysnoti.h"
+#include "devices.h"
 
-static void fini(struct ss_main_data *ad)
-{
-}
+#define SS_PIDFILE_PATH                "/var/run/.system_server.pid"
 
 static void init_ad(struct ss_main_data *ad)
 {
@@ -64,68 +40,22 @@ static void writepid(char *pidpath)
        }
 }
 
-static void system_server_init(struct ss_main_data *ad)
-{
-       ad->sysnoti_fd = ss_sysnoti_init();
-       if (ss_noti_init() < 0)
-               _E("init noti error");
-
-       ss_queue_init();
-       ss_core_init(ad);
-       ss_signal_init();
-       ss_predefine_internal_init();
-       ss_predefine_lowmem_init();
-       ss_predefine_lowbat_init();
-       ss_predefine_device_change_init();
-       ss_predefine_power_init();
-       ss_process_manager_init();
-       ss_time_manager_init();
-       ss_cpu_handler_init();
-
-       ss_lowmem_init(ad);
-       ss_lowbat_init(ad);
-       ss_power_init(ad);
-       ss_usb_init();
-       ss_ta_init();
-       ss_pmon_init(ad);
-       ss_device_change_init(ad);
-       led_init();
-       ss_mmc_init();
-       ss_bs_init();
-       vibrator_init();
-}
-
-#define SS_PIDFILE_PATH                "/var/run/.system_server.pid"
 static void sig_quit(int signo)
 {
-       PRT_TRACE_ERR("received SIGTERM signal %d", signo);
+       _E("received SIGTERM signal %d", signo);
 }
+
 static int system_main(int argc, char **argv)
 {
        struct ss_main_data ad;
 
        init_ad(&ad);
-       if ((ad.noti_fd = heynoti_init()) < 0) {
-               _E("Hey Notification Initialize failed");
-               fini(&ad);
-               return 0;
-       }
-       if (heynoti_attach_handler(ad.noti_fd) != 0) {
-               _E("fail to attach hey noti handler");
-               fini(&ad);
-               return 0;
-       }
-       edbus_init();
-       system_server_init(&ad);
-       start_pm_main();
+       devices_init(&ad);
        signal(SIGTERM, sig_quit);
        ecore_main_loop_begin();
 
-       end_pm_main();
-       fini(&ad);
-       edbus_fini();
+       devices_exit(&ad);
        ecore_shutdown();
-
        return 0;
 }
 
index afb78b2..3d8100a 100644 (file)
@@ -17,6 +17,8 @@
 
 #include <heynoti.h>
 #include "log.h"
+#include "data.h"
+#include "devices.h"
 
 static int noti_fd;
 
@@ -30,26 +32,48 @@ int ss_noti_send(char *filename)
        return heynoti_publish(filename);
 }
 
-int ss_noti_init()
+int ss_noti_add(const char *noti, void (*cb) (void *), void *data)
+{
+       if (noti_fd < 0)
+               return -1;
+
+       return heynoti_subscribe(noti_fd, noti, cb, data);
+}
+
+static void noti_init(void *data)
 {
+       struct ss_main_data *ad = (struct ss_main_data*)data;
+
+       if ((ad->noti_fd = heynoti_init()) < 0) {
+               PRT_TRACE_ERR("Hey Notification Initialize failed");
+               return;
+       }
+       if (heynoti_attach_handler(ad->noti_fd) != 0) {
+               PRT_TRACE_ERR("fail to attach hey noti handler");
+               return;
+       }
+
        noti_fd = heynoti_init();
        if (noti_fd < 0) {
                _E("heynoti_init error");
-               return -1;
+               return;
        }
 
        if (heynoti_attach_handler(noti_fd) < 0) {
                _E("heynoti_attach_handler error");
-               return -1;
+               return;
        }
-
-       return 0;
 }
 
-int ss_noti_add(const char *noti, void (*cb) (void *), void *data)
+static void noti_exit(void *data)
 {
-       if (noti_fd < 0)
-               return -1;
+       struct ss_main_data *ad = (struct ss_main_data*)data;
 
-       return heynoti_subscribe(noti_fd, noti, cb, data);
+       heynoti_close(ad->noti_fd);
+       heynoti_close(noti_fd);
 }
+
+const struct device_ops noti_device_ops = {
+       .init = noti_init,
+       .exit = noti_exit,
+};
index 025e616..ac02539 100644 (file)
@@ -21,6 +21,5 @@
 int ss_noti_getfd(void);
 int ss_noti_send(char *filename);
 int ss_noti_add(const char *noti, void (*cb) (void *), void *data);
-int ss_noti_init(void);
 
 #endif /* __NOTI_H__ */
index d7e6702..eeb7f0f 100644 (file)
 #include <fcntl.h>
 #include <dirent.h>
 #include <vconf.h>
-#include <ITapiModem.h>
-#include <TelPower.h>
-#include <tapi_event.h>
-#include <tapi_common.h>
+
 #include <syspopup_caller.h>
 #include <sys/reboot.h>
 #include <sys/time.h>
 #include "queue.h"
 #include "device-node.h"
 #include "predefine.h"
-#include "proc/procmgr.h"
-#include "vibrator/vibrator.h"
+#include "proc/proc-handler.h"
 #include "core/data.h"
 #include "common.h"
 #include "display/poll.h"
 #include "setting.h"
-#include "led/led.h"
+#include "devices.h"
+
+#define PREDEFINE_SO_DIR               PREFIX"/lib/ss_predefine/"
 
-#define CALL_EXEC_PATH                 PREFIX"/bin/call"
-#define LOWMEM_EXEC_PATH               PREFIX"/bin/lowmem-popup"
 #define LOWBAT_EXEC_PATH               PREFIX"/bin/lowbatt-popup"
-#define USBCON_EXEC_PATH               PREFIX"/bin/usb-server"
-#define TVOUT_EXEC_PATH                        PREFIX"/bin/tvout-selector"
-#define PWROFF_EXEC_PATH               PREFIX"/bin/poweroff-popup"
-#define MEMPS_EXEC_PATH                        PREFIX"/bin/memps"
+
 #define HDMI_NOTI_EXEC_PATH            PREFIX"/bin/hdmi_connection_noti"
 #define LOWBAT_POPUP_NAME              "lowbat-syspopup"
 #define POWEROFF_POPUP_NAME            "poweroff-syspopup"
@@ -67,7 +60,7 @@ static int __predefine_get_pid(const char *execpath)
 
        dp = opendir("/proc");
        if (!dp) {
-               _E("open /proc");
+               PRT_TRACE_ERR("open /proc");
                return -1;
        }
 
@@ -105,7 +98,7 @@ int predefine_control_launch(char *name, bundle *b, int option)
        //lowbat-popup
        if (strncmp(name, LOWBAT_POPUP_NAME, strlen(LOWBAT_POPUP_NAME)) == 0) {
                if (launched_poweroff == 1) {
-                       _E("will be foreced power off");
+                       _E("will be forced power off");
                        internal_poweroff_def_predefine_action(0,NULL);
                        return 0;
                }
@@ -188,12 +181,11 @@ static void ss_action_entry_load_from_sodir()
        closedir(dp);
 }
 
-void ss_predefine_internal_init(void)
+static void predefine_init(void *data)
 {
-
-       /* telephony initialize */
-       int ret = 0;
-
        ss_action_entry_load_from_sodir();
-
 }
+
+const struct device_ops predefine_device_ops = {
+       .init = predefine_init,
+};
index cdf716d..bba5893 100644 (file)
@@ -20,7 +20,6 @@
 #include <bundle.h>
 
 int call_predefine_action(int argc, char **argv);
-void ss_predefine_internal_init(void);
 void predefine_pm_change_state(unsigned int s_bits);
 int predefine_control_launch(char *popup_name, bundle *b, int option);
 #endif /* __PREDEFINE_H__ */
index 130445e..7c2ba22 100644 (file)
@@ -297,8 +297,3 @@ int ss_run_queue_del_bypid(int pid)
 
        return 0;
 }
-
-void ss_queue_init()
-{
-
-}
index e7778ab..227ee6a 100644 (file)
@@ -61,6 +61,4 @@ int ss_run_queue_add(struct ss_action_entry *act_entry, int argc, char **argv);
 int ss_run_queue_del(struct ss_run_queue_entry *entry);
 int ss_run_queue_del_bypid(int pid);
 
-void ss_queue_init();
-
 #endif /* __QUEUE_H__ */
index f99596d..563cc46 100644 (file)
@@ -22,6 +22,7 @@
 #include "core.h"
 #include "core/edbus-handler.h"
 #include "display/poll.h"
+#include "devices.h"
 
 #define _E(format, args...) do { \
        char buf[255];\
@@ -61,38 +62,7 @@ static void sig_pipe_handler(int signo, siginfo_t *info, void *data)
 
 }
 
-static void poweroff_popup_edbus_signal_handler(void *data, DBusMessage *msg)
-{
-       DBusError err;
-       char *str;
-       int val = 0;
-
-       if (dbus_message_is_signal(msg, INTERFACE_NAME, SIGNAL_NAME_POWEROFF_POPUP) == 0) {
-               _D("there is no power off popup signal");
-               return;
-       }
-
-       dbus_error_init(&err);
-
-       if (dbus_message_get_args(msg, &err, DBUS_TYPE_STRING, &str, DBUS_TYPE_INVALID) == 0) {
-               _D("there is no message");
-               return;
-       }
-
-       if (strncmp(str, PREDEF_PWROFF_POPUP, strlen(PREDEF_PWROFF_POPUP)) == 0)
-               val = VCONFKEY_SYSMAN_POWER_OFF_POPUP;
-       else if (strncmp(str, PREDEF_POWEROFF, strlen(PREDEF_POWEROFF)) == 0)
-               val = VCONFKEY_SYSMAN_POWER_OFF_DIRECT;
-       else if (strncmp(str, PREDEF_POWEROFF, strlen(PREDEF_REBOOT)) == 0)
-               val = VCONFKEY_SYSMAN_POWER_OFF_RESTART;
-       if (val == 0) {
-               _D("not supported message : %s", str);
-               return;
-       }
-       vconf_set_int(VCONFKEY_SYSMAN_POWER_OFF_STATUS, val);
-}
-
-void ss_signal_init(void)
+static void signal_init(void *data)
 {
        struct sigaction sig_act;
 
@@ -107,9 +77,10 @@ void ss_signal_init(void)
        sig_act.sa_flags = SA_SIGINFO;
        sigemptyset(&sig_act.sa_mask);
        sigaction(SIGPIPE, &sig_act, &sig_pipe_old_act);
-       register_edbus_signal_handler(SIGNAL_NAME_POWEROFF_POPUP,
-                   (void *)poweroff_popup_edbus_signal_handler);
        register_edbus_signal_handler(SIGNAL_NAME_LCD_CONTROL,
                    (void *)lcd_control_edbus_signal_handler);
-
 }
+
+const struct device_ops signal_device_ops = {
+       .init = signal_init,
+};
index 5390920..1159d19 100644 (file)
@@ -26,6 +26,7 @@
 #include "log.h"
 #include "queue.h"
 #include "common.h"
+#include "devices.h"
 
 #define SYSNOTI_SOCKET_PATH "/tmp/sn"
 #define RETRY_READ_COUNT       5
@@ -322,11 +323,6 @@ static int ss_sysnoti_server_init(void)
        return fd;
 }
 
-int ss_sysnoti_init(void)
-{
-       return __sysnoti_start();
-}
-
 static int __sysnoti_start(void)
 {
        int fd;
@@ -354,3 +350,14 @@ static int __sysnoti_stop(int fd)
        }
        return 0;
 }
+
+static void sysnoti_init(void *data)
+{
+       struct ss_main_data *ad = (struct ss_main_data*)data;
+
+       ad->sysnoti_fd = __sysnoti_start();
+}
+
+const struct device_ops sysnoti_device_ops = {
+       .init = sysnoti_init,
+};
index 2095038..be58acc 100644 (file)
@@ -29,6 +29,4 @@ struct sysnoti {
        char *argv[SYSMAN_MAXARG];
 };
 
-int ss_sysnoti_init(void);
-
 #endif /* __SYSNOTI_H__ */
index b14ade1..11fb84a 100644 (file)
 
 
 #include <fcntl.h>
+#include <device-node.h>
+#include <vconf.h>
 
-#include "device-node.h"
 #include "core/log.h"
 #include "core/data.h"
-#include "vconf.h"
+#include "core/devices.h"
 
 #define PREDEF_SET_MAX_FREQUENCY       "set_max_frequency"
 #define PREDEF_SET_MIN_FREQUENCY       "set_min_frequency"
@@ -222,21 +223,6 @@ static int power_saving_cpu_cb(keynode_t *key_nodes, void *data)
        return 0;
 }
 
-int ss_cpu_handler_init(void)
-{
-       __set_freq_limit();
-
-       ss_action_entry_add_internal(PREDEF_SET_MAX_FREQUENCY, set_max_frequency_action, NULL, NULL);
-       ss_action_entry_add_internal(PREDEF_SET_MIN_FREQUENCY, set_min_frequency_action, NULL, NULL);
-       ss_action_entry_add_internal(PREDEF_RELEASE_MAX_FREQUENCY, release_max_frequency_action, NULL, NULL);
-       ss_action_entry_add_internal(PREDEF_RELEASE_MIN_FREQUENCY, release_min_frequency_action, NULL, NULL);
-
-       vconf_notify_key_changed(VCONFKEY_SETAPPL_PWRSV_SYSMODE_STATUS, (void *)power_saving_cb, NULL);
-       vconf_notify_key_changed(VCONFKEY_SETAPPL_PWRSV_CUSTMODE_CPU, (void *)power_saving_cpu_cb, NULL);
-
-       return 0;
-}
-
 static void __set_freq_limit()
 {
        int ret;
@@ -428,3 +414,20 @@ static int __write_min_cpu_freq(int freq)
        
        return 0;
 }
+
+static void cpu_init(void *data)
+{
+       __set_freq_limit();
+
+       ss_action_entry_add_internal(PREDEF_SET_MAX_FREQUENCY, set_max_frequency_action, NULL, NULL);
+       ss_action_entry_add_internal(PREDEF_SET_MIN_FREQUENCY, set_min_frequency_action, NULL, NULL);
+       ss_action_entry_add_internal(PREDEF_RELEASE_MAX_FREQUENCY, release_max_frequency_action, NULL, NULL);
+       ss_action_entry_add_internal(PREDEF_RELEASE_MIN_FREQUENCY, release_min_frequency_action, NULL, NULL);
+
+       vconf_notify_key_changed(VCONFKEY_SETAPPL_PWRSV_SYSMODE_STATUS, (void *)power_saving_cb, NULL);
+       vconf_notify_key_changed(VCONFKEY_SETAPPL_PWRSV_CUSTMODE_CPU, (void *)power_saving_cpu_cb, NULL);
+}
+
+const struct device_ops cpu_device_ops = {
+       .init = cpu_init,
+};
index 8db89a3..ec4b2a5 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "deviced/dd-led.h"
 #include "core/log.h"
+#include "core/devices.h"
 
 #define PREDEF_LED                     "led"
 
@@ -41,7 +42,7 @@ static int set_brightness(int val)
        return 0;
 }
 
-int led_def_predefine_action(int argc, char **argv)
+static int predefine_action(int argc, char **argv)
 {
        int i;
        int pid;
@@ -71,8 +72,11 @@ int led_def_predefine_action(int argc, char **argv)
        return -1;
 }
 
-int led_init(void)
+static void led_init(void *data)
 {
-       ss_action_entry_add_internal(PREDEF_LED, led_def_predefine_action, NULL, NULL);
-       return 0;
+       ss_action_entry_add_internal(PREDEF_LED, predefine_action, NULL, NULL);
 }
+
+const struct device_ops led_device_ops = {
+       .init = led_init,
+};
diff --git a/src/led/led.h b/src/led/led.h
deleted file mode 100644 (file)
index ae7c86d..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * deviced
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#ifndef __LED_H__
-#define __LED_H__
-
-int led_def_predefine_action(int argc, char **argv);
-int led_init(void);
-#endif
index 9c491fe..1017753 100644 (file)
@@ -15,6 +15,8 @@
  */
 
 
+#include <stdlib.h>
+#include <sys/stat.h>
 #include <unistd.h>
 #include <sys/mount.h>
 #include <sys/smack.h>
 #include <dirent.h>
 #include <sys/statfs.h>
 #include <bundle.h>
+#include <signal.h>
+
 #include "core/log.h"
-#include "core/device-handler.h"
 #include "core/common.h"
+#include "core/devices.h"
 
 #define VCONFKEY_INTERNAL_PRIVATE_MMC_ID       "db/private/sysman/mmc_device_id"
 
@@ -794,7 +798,7 @@ static int ss_mmc_check_smack(int argc, char **argv)
        return 0;
 }
 
-int ss_mmc_init(void)
+static void mmc_init(void *data)
 {
        ss_action_entry_add_internal(PREDEF_MOUNT_MMC, ss_mmc_inserted, NULL, NULL);
        ss_action_entry_add_internal(PREDEF_UNMOUNT_MMC, ss_mmc_unmounted, NULL, NULL);
@@ -804,6 +808,9 @@ int ss_mmc_init(void)
        ss_action_entry_add_internal(PREDEF_CHECK_MMC_PROC, mmc_check_process_launch, NULL, NULL);
        /* mmc card mount */
        if (__check_mmc_fs() != 0)
-               _E("fail to check mmc");
-       return 0;
+               _E("failed to check mmc");
 }
+
+const struct device_ops mmc_device_ops = {
+       .init = mmc_init,
+};
index 3d9e858..9d7364a 100644 (file)
@@ -44,6 +44,7 @@
 #include "core/predefine.h"
 #include "core/data.h"
 #include "core/common.h"
+#include "core/devices.h"
 #include "proc/proc-handler.h"
 #include "poll.h"
 #include "setting.h"
@@ -505,9 +506,10 @@ int restart_def_predefine_action(int argc, char **argv)
        return 0;
 }
 
-void ss_predefine_power_init(void)
+static void power_init(void *data)
 {
        int bTelReady = 0;
+
        if (vconf_get_bool(VCONFKEY_TELEPHONY_READY,&bTelReady) == 0) {
                if (bTelReady == 1) {
                        tapi_handle = tel_init(NULL);
@@ -544,12 +546,10 @@ void ss_predefine_power_init(void)
                PRT_TRACE_ERR("Vconf notify key chaneged failed: KEY(%s)", VCONFKEY_SYSMAN_POWER_OFF_STATUS);
        }
 
-}
-int ss_power_init(struct ss_main_data *ad)
-{
-
        register_edbus_signal_handler(SIGNAL_NAME_POWEROFF_POPUP,
                    (void *)poweroff_popup_edbus_signal_handler);
-       return 0;
 }
 
+const struct device_ops power_device_ops = {
+       .init = power_init,
+};
index 2ef75cd..3156383 100644 (file)
@@ -32,6 +32,7 @@
 #include "core/queue.h"
 #include "core/predefine.h"
 #include "core/data.h"
+#include "core/devices.h"
 
 #define PREDEF_LOWMEM                  "lowmem"
 #define OOM_MEM_ACT                    "oom_mem_act"
@@ -437,25 +438,24 @@ int lowmem_def_predefine_action(int argc, char **argv)
        }
        return 0;
 }
-int ss_predefine_lowmem_init(void)
-{
-       ss_action_entry_add_internal(PREDEF_LOWMEM, lowmem_def_predefine_action,
-                                    NULL, NULL);
-}
 
-int ss_lowmem_init(struct ss_main_data *ad)
+static void lowmem_init(void *data)
 {
+       struct ss_main_data *ad = (struct ss_main_data*)data;
        char lowmem_dev_node[PATH_MAX];
 
+       ss_action_entry_add_internal(PREDEF_LOWMEM, lowmem_def_predefine_action,
+                                    NULL, NULL);
+
        if (device_get_property(DEVICE_TYPE_MEMORY, PROP_MEMORY_NODE, lowmem_dev_node) < 0) {
                _E("Low memory handler fd init failed");
-               return -1;
+               return;
        }
 
        lowmem_fd = open(lowmem_dev_node, O_RDONLY);
        if (lowmem_fd < 0) {
                _E("ss_lowmem_init fd open failed");
-               return -1;
+               return;
        }
 
        oom_timer = NULL;
@@ -463,8 +463,10 @@ int ss_lowmem_init(struct ss_main_data *ad)
                                  NULL);
        if (set_threshold() < 0) {
                _E("Setting lowmem threshold is failed");
-               return -1;
+               return;
        }
-
-       return 0;
 }
+
+const struct device_ops lowmem_device_ops = {
+       .init = lowmem_init,
+};
diff --git a/src/proc/lowmem-handler.h b/src/proc/lowmem-handler.h
deleted file mode 100644 (file)
index 4ec0625..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- *  system-server
- *
- * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
-*/ 
-
-
-#ifndef __LOWMEM_HANDLER_H__
-#define __LOWMEM_HANDLER_H__
-
-void ss_predefine_lowmem_init(void);
-#endif /* __LOWMEM_HANDLER_H__ */
index c2fd232..e86ca79 100644 (file)
@@ -26,6 +26,7 @@
 #include "core/launch.h"
 #include "core/data.h"
 #include "core/common.h"
+#include "core/devices.h"
 
 #define PMON_PERMANENT_DIR     "/tmp/permanent"
 
@@ -215,20 +216,6 @@ static int pmon_cb(void *data, Ecore_Fd_Handler * fd_handler)
        return 1;
 }
 
-int ss_pmon_init(struct ss_main_data *ad)
-{
-       int ret = -1;
-       if (pmon_efd) {
-               ecore_main_fd_handler_del(pmon_efd);
-               pmon_efd = NULL;
-       }
-       if (__pmon_start(ad) == -1) {
-               _E("fail pmon control fd init");
-               return -1;
-       }
-       return 0;
-}
-
 static int __pmon_start(struct ss_main_data *ad)
 {
        int pmon_fd = -1;
@@ -262,3 +249,22 @@ static int __pmon_stop(int fd)
        }
        return 0;
 }
+
+static void pmon_init(void *data)
+{
+       struct ss_main_data *ad = (struct ss_main_data*)data;
+       int ret = -1;
+
+       if (pmon_efd) {
+               ecore_main_fd_handler_del(pmon_efd);
+               pmon_efd = NULL;
+       }
+       if (__pmon_start(ad) == -1) {
+               PRT_TRACE_ERR("fail pmon control fd init");
+               return;
+       }
+}
+
+const struct device_ops pmon_device_ops = {
+       .init = pmon_init,
+};
index 04061b9..0305a6a 100644 (file)
@@ -26,6 +26,7 @@
 #include "core/queue.h"
 #include "core/log.h"
 #include "core/common.h"
+#include "core/devices.h"
 
 #define OOMADJ_SU                       (-17)
 #define OOMADJ_INIT                     (-16)
@@ -416,7 +417,7 @@ int set_process_group_action(int argc, char **argv)
        return 0;
 }
 
-int ss_process_manager_init(void)
+static void process_init(void *data)
 {
        ss_action_entry_add_internal(PREDEF_FOREGRD, set_foregrd_action, NULL,
                                     NULL);
@@ -428,5 +429,8 @@ int ss_process_manager_init(void)
                                     NULL);
        ss_action_entry_add_internal(OOMADJ_SET, set_oomadj_action, NULL, NULL);
        ss_action_entry_add_internal(PROCESS_GROUP_SET, set_process_group_action, NULL, NULL);
-       return 0;
 }
+
+const struct device_ops process_device_ops = {
+       .init = process_init,
+};
index d874e51..2cb6c56 100644 (file)
@@ -18,8 +18,6 @@
 #ifndef __SS_PROCMGR_H__
 #define __SS_PROCMGR_H__
 
-int ss_process_manager_init(void);
-
 int get_app_oomadj(int pid, int *oomadj);
 int set_app_oomadj(int pid, int new_oomadj);
 
index f8e6229..af6d786 100644 (file)
 #include <vconf.h>
 #include <device-node.h>
 
-#include "device-node.h"
 #include "core/log.h"
 #include "core/data.h"
 #include "display/poll.h"
+#include "core/devices.h"
 
 #define RETRY  3
 
-int ss_ta_init()
+static void ta_init(void *data)
 {
        int val = -1, i = 0, pid;
 
@@ -46,5 +46,8 @@ int ss_ta_init()
                        vconf_set_int(VCONFKEY_SYSMAN_CHARGER_STATUS,
                                        VCONFKEY_SYSMAN_CHARGER_DISCONNECTED);
        }
-       return 0;
 }
+
+const struct device_ops ta_device_ops = {
+       .init = ta_init,
+};
index 90b87ed..7caf575 100644 (file)
 #include <errno.h>
 #include <sys/stat.h>
 #include <vconf.h>
+#include <time.h>
+#include <sys/ioctl.h>
+#include <linux/rtc.h>
+#include <fcntl.h>
+#include <sys/timerfd.h>
 
 #include "core/data.h"
 #include "core/queue.h"
 #include "core/log.h"
+#include "core/devices.h"
 #include "display/poll.h"
 
-#include <time.h>
-#include <sys/ioctl.h>
-#include <linux/rtc.h>
-#include <fcntl.h>
-#include <sys/timerfd.h>
 
 #define PREDEF_SET_DATETIME            "set_datetime"
 #define PREDEF_SET_TIMEZONE            "set_timezone"
@@ -246,7 +247,7 @@ static int tfd_cb(void *data, Ecore_Fd_Handler * fd_handler)
        return 0;
 }
 
-int ss_time_manager_init(void)
+static void time_init(void *data)
 {
        ss_action_entry_add_internal(PREDEF_SET_DATETIME, set_datetime_action,
                                     NULL, NULL);
@@ -254,7 +255,10 @@ int ss_time_manager_init(void)
                                     NULL, NULL);
        if (timerfd_check_start() == -1) {
                _E("fail system time change detector init");
-               return -1;
+               return;
        }
-       return 0;
 }
+
+const struct device_ops time_device_ops = {
+       .init = time_init,
+};
index 815156d..48cc720 100644 (file)
 
 #include <vconf.h>
 #include <device-node.h>
+#include <poll.h>
 
 #include "core/log.h"
 #include "core/launch.h"
 #include "core/data.h"
+#include "core/devices.h"
 #include "display/poll.h"
 
 #define USBCON_EXEC_PATH       PREFIX"/bin/usb-server"
 #define RETRY                  3
 
-int ss_usb_init()
+static void usb_init(void *data)
 {
        int val = -1, i = 0, pid;
 
@@ -43,12 +45,14 @@ int ss_usb_init()
                        pid = ss_launch_if_noexist(USBCON_EXEC_PATH, NULL);
                        if (pid < 0) {
                                _E("usb appl launching failed\n");
-                               return -1;
+                               return;
                        }
                }
                else if (val==0)
                        vconf_set_int(VCONFKEY_SYSMAN_USB_STATUS,VCONFKEY_SYSMAN_USB_DISCONNECTED);
        }
-
-       return 0;
 }
+
+const struct device_ops usb_device_ops = {
+       .init = usb_init,
+};
index 42ebf33..52aadf6 100644 (file)
@@ -21,6 +21,7 @@
 #include "core/log.h"
 #include "core/predefine.h"
 #include "core/data.h"
+#include "core/devices.h"
 
 #ifndef MERGE_BTW_APPLICATIONS
 #define MERGE_BTW_APPLICATIONS
@@ -313,8 +314,12 @@ int haptic_def_predefine_action(int argc, char **argv)
        return -1;
 }
 
-int vibrator_init(void)
+static void vibrator_init(void *data)
 {
        ss_action_entry_add_internal(PREDEF_HAPTIC, haptic_def_predefine_action,
                                        NULL, NULL);
 }
+
+const struct device_ops vibrator_device_ops = {
+       .init = vibrator_init,
+};