From ee85d39686edc4f24a6463c45abf1150c4b99cdf Mon Sep 17 00:00:00 2001 From: lokilee73 Date: Sun, 10 Jan 2021 14:56:48 +0900 Subject: [PATCH] Change to return -ENODEV if there is no hal function Change-Id: I893d0e4788b14a23fcca217596e181a065896254 Signed-off-by: lokilee73 --- src/battery.c | 6 +++--- src/bezel.c | 12 ++++++------ src/board.c | 4 ++-- src/display.c | 34 +++++++++++++++++----------------- src/external_connection.c | 6 +++--- src/ir.c | 4 ++-- src/led.c | 14 +++++++------- src/thermal.c | 6 +++--- src/touchscreen.c | 12 ++++++------ 9 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/battery.c b/src/battery.c index 962ea29..453a0be 100644 --- a/src/battery.c +++ b/src/battery.c @@ -54,7 +54,7 @@ int hal_device_battery_register_changed_event(BatteryUpdated updated_cb, void *d { if (!g_battery_funcs || !g_battery_funcs->register_changed_event) - return -1; + return -ENODEV; return g_battery_funcs->register_changed_event(updated_cb, data); } @@ -63,7 +63,7 @@ int hal_device_battery_unregister_changed_event(BatteryUpdated updated_cb) { if (!g_battery_funcs || !g_battery_funcs->unregister_changed_event) - return -1; + return -ENODEV; g_battery_funcs->unregister_changed_event(updated_cb); return 0; @@ -73,7 +73,7 @@ int hal_device_battery_get_current_state(BatteryUpdated updated_cb, void *data) { if (!g_battery_funcs || !g_battery_funcs->get_current_state) - return -1; + return -ENODEV; return g_battery_funcs->get_current_state(updated_cb, data); } diff --git a/src/bezel.c b/src/bezel.c index 7f3e6e4..7ce5672 100644 --- a/src/bezel.c +++ b/src/bezel.c @@ -54,7 +54,7 @@ int hal_device_bezel_get_state(enum bezel_state *state) { if (!g_bezel_funcs || !g_bezel_funcs->get_state) - return -1; + return -ENODEV; return g_bezel_funcs->get_state(state); } @@ -63,7 +63,7 @@ int hal_device_bezel_set_state(enum bezel_state state) { if (!g_bezel_funcs || !g_bezel_funcs->set_state) - return -1; + return -ENODEV; return g_bezel_funcs->set_state(state); } @@ -72,7 +72,7 @@ int hal_device_bezel_get_sw_state(enum bezel_state *state) { if (!g_bezel_funcs || !g_bezel_funcs->get_sw_state) - return -1; + return -ENODEV; return g_bezel_funcs->get_sw_state(state); } @@ -81,7 +81,7 @@ int hal_device_bezel_set_sw_state(enum bezel_state state) { if (!g_bezel_funcs || !g_bezel_funcs->set_sw_state) - return -1; + return -ENODEV; return g_bezel_funcs->set_sw_state(state); } @@ -90,7 +90,7 @@ int hal_device_bezel_get_vib_state(enum bezel_vib_state *state) { if (!g_bezel_funcs || !g_bezel_funcs->get_vib_state) - return -1; + return -ENODEV; return g_bezel_funcs->get_vib_state(state); } @@ -99,7 +99,7 @@ int hal_device_bezel_set_vib_state(enum bezel_vib_state state) { if (!g_bezel_funcs || !g_bezel_funcs->set_vib_state) - return -1; + return -ENODEV; return g_bezel_funcs->set_vib_state(state); } diff --git a/src/board.c b/src/board.c index 90b588e..ebbd647 100644 --- a/src/board.c +++ b/src/board.c @@ -53,7 +53,7 @@ int hal_device_board_get_device_serial(char **serial) { if (!g_board_funcs || !g_board_funcs->get_device_serial) - return -1; + return -ENODEV; return g_board_funcs->get_device_serial(serial); } @@ -62,7 +62,7 @@ int hal_device_board_get_device_revision(int *revision) { if (!g_board_funcs || !g_board_funcs->get_device_revision) - return -1; + return -ENODEV; return g_board_funcs->get_device_revision(revision); } diff --git a/src/display.c b/src/display.c index a927240..01fdde3 100644 --- a/src/display.c +++ b/src/display.c @@ -53,7 +53,7 @@ int hal_device_display_get_max_brightness(int *brightness) { if (!g_display_funcs || !g_display_funcs->get_max_brightness) - return -1; + return -ENODEV; return g_display_funcs->get_max_brightness(brightness); } @@ -62,7 +62,7 @@ int hal_device_display_get_brightness(int *brightness) { if (!g_display_funcs || !g_display_funcs->get_brightness) - return -1; + return -ENODEV; return g_display_funcs->get_brightness(brightness); } @@ -71,7 +71,7 @@ int hal_device_display_set_brightness(int brightness) { if (!g_display_funcs || !g_display_funcs->set_brightness) - return -1; + return -ENODEV; return g_display_funcs->set_brightness(brightness); } @@ -80,7 +80,7 @@ int hal_device_display_set_multi_brightness(int brightness, int step, int delay) { if (!g_display_funcs || !g_display_funcs->set_multi_brightness) - return -1; + return -ENODEV; return g_display_funcs->set_multi_brightness(brightness, step, delay); } @@ -89,7 +89,7 @@ int hal_device_display_get_auto_brightness(float lmax, float lmin, float light, { if (!g_display_funcs || !g_display_funcs->get_auto_brightness) - return -1; + return -ENODEV; return g_display_funcs->get_auto_brightness(lmax, lmin, light, brightness); } @@ -98,7 +98,7 @@ int hal_device_display_get_state(enum display_state *state) { if (!g_display_funcs || !g_display_funcs->get_state) - return -1; + return -ENODEV; return g_display_funcs->get_state(state); } @@ -107,7 +107,7 @@ int hal_device_display_set_state(enum display_state state) { if (!g_display_funcs || !g_display_funcs->set_state) - return -1; + return -ENODEV; return g_display_funcs->set_state(state); } @@ -116,7 +116,7 @@ int hal_device_display_get_image_effect(enum display_image_effect *effect) { if (!g_display_funcs || !g_display_funcs->get_image_effect) - return -1; + return -ENODEV; return g_display_funcs->get_image_effect(effect); } @@ -125,7 +125,7 @@ int hal_device_display_set_image_effect(enum display_image_effect effect) { if (!g_display_funcs || !g_display_funcs->set_image_effect) - return -1; + return -ENODEV; return g_display_funcs->set_image_effect(effect); } @@ -134,7 +134,7 @@ int hal_device_display_get_panel_mode(enum display_panel_mode *mode) { if (!g_display_funcs || !g_display_funcs->get_panel_mode) - return -1; + return -ENODEV; return g_display_funcs->get_panel_mode(mode); } @@ -143,7 +143,7 @@ int hal_device_display_set_panel_mode(enum display_panel_mode mode) { if (!g_display_funcs || !g_display_funcs->set_panel_mode) - return -1; + return -ENODEV; return g_display_funcs->set_panel_mode(mode); } @@ -152,7 +152,7 @@ int hal_device_display_get_aod_mode(enum display_aod_mode *mode) { if (!g_display_funcs || !g_display_funcs->get_aod_mode) - return -1; + return -ENODEV; return g_display_funcs->get_aod_mode(mode); } @@ -161,7 +161,7 @@ int hal_device_display_get_aod_brightness(int *max, int *normal, int *min, int * { if (!g_display_funcs || !g_display_funcs->get_aod_brightness) - return -1; + return -ENODEV; return g_display_funcs->get_aod_brightness(max, normal, min, charging); } @@ -170,7 +170,7 @@ int hal_device_display_get_max_frame_rate(int *rate) { if (!g_display_funcs || !g_display_funcs->get_max_frame_rate) - return -1; + return -ENODEV; return g_display_funcs->get_max_frame_rate(rate); } @@ -179,7 +179,7 @@ int hal_device_display_get_min_frame_rate(int *rate) { if (!g_display_funcs || !g_display_funcs->get_min_frame_rate) - return -1; + return -ENODEV; return g_display_funcs->get_min_frame_rate(rate); } @@ -188,7 +188,7 @@ int hal_device_display_get_frame_rate(int *rate) { if (!g_display_funcs || !g_display_funcs->get_frame_rate) - return -1; + return -ENODEV; return g_display_funcs->get_frame_rate(rate); } @@ -197,7 +197,7 @@ int hal_device_display_set_frame_rate(int rate) { if (!g_display_funcs || !g_display_funcs->set_frame_rate) - return -1; + return -ENODEV; return g_display_funcs->set_frame_rate(rate); } diff --git a/src/external_connection.c b/src/external_connection.c index c686a54..1669610 100644 --- a/src/external_connection.c +++ b/src/external_connection.c @@ -54,7 +54,7 @@ int hal_device_external_connection_register_changed_event(ConnectionUpdated upda { if (!g_external_connection_funcs || !g_external_connection_funcs->register_changed_event) - return -1; + return -ENODEV; return g_external_connection_funcs->register_changed_event(updated_cb, data); } @@ -63,7 +63,7 @@ int hal_device_external_connection_unregister_changed_event(ConnectionUpdated up { if (!g_external_connection_funcs || !g_external_connection_funcs->unregister_changed_event) - return -1; + return -ENODEV; g_external_connection_funcs->unregister_changed_event(updated_cb); return 0; @@ -73,7 +73,7 @@ int hal_device_external_connection_get_current_state(ConnectionUpdated updated_c { if (!g_external_connection_funcs || !g_external_connection_funcs->get_current_state) - return -1; + return -ENODEV; return g_external_connection_funcs->get_current_state(updated_cb, data); } diff --git a/src/ir.c b/src/ir.c index 20d01fc..0b24500 100644 --- a/src/ir.c +++ b/src/ir.c @@ -54,7 +54,7 @@ int hal_device_ir_is_available(bool *available) { if (!g_ir_funcs || !g_ir_funcs->is_available) - return -1; + return -ENODEV; return g_ir_funcs->is_available(available); } @@ -63,7 +63,7 @@ int hal_device_ir_transmit(int *frequency_pattern, int size) { if (!g_ir_funcs || !g_ir_funcs->transmit) - return -1; + return -ENODEV; return g_ir_funcs->transmit(frequency_pattern, size); } diff --git a/src/led.c b/src/led.c index e8b5c6d..f6d4cf7 100644 --- a/src/led.c +++ b/src/led.c @@ -54,7 +54,7 @@ int hal_device_led_set_state(struct led_state *state) { if (!g_led_funcs || !g_led_funcs->set_state) - return -1; + return -ENODEV; return g_led_funcs->set_state(state); } @@ -63,7 +63,7 @@ int hal_device_led_get_state(struct led_state **state) { if (!g_led_funcs || !g_led_funcs->get_state) - return -1; + return -ENODEV; return g_led_funcs->get_state(state); } @@ -72,7 +72,7 @@ int hal_device_led_get_number(void) { if (!g_led_funcs || !g_led_funcs->get_number) - return -1; + return -ENODEV; return g_led_funcs->get_number(); } @@ -81,7 +81,7 @@ int hal_device_led_set_number(int number) { if (!g_led_funcs || !g_led_funcs->set_num) - return -1; + return -ENODEV; g_led_funcs->set_num(number); @@ -92,7 +92,7 @@ int hal_device_led_get_max_num(void) { if (!g_led_funcs || !g_led_funcs->get_max_num) - return -1; + return -ENODEV; return g_led_funcs->get_max_num(); } @@ -101,7 +101,7 @@ int hal_device_keyled_set_state(struct keyled_state *state) { if (!g_led_funcs || !g_led_funcs->keyled_set_state) - return -1; + return -ENODEV; return g_led_funcs->keyled_set_state(state); } @@ -110,7 +110,7 @@ int hal_device_keyled_get_state(int *keycode, int *brightness) { if (!g_led_funcs || !g_led_funcs->keyled_get_state) - return -1; + return -ENODEV; return g_led_funcs->keyled_get_state(keycode, brightness); } diff --git a/src/thermal.c b/src/thermal.c index b64eb35..867a4b3 100644 --- a/src/thermal.c +++ b/src/thermal.c @@ -53,7 +53,7 @@ int hal_device_thermal_get_info(device_thermal_e type, struct thermal_info *info { if (!g_thermal_funcs || !g_thermal_funcs->get_info) - return -1; + return -ENODEV; return g_thermal_funcs->get_info(type, info); } @@ -62,7 +62,7 @@ int hal_device_thermal_register_changed_event(ThermalUpdated updated_cb, void *d { if (!g_thermal_funcs || !g_thermal_funcs->register_changed_event) - return -1; + return -ENODEV; return g_thermal_funcs->register_changed_event(updated_cb, data); } @@ -71,7 +71,7 @@ int hal_device_thermal_unregister_changed_event(ThermalUpdated updated_cb) { if (!g_thermal_funcs || !g_thermal_funcs->unregister_changed_event) - return -1; + return -ENODEV; return g_thermal_funcs->unregister_changed_event(updated_cb); } diff --git a/src/touchscreen.c b/src/touchscreen.c index bc1211d..dd6a9dd 100644 --- a/src/touchscreen.c +++ b/src/touchscreen.c @@ -55,7 +55,7 @@ int hal_device_touchscreen_get_state(enum touchscreen_state *state) { if (!g_touchscreen_funcs || !g_touchscreen_funcs->get_state) - return -1; + return -ENODEV; return g_touchscreen_funcs->get_state(state); } @@ -64,7 +64,7 @@ int hal_device_touchscreen_set_state(enum touchscreen_state state) { if (!g_touchscreen_funcs || !g_touchscreen_funcs->set_state) - return -1; + return -ENODEV; return g_touchscreen_funcs->set_state(state); } @@ -73,7 +73,7 @@ int hal_device_touchscreen_get_powersaving(int *state) { if (!g_touchscreen_funcs || !g_touchscreen_funcs->get_powersaving) - return -1; + return -ENODEV; return g_touchscreen_funcs->get_powersaving(state); } @@ -82,7 +82,7 @@ int hal_device_touchscreen_set_powersaving(int state) { if (!g_touchscreen_funcs || !g_touchscreen_funcs->set_powersaving) - return -1; + return -ENODEV; return g_touchscreen_funcs->set_powersaving(state); } @@ -91,7 +91,7 @@ int hal_device_touchscreen_glove_mode_get_state(int *state) { if (!g_touchscreen_funcs || !g_touchscreen_funcs->glove_mode_get_state) - return -1; + return -ENODEV; return g_touchscreen_funcs->glove_mode_get_state(state); } @@ -100,7 +100,7 @@ int hal_device_touchscreen_glove_mode_set_state(int state) { if (!g_touchscreen_funcs || !g_touchscreen_funcs->glove_mode_set_state) - return -1; + return -ENODEV; return g_touchscreen_funcs->glove_mode_set_state(state); } -- 2.7.4