Deviced sometimes pass int value to void * value.
It occurs warning on 64bit build machine
so I fixed wrong type cast from int to 64bit value.
Change-Id: If68a26d5911b803a0793488da64fd22fd1d92867
Signed-off-by: Jiyoung Yun <jy910.yun@samsung.com>
if (data == NULL)
goto out;
- done = (int)data;
+ done = *(int*)data;
if (!done)
goto out;
_I("booting done");
static int display_changed(void *data)
{
- enum state_t state = (enum state_t)data;
+ enum state_t state;
int ret, cradle = 0;
+ if (!data)
+ return 0;
+
+ state = *(int*)data;
if (state != S_NORMAL)
return 0;
_I("jack - hdmi changed %d", val);
vconf_set_int(VCONFKEY_SYSMAN_HDMI, val);
hdmi_status = val;
- device_notify(DEVICE_NOTIFIER_HDMI, (void *)val);
+ device_notify(DEVICE_NOTIFIER_HDMI, &val);
if(val == 1) {
pm_lock_internal(INTERNAL_LOCK_HDMI, LCD_DIM, STAY_CUR_STATE, 0);
} else {
pm_unlock_internal(INTERNAL_LOCK_HDMI, LCD_DIM, PM_SLEEP_MARGIN);
}
- hdmi_cec_execute((void *)val);
+ hdmi_cec_execute(&val);
}
static void hdcp_send_broadcast(int status)
if (data == NULL)
return done;
- done = (int)data;
+ done = *(int*)data;
if (done == 0)
return done;
if (data == NULL)
goto out;
- done = (int)data;
+ done = *(int*)data;
if (late_init_timer == NULL)
return done;
late_init_stop();
if (done)
return EINA_FALSE;
_I("late booting done");
- device_notify(DEVICE_NOTIFIER_BOOTING_DONE, (void *)TRUE);
+ device_notify(DEVICE_NOTIFIER_BOOTING_DONE, &done);
return EINA_FALSE;
}
ret = check_systemd_active();
if (ret == TRUE) {
_I("notify relaunch");
- device_notify(DEVICE_NOTIFIER_BOOTING_DONE, (void *)TRUE);
+ device_notify(DEVICE_NOTIFIER_BOOTING_DONE, &ret);
}
signal(SIGTERM, sig_quit);
signal(SIGUSR1, sig_usr1);
static int lcd_changed_cb(void *data)
{
- int lcd_state = (int)data;
+ int lcd_state;
+ if (!data)
+ return 0;
+
+ lcd_state = *(int*)data;
if (lcd_state == S_LCDOFF && alc_timeout_id > 0) {
ecore_timer_del(alc_timeout_id);
alc_timeout_id = NULL;
static int lcd_changed_cb(void *data)
{
- int lcd_state = (int)data;
+ int lcd_state;
+ if (!data)
+ return 0;
+
+ lcd_state = *(int*)data;
if (lcd_state == S_LCDOFF && popup_pid > 0) {
if (popup_timer)
ecore_timer_del(popup_timer);
{
PmLockNode *tmp = NULL;
char pname[PATH_MAX];
- pid_t pid = (pid_t)data;
+ pid_t pid;
+
+ if (!data)
+ return EINA_FALSE;
+ /* A passed data is a pid_t type data, not a 64bit data. */
+ pid = (pid_t)((intptr_t)data);
_I("delete prohibit dim condition by timeout (%d)", pid);
tmp = find_node(S_LCDDIM, pid);
{
PmLockNode *tmp = NULL;
char pname[PATH_MAX];
- pid_t pid = (pid_t)data;
+ pid_t pid;
+
+ if (!data)
+ return EINA_FALSE;
+ /* A passed data is a pid_t type data, not a 64bit data. */
+ pid = (pid_t)((intptr_t)data);
_I("delete prohibit off condition by timeout (%d)", pid);
tmp = find_node(S_LCDOFF, pid);
{
PmLockNode *tmp = NULL;
char pname[PATH_MAX];
- pid_t pid = (pid_t)data;
+ pid_t pid;
+
+ if (!data)
+ return EINA_FALSE;
+ /* A passed data is a pid_t type data, not a 64bit data. */
+ pid = (pid_t)((intptr_t)data);
_I("delete prohibit sleep condition by timeout (%d)", pid);
tmp = find_node(S_SLEEP, pid);
if (!timeout_src_id)
states[pm_cur_state].trans(EVENT_TIMEOUT);
- set_process_active(EINA_FALSE, (pid_t)data);
+ set_process_active(EINA_FALSE, pid);
return EINA_FALSE;
}
{
Eina_List *l = NULL;
Eina_List *l_next = NULL;
- int *data = 0;
+ void *data;
if (enable) {
EINA_LIST_FOREACH(standby_mode_list, l, data)
- if (pid == (int) data) {
+ if (pid == (pid_t)((intptr_t)data)) {
_E("%d already acquired standby mode", pid);
return;
}
- EINA_LIST_APPEND(standby_mode_list, (void *)pid);
+ EINA_LIST_APPEND(standby_mode_list, (void *)((intptr_t)pid));
_I("%d acquire standby mode", pid);
if (standby_mode)
return;
if (!standby_mode)
return;
EINA_LIST_FOREACH_SAFE(standby_mode_list, l, l_next, data)
- if (pid == (int) data) {
+ if (pid == (pid_t)((intptr_t)data)) {
standby_mode_list = eina_list_remove_list(
standby_mode_list, l);
_I("%d release standby mode", pid);
if (val & MASK_DIM) {
if (data->timeout > 0) {
+ /*
+ * To pass a pid_t data through the timer infrastructure
+ * without memory allocation, a pid_t data becomes typecast
+ * to intptr_t and void *(64bit) type.
+ */
cond_timeout_id =
ecore_timer_add(MSEC_TO_SEC(data->timeout),
- (Ecore_Task_Cb)del_dim_cond, (void*)pid);
+ (Ecore_Task_Cb)del_dim_cond, (void*)((intptr_t)pid));
}
holdkey_block = GET_HOLDKEY_BLOCK_STATE(val);
tmp = find_node(S_LCDDIM, pid);
}
if (val & MASK_OFF) {
if (data->timeout > 0) {
+ /*
+ * To pass a pid_t data through the timer infrastructure
+ * without memory allocation, a pid_t data becomes typecast
+ * to intptr_t and void *(64bit) type.
+ */
cond_timeout_id =
ecore_timer_add(MSEC_TO_SEC(data->timeout),
- (Ecore_Task_Cb)del_off_cond, (void*)pid);
+ (Ecore_Task_Cb)del_off_cond, (void*)((intptr_t)pid));
}
holdkey_block = GET_HOLDKEY_BLOCK_STATE(val);
tmp = find_node(S_LCDOFF, pid);
proc_change_state(S_LCDOFF <<
(SHIFT_CHANGE_STATE + S_LCDOFF), getpid());
if (data->timeout > 0) {
+ /*
+ * To pass a pid_t data through the timer infrastructure
+ * without memory allocation, a pid_t data becomes typecast
+ * to intptr_t and void *(64bit) type.
+ */
cond_timeout_id =
ecore_timer_add(MSEC_TO_SEC(data->timeout),
- (Ecore_Task_Cb)del_sleep_cond, (void*)pid);
+ (Ecore_Task_Cb)del_sleep_cond, (void*)((intptr_t)pid));
}
if (GET_STANDBY_MODE_STATE(val))
set_standby_mode(pid, true);
char buf[255];
int i = 1, ret;
Eina_List *l = NULL;
- int *data = 0;
+ void *data;
char pname[PATH_MAX];
if (fd < 0)
write(fd, buf, strlen(buf));
EINA_LIST_FOREACH(standby_mode_list, l, data) {
- get_pname((pid_t)data, pname);
+ get_pname((pid_t)((intptr_t)data), pname);
snprintf(buf, sizeof(buf),
" standby mode acquired by pid %d"
" - process %s\n", data, pname);
if (pm_cur_state != pm_old_state && pm_cur_state != S_SLEEP) {
if (power_ops.get_power_lock_support())
power_ops.power_lock();
- device_notify(DEVICE_NOTIFIER_LCD, (void *)pm_cur_state);
+ device_notify(DEVICE_NOTIFIER_LCD, &pm_cur_state);
}
if (pm_old_state == S_NORMAL && pm_cur_state != S_NORMAL) {
static int hdmi_changed(void *data)
{
- hdmi_state = (int)data;
+ if (data)
+ hdmi_state = *(int*)data;
return 0;
}
static int hall_ic_open(void *data)
{
- int open = (int)data;
+ int open;
+
+ if (!data)
+ return -EINVAL;
+ open = *(int*)data;
update_pm_setting(SETTING_HALLIC_OPEN, open);
if (display_info.update_auto_brightness)
{
static bool done = false;
- if (done)
- return 0;
-
- _I("booting done, unlock LCD_OFF");
- pm_unlock_internal(INTERNAL_LOCK_BOOTING, LCD_OFF, PM_SLEEP_MARGIN);
- done = true;
+ if (data != NULL) {
+ done = *(int*)data;
+ if (done)
+ return 0;
+ _I("booting done, unlock LCD_OFF");
+ pm_unlock_internal(INTERNAL_LOCK_BOOTING, LCD_OFF, PM_SLEEP_MARGIN);
+ }
return 0;
}
if (ret < 0)
_E("Failed to system suspend! %d", ret);
- return (void *)ret;
+ return NULL;
}
static int system_suspend(void)
static int hardkey_lcd_changed_cb(void *data)
{
- int lcd_state = (int)data;
+ int lcd_state;
+ if (!data)
+ return 0;
+
+ lcd_state = *(int*)data;
if (lcd_state == S_NORMAL
&& hardkey_duration == KEYBACKLIGHT_TIME_ALWAYS_ON) {
turnon_hardkey_backlight();
{
char buf[1024];
struct sockaddr_un clientaddr;
-
- int fd = (int)data;
+ int fd;
int ret;
static const struct device_ops *display_device_ops = NULL;
+ if (!data)
+ return EINA_FALSE;
+
FIND_DEVICE_INT(display_device_ops, "display");
if (device_get_status(display_device_ops) != DEVICE_OPS_STATUS_START) {
return EINA_FALSE;
}
+ /* A passed data is a fd type data, not a 64bit data. */
+ fd = (int)((intptr_t)data);
ret = read(fd, buf, sizeof(buf));
CHECK_KEY_FILTER(ret, buf, fd);
(*g_pm_callback) (INPUT_POLL_EVENT, NULL);
goto out1;
}
+ /*
+ * To pass a fd data through the fd hander infrastructure
+ * without memory allocation, a fd data becomes typecast
+ * to intptr_t and void *(64bit) type.
+ */
fd_handler = ecore_main_fd_handler_add(fd,
ECORE_FD_READ|ECORE_FD_ERROR,
- pm_handler, (void *)fd, NULL, NULL);
+ pm_handler, (void *)((intptr_t)fd), NULL, NULL);
if (fd_handler == NULL) {
_E("Failed ecore_main_handler_add() in init_pm_poll()");
goto out2;
}
strncpy(dev_path, path, strlen(path) +1);
+ /*
+ * To pass a fd data through the fd hander infrastructure
+ * without memory allocation, a fd data becomes typecast
+ * to intptr_t and void *(64bit) type.
+ */
fd_handler = ecore_main_fd_handler_add(fd,
ECORE_FD_READ|ECORE_FD_ERROR,
- pm_handler, (void *)fd, NULL, NULL);
+ pm_handler, (void *)((intptr_t)fd), NULL, NULL);
if (!fd_handler) {
_E("Fail to ecore fd handler add! %s", path);
close(fd);
static int setting_cb(keynode_t *key_nodes, void *data)
{
keynode_t *tmp = key_nodes;
+ int index;
- if ((int)data > SETTING_END) {
+ if (!data)
+ return -EINVAL;
+
+ index = (int)((intptr_t)data);
+ if (index > SETTING_END) {
_E("Unknown setting key: %s, idx=%d",
- vconf_keynode_get_name(tmp), (int)data);
+ vconf_keynode_get_name(tmp), index);
return -1;
}
if (update_pm_setting != NULL) {
- switch((int)data) {
+ switch(index) {
case SETTING_ACCESSIBILITY_TTS:
- update_pm_setting((int)data, vconf_keynode_get_bool(tmp));
+ update_pm_setting(index, vconf_keynode_get_bool(tmp));
break;
default:
- update_pm_setting((int)data, vconf_keynode_get_int(tmp));
+ update_pm_setting(index, vconf_keynode_get_int(tmp));
break;
}
}
update_pm_setting = func;
for (i = SETTING_BEGIN; i < SETTING_GET_END; i++) {
+ /*
+ * To pass an index data through the vconf infratstructure
+ * without memory allocation, an index data becomes typecast
+ * to proper pointer size on each architecture.
+ */
vconf_notify_key_changed(setting_keys[i], (void *)setting_cb,
- (void *)i);
+ (void *)((intptr_t)i));
}
return 0;
ret = telephony_exit(POWER_REBOOT);
if (ret < 0) {
- restart_ap((void *)type);
+ restart_ap(type);
return 0;
}
return ret;
if (data == NULL)
goto out;
- done = (int)data;
+ done = *(int*)data;
telephony_init();
out:
return done;
return;
_I("signal booting done");
- device_notify(DEVICE_NOTIFIER_BOOTING_DONE, (void *)TRUE);
+ device_notify(DEVICE_NOTIFIER_BOOTING_DONE, &done);
}
static void poweroff_send_broadcast(int status)
switch (val) {
case VCONFKEY_SYSMAN_POWER_OFF_DIRECT:
- device_notify(DEVICE_NOTIFIER_POWEROFF, (void *)val);
+ device_notify(DEVICE_NOTIFIER_POWEROFF, &val);
poweroff();
break;
case VCONFKEY_SYSMAN_POWER_OFF_POPUP:
pwroff_popup();
break;
case VCONFKEY_SYSMAN_POWER_OFF_RESTART:
- device_notify(DEVICE_NOTIFIER_POWEROFF, (void *)val);
+ device_notify(DEVICE_NOTIFIER_POWEROFF, &val);
power_reboot(recovery);
break;
}
reboot(RB_POWER_OFF);
}
-void restart_ap(void *data)
+void restart_ap(int data)
{
- _I("Restart %d", (int)data);
+ _I("Restart %d", data);
powerdown();
- restart_by_mode((int)data);
+ restart_by_mode(data);
}
static const struct edbus_method edbus_methods[] = {
#define SYSTEMD_STOP_POWER_RESTART_FOTA 7
#ifndef SYSTEMD_SHUTDOWN
-void restart_ap(void *data);
+void restart_ap(int data);
void powerdown_ap(void *data);
#endif
if (data == NULL)
goto out;
- done = (int)data;
+ done = *(int*)data;
if (vconf_notify_key_changed(VCONFKEY_PM_STATE, (void *)siop_mode_lcd, NULL) < 0)
_E("Vconf notify key chaneged failed: KEY(%s)", VCONFKEY_PM_STATE);
siop_mode_lcd(NULL, NULL);
static int done = 0;
if (data != NULL) {
- done = (int)data;
+ done = *(int*)data;
if (done)
_I("booting done");
if (__memnoti_fd_init() == -1)
static void telephony_restart_ap(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
{
- restart_ap((void *)reboot_opt);
+ restart_ap(reboot_opt);
}
static Eina_Bool telephony_restart_ap_by_force(void *data)
static int time_lcd_changed_cb(void *data)
{
- int lcd_state = (int)data;
+ int lcd_state;
int tfd = -1;
+ if (!data)
+ return 0;
+
+ lcd_state = *(int*)data;
if (lcd_state < S_LCDOFF)
goto restart;