From: Youngjae Cho Date: Thu, 13 Jun 2024 05:56:21 +0000 (+0900) Subject: plugin-api: deviced: Elaborate error code X-Git-Tag: accepted/tizen/unified/20240618.060027~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F74%2F312874%2F1;p=platform%2Fcore%2Fsystem%2Flibsyscommon.git plugin-api: deviced: Elaborate error code Plugin api has changed to return negative error value in three ways. 1. -ENOTSUP : Fail to load plugin backend. 2. -EOPNOTSUPP : Successfully loaded plugin backend, but there is no implementation of requested interface. 3. The other negative values : Successfully loaded plugin backend, and successfully invoked implemented interface, but the implementation itself returned a negative value. In this case, it is strongly discouraged that implementation returning -ENOTSUP or -EOPNOTSUPP as it cannot be distinguished from the above two cases. Change-Id: I754c06a813c7c4587c07bc285677fdc1a99cbc80 Signed-off-by: Youngjae Cho --- diff --git a/src/plugin-api/deviced/src/syscommon-plugin-deviced-battery.c b/src/plugin-api/deviced/src/syscommon-plugin-deviced-battery.c index 1b33cba..2c8769a 100644 --- a/src/plugin-api/deviced/src/syscommon-plugin-deviced-battery.c +++ b/src/plugin-api/deviced/src/syscommon-plugin-deviced-battery.c @@ -89,15 +89,16 @@ int syscommon_plugin_deviced_battery_is_possible_to_notify_battery_full(bool *po if (!funcs) { ret = syscommon_plugin_deviced_battery_get_backend(); if (ret < 0) - return ret; + return -ENOTSUP; } if (!funcs || !funcs->is_possible_to_notify_battery_full) { _E("No backend or no \"is_possible_to_notify_battery_full\" function"); - return -ENOTSUP; + return -EOPNOTSUPP; } *possible_notify = funcs->is_possible_to_notify_battery_full(); + return 0; } @@ -109,14 +110,15 @@ int syscommon_plugin_deviced_battery_update_health_ovp_state(enum syscommon_devi if (!funcs) { ret = syscommon_plugin_deviced_battery_get_backend(); if (ret < 0) - return ret; + return -ENOTSUP; } if (!funcs || !funcs->update_health_ovp_state) { _E("No backend or no \"update_battery_health_ovp_state\" function"); - return -ENOTSUP; + return -EOPNOTSUPP; } funcs->update_health_ovp_state(noti_status); + return 0; } \ No newline at end of file diff --git a/src/plugin-api/deviced/src/syscommon-plugin-deviced-display.c b/src/plugin-api/deviced/src/syscommon-plugin-deviced-display.c index 0ec09c6..fc335e4 100644 --- a/src/plugin-api/deviced/src/syscommon-plugin-deviced-display.c +++ b/src/plugin-api/deviced/src/syscommon-plugin-deviced-display.c @@ -89,11 +89,14 @@ int syscommon_plugin_deviced_display_load_config(struct syscommon_deviced_displa if (!g_display_funcs) { ret = syscommon_plugin_deviced_display_get_backend(); if (ret < 0) - return ret; + return -ENOTSUP; } assert(g_display_funcs); + if (!g_display_funcs->load_display_config) + return -EOPNOTSUPP; + return g_display_funcs->load_display_config(data); } @@ -105,7 +108,7 @@ int syscommon_plugin_deviced_display_notify_setting_value_changed(int key, int v if (!g_display_funcs) { ret = syscommon_plugin_deviced_display_get_backend(); if (ret < 0) - return ret; + return -ENOTSUP; } assert(g_display_funcs); @@ -124,7 +127,7 @@ int syscommon_plugin_deviced_display_lcd_on_procedure(enum syscommon_deviced_dis if (!g_display_funcs) { ret = syscommon_plugin_deviced_display_get_backend(); if (ret < 0) - return ret; + return -ENOTSUP; } assert(g_display_funcs); @@ -143,7 +146,7 @@ int syscommon_plugin_deviced_display_lcd_off_procedure(enum deviced_event reason if (!g_display_funcs) { ret = syscommon_plugin_deviced_display_get_backend(); if (ret < 0) - return ret; + return -ENOTSUP; } assert(g_display_funcs); @@ -162,7 +165,7 @@ int syscommon_plugin_deviced_display_custom_lcd_on(int timeout) if (!g_display_funcs) { ret = syscommon_plugin_deviced_display_get_backend(); if (ret < 0) - return ret; + return -ENOTSUP; } assert(g_display_funcs); @@ -181,7 +184,7 @@ int syscommon_plugin_deviced_display_custom_lcd_off(enum deviced_event reason) if (!g_display_funcs) { ret = syscommon_plugin_deviced_display_get_backend(); if (ret < 0) - return ret; + return -ENOTSUP; } assert(g_display_funcs); @@ -200,7 +203,7 @@ int syscommon_plugin_deviced_display_on_by_reason(const char *reason, int timeou if (!g_display_funcs) { ret = syscommon_plugin_deviced_display_get_backend(); if (ret < 0) - return ret; + return -ENOTSUP; } assert(g_display_funcs); @@ -219,7 +222,7 @@ int syscommon_plugin_deviced_display_off_by_reason(const char *reason) if (!g_display_funcs) { ret = syscommon_plugin_deviced_display_get_backend(); if (ret < 0) - return ret; + return -ENOTSUP; } assert(g_display_funcs);