From: Yunhee Seo Date: Mon, 8 Apr 2024 09:33:46 +0000 (+0900) Subject: device-board: Fix incorrect module naming X-Git-Tag: accepted/tizen/unified/20240614.084933~33 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e329eb659d46ea9d574411fe41bbf5a3d9176059;p=platform%2Fhal%2Fapi%2Fdevice.git device-board: Fix incorrect module naming Fix incorrect module name from "board" to "device-board". struct - hal_backend_board_funcs -> struct hal_backend_device_board_funcs file - hal-board.h -> hal-device-board.h - hal-board-interface.h -> hal-device-board-interface.h According to HAL API Prototype rule, hal module funcs structure naming is same as below - hal_backend_[module]_funcs. Also, hal module header files naming is same as below. - hal-[module].h - hal-[module]-interface.h However, the hal module name was being used incorrectly. Actual hal module name is not "board" but "device-board". Change-Id: Ib0db0f55a906e857d41af622399299dc17da7ef9 Signed-off-by: Yunhee Seo --- diff --git a/haltest/board.cpp b/haltest/board.cpp index a096801..ad3b6a8 100644 --- a/haltest/board.cpp +++ b/haltest/board.cpp @@ -1,5 +1,5 @@ #include "haltest.h" -#include "hal-board.h" +#include "hal-device-board.h" #define BUFFER_MAX 128 diff --git a/include/hal-board-interface.h b/include/hal-board-interface.h deleted file mode 100644 index 3226597..0000000 --- a/include/hal-board-interface.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2021 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 __HAL_BOARD_INTERFACE_H__ -#define __HAL_BOARD_INTERFACE_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct _hal_backend_board_funcs { - /* Serial number of this device */ - int (*get_device_serial_number)(char *buffer, const int max_len); - int (*get_device_revision)(int *revision); - - int (*set_boot_success)(void); - int (*clear_boot_mode)(void); - int (*get_boot_mode)(char *buffer, const int max_len); - int (*get_boot_reason)(char *buffer, const int max_len); - - int (*get_current_partition)(char *partition_ab); - int (*switch_partition)(char partition_ab); - int (*set_partition_ab_cloned)(void); - int (*clear_partition_ab_cloned)(void); - int (*get_partition_ab_cloned)(int *cloned); - int (*set_partition_status)(char partition_ab, const char *status); - int (*get_partition_status)(char partition_ab, char *buffer, const int max_len); - - int (*set_upgrade_status)(int status); - int (*get_upgrade_status)(int *status); - -} hal_backend_board_funcs; - -#ifdef __cplusplus -} -#endif -#endif /* __HAL_BOARD_INTERFACE_H__ */ diff --git a/include/hal-board.h b/include/hal-board.h deleted file mode 100644 index b018df0..0000000 --- a/include/hal-board.h +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright (c) 2021 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 __HAL_BOARD_H__ -#define __HAL_BOARD_H__ - -#include "hal-board-interface.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Initialize hal_board_funcs, which contains hal backend board functions - * - * @return 0 on success, otherwise a negative error value - */ -int hal_device_board_get_backend(void); - -/** - * @brief Release hal_board_funcs and set it to NULL - * - * @return 0 if it is successful or hal_board_funcs is NULL, else negative error value - */ -int hal_device_board_put_backend(void); - -/** - * @brief Get device serial number and save it to a buffer - * - * @param[in] max_len Buffer size - * @param[out] buffer Serial number - * - * At most (max_len - 1) bytes of the serial number string will be copied to the buffer argument, - * and NULL is finally appended. - * - * @return 0 on success, otherwise a negative error value - */ -int hal_device_board_get_device_serial_number(char *buffer, const int max_len); - -/** - * @brief Get device revision (not in use, no hal backend function) - * - * @param[out] revision Revision number - * - * @return 0 on success, otherwise a negative error value - */ -int hal_device_board_get_device_revision(int *revision); - - -/** - * @brief Set the BOOT_SUCCESS flag - * - * @return 0 on success, otherwise a negative error value - */ -int hal_device_board_set_boot_success(void); - -/** - * @brief Clear the BOOT_SUCCESS flag - * - * @return 0 on success, otherwise a negative error value - */ -int hal_device_board_clear_boot_mode(void); - -/** - * @brief Get the boot mode ("fota", "recovery", "normal") - * - * @param[in] max_len Buffer size - * @param[out] buffer boot mode - * - * At most (max_len - 1) bytes of the boot mode string will be copied to the buffer argument, - * and NULL is finally appended. - * - * @return 0 on success, otherwise a negative error value - */ -int hal_device_board_get_boot_mode(char *buffer, const int max_len); - -/** - * @brief Get the boot reason (not in use) - * - * @param[in] max_len Buffer size - * @param[out] buffer boot reason - * - * At most (max_len - 1) bytes of the boot reason string will be copied to the buffer argument, - * and NULL is finally appended. - * - * @return 0 on success, otherwise a negative error value - */ -int hal_device_board_get_boot_reason(char *buffer, const int max_len); - - -/** - * @brief Get partition_ab ('a' or 'b') - * - * @param[in] partition_ab Current partition name ('a' or 'b') - * - * @return 0 on success, otherwise a negative error value - */ -int hal_device_board_get_current_partition(char *partition_ab); - -/** - * @brief Switch partition to partition_ab ('a' or 'b') or toggle partition if partition_ab is '\0' - * - * @param[in] partition_ab Partition name to switch to ('a' or 'b') or '\0'(toggle) - * - * @return 0 on success, otherwise a negative error value - */ -int hal_device_board_switch_partition(char partition_ab); - -/** - * @brief Set ithe cloned flag (for partition a, b) - * - * @return 0 on success, otherwise a negative error value - */ -int hal_device_board_set_partition_ab_cloned(void); - -/** - * @brief Clear the cloned flag (for partition a, b) - * - * @return 0 on success, otherwise a negative error value - */ -int hal_device_board_clear_partition_ab_cloned(void); - -/** - * @brief Get the cloned flag (for partition a, b) - * - * @param[out] cloned Flag if partition a, b are cloned(1) or not(0) - * - * @return 0 on success, otherwise a negative error value - */ -int hal_device_board_get_partition_ab_cloned(int *cloned); - -/** - * @brief Set the partition_status flag - * - * @param[in] partition_ab Partition slot ('a', 'b', '\0')(if '\0' then current partition) - * @param[in] status Status of partition ("ok", "failed", "corrupted") - * - * @return 0 on success, otherwise a negative error value - */ -int hal_device_board_set_partition_status(char partition_ab, const char *status); - -/** - * @brief Set the partition_status flag - * - * @param[in] partition_ab Partition slot ('a', 'b', '\0')(if '\0' then current partition) - * @param[out] buffer Status of partition - * @param[in] max_len Buffer size - * - * Examples status strings are: "ok", "failed", "corrupted" - * At most (max_len - 1) bytes of the status string will be copied to the buffer argument, - * and NULL is finally appended. - * - * @return 0 on success, otherwise a negative error value - */ -int hal_device_board_get_partition_status(char partition_ab, char *buffer, const int max_len); - - -/** - * @brief Set upgrade status - * - * @param[in] status Upgrade status - * - * @return 0 on success, otherwise a negative error value - */ -int hal_device_board_set_upgrade_status(int status); - -/** - * @brief Get upgrade status - * - * @param[out] status Upgrade status (-1 if upgrade fail, otherwise 0~100) - * - * @return 0 on success, otherwise a negative error value - */ -int hal_device_board_get_upgrade_status(int *status); - -#ifdef __cplusplus -} -#endif - - -#endif /* __HAL_BOARD_H__ */ diff --git a/include/hal-device-board-interface.h b/include/hal-device-board-interface.h new file mode 100644 index 0000000..c083ae0 --- /dev/null +++ b/include/hal-device-board-interface.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2021 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 __HAL_BOARD_INTERFACE_H__ +#define __HAL_BOARD_INTERFACE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _hal_backend_device_board_funcs { + /* Serial number of this device */ + int (*get_device_serial_number)(char *buffer, const int max_len); + int (*get_device_revision)(int *revision); + + int (*set_boot_success)(void); + int (*clear_boot_mode)(void); + int (*get_boot_mode)(char *buffer, const int max_len); + int (*get_boot_reason)(char *buffer, const int max_len); + + int (*get_current_partition)(char *partition_ab); + int (*switch_partition)(char partition_ab); + int (*set_partition_ab_cloned)(void); + int (*clear_partition_ab_cloned)(void); + int (*get_partition_ab_cloned)(int *cloned); + int (*set_partition_status)(char partition_ab, const char *status); + int (*get_partition_status)(char partition_ab, char *buffer, const int max_len); + + int (*set_upgrade_status)(int status); + int (*get_upgrade_status)(int *status); + +} hal_backend_device_board_funcs; + +#ifdef __cplusplus +} +#endif +#endif /* __HAL_BOARD_INTERFACE_H__ */ diff --git a/include/hal-device-board.h b/include/hal-device-board.h new file mode 100644 index 0000000..167e63b --- /dev/null +++ b/include/hal-device-board.h @@ -0,0 +1,195 @@ +/* + * Copyright (c) 2021 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 __HAL_DEVICE_BOARD_H__ +#define __HAL_DEVICE_BOARD_H__ + +#include "hal-device-board-interface.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Initialize hal_board_funcs, which contains hal backend board functions + * + * @return 0 on success, otherwise a negative error value + */ +int hal_device_board_get_backend(void); + +/** + * @brief Release hal_board_funcs and set it to NULL + * + * @return 0 if it is successful or hal_board_funcs is NULL, else negative error value + */ +int hal_device_board_put_backend(void); + +/** + * @brief Get device serial number and save it to a buffer + * + * @param[in] max_len Buffer size + * @param[out] buffer Serial number + * + * At most (max_len - 1) bytes of the serial number string will be copied to the buffer argument, + * and NULL is finally appended. + * + * @return 0 on success, otherwise a negative error value + */ +int hal_device_board_get_device_serial_number(char *buffer, const int max_len); + +/** + * @brief Get device revision (not in use, no hal backend function) + * + * @param[out] revision Revision number + * + * @return 0 on success, otherwise a negative error value + */ +int hal_device_board_get_device_revision(int *revision); + + +/** + * @brief Set the BOOT_SUCCESS flag + * + * @return 0 on success, otherwise a negative error value + */ +int hal_device_board_set_boot_success(void); + +/** + * @brief Clear the BOOT_SUCCESS flag + * + * @return 0 on success, otherwise a negative error value + */ +int hal_device_board_clear_boot_mode(void); + +/** + * @brief Get the boot mode ("fota", "recovery", "normal") + * + * @param[in] max_len Buffer size + * @param[out] buffer boot mode + * + * At most (max_len - 1) bytes of the boot mode string will be copied to the buffer argument, + * and NULL is finally appended. + * + * @return 0 on success, otherwise a negative error value + */ +int hal_device_board_get_boot_mode(char *buffer, const int max_len); + +/** + * @brief Get the boot reason (not in use) + * + * @param[in] max_len Buffer size + * @param[out] buffer boot reason + * + * At most (max_len - 1) bytes of the boot reason string will be copied to the buffer argument, + * and NULL is finally appended. + * + * @return 0 on success, otherwise a negative error value + */ +int hal_device_board_get_boot_reason(char *buffer, const int max_len); + + +/** + * @brief Get partition_ab ('a' or 'b') + * + * @param[in] partition_ab Current partition name ('a' or 'b') + * + * @return 0 on success, otherwise a negative error value + */ +int hal_device_board_get_current_partition(char *partition_ab); + +/** + * @brief Switch partition to partition_ab ('a' or 'b') or toggle partition if partition_ab is '\0' + * + * @param[in] partition_ab Partition name to switch to ('a' or 'b') or '\0'(toggle) + * + * @return 0 on success, otherwise a negative error value + */ +int hal_device_board_switch_partition(char partition_ab); + +/** + * @brief Set ithe cloned flag (for partition a, b) + * + * @return 0 on success, otherwise a negative error value + */ +int hal_device_board_set_partition_ab_cloned(void); + +/** + * @brief Clear the cloned flag (for partition a, b) + * + * @return 0 on success, otherwise a negative error value + */ +int hal_device_board_clear_partition_ab_cloned(void); + +/** + * @brief Get the cloned flag (for partition a, b) + * + * @param[out] cloned Flag if partition a, b are cloned(1) or not(0) + * + * @return 0 on success, otherwise a negative error value + */ +int hal_device_board_get_partition_ab_cloned(int *cloned); + +/** + * @brief Set the partition_status flag + * + * @param[in] partition_ab Partition slot ('a', 'b', '\0')(if '\0' then current partition) + * @param[in] status Status of partition ("ok", "failed", "corrupted") + * + * @return 0 on success, otherwise a negative error value + */ +int hal_device_board_set_partition_status(char partition_ab, const char *status); + +/** + * @brief Set the partition_status flag + * + * @param[in] partition_ab Partition slot ('a', 'b', '\0')(if '\0' then current partition) + * @param[out] buffer Status of partition + * @param[in] max_len Buffer size + * + * Examples status strings are: "ok", "failed", "corrupted" + * At most (max_len - 1) bytes of the status string will be copied to the buffer argument, + * and NULL is finally appended. + * + * @return 0 on success, otherwise a negative error value + */ +int hal_device_board_get_partition_status(char partition_ab, char *buffer, const int max_len); + + +/** + * @brief Set upgrade status + * + * @param[in] status Upgrade status + * + * @return 0 on success, otherwise a negative error value + */ +int hal_device_board_set_upgrade_status(int status); + +/** + * @brief Get upgrade status + * + * @param[out] status Upgrade status (-1 if upgrade fail, otherwise 0~100) + * + * @return 0 on success, otherwise a negative error value + */ +int hal_device_board_get_upgrade_status(int *status); + +#ifdef __cplusplus +} +#endif + + +#endif /* __HAL_DEVICE_BOARD_H__ */ diff --git a/src/board.c b/src/board.c index 6d11d72..762372f 100644 --- a/src/board.c +++ b/src/board.c @@ -17,10 +17,10 @@ #include #include -#include "hal-board-interface.h" +#include "hal-device-board-interface.h" #include "common.h" -static hal_backend_board_funcs *hal_board_funcs = NULL; +static hal_backend_device_board_funcs *hal_device_board_funcs = NULL; /* -1 : failed to initialize 0 : not initialized @@ -32,10 +32,10 @@ int hal_device_board_get_backend(void) { int ret; - if (hal_board_funcs) + if (hal_device_board_funcs) return 0; - ret = hal_common_get_backend(HAL_MODULE_DEVICE_BOARD, (void **)&hal_board_funcs); + ret = hal_common_get_backend(HAL_MODULE_DEVICE_BOARD, (void **)&hal_device_board_funcs); if (ret < 0) { _E("Failed to get board backend"); hal_initialized = -1; @@ -48,11 +48,11 @@ int hal_device_board_get_backend(void) int hal_device_board_put_backend(void) { - if (!hal_board_funcs) + if (!hal_device_board_funcs) return 0; - hal_common_put_backend(HAL_MODULE_DEVICE_BOARD, (void *)hal_board_funcs); - hal_board_funcs = NULL; + hal_common_put_backend(HAL_MODULE_DEVICE_BOARD, (void *)hal_device_board_funcs); + hal_device_board_funcs = NULL; hal_initialized = 0; return 0; @@ -62,48 +62,48 @@ int hal_device_board_get_device_serial_number(char *buffer, const int max_len) { int ret ; - if (!hal_board_funcs && !hal_initialized) { + if (!hal_device_board_funcs && !hal_initialized) { if ((ret = hal_device_board_get_backend()) < 0) return ret; } - if (!hal_board_funcs || - !hal_board_funcs->get_device_serial_number) + if (!hal_device_board_funcs || + !hal_device_board_funcs->get_device_serial_number) return -ENODEV; - return hal_board_funcs->get_device_serial_number(buffer, max_len); + return hal_device_board_funcs->get_device_serial_number(buffer, max_len); } int hal_device_board_get_device_revision(int *revision) { int ret ; - if (!hal_board_funcs && !hal_initialized) { + if (!hal_device_board_funcs && !hal_initialized) { if ((ret = hal_device_board_get_backend()) < 0) return ret; } - if (!hal_board_funcs || - !hal_board_funcs->get_device_revision) + if (!hal_device_board_funcs || + !hal_device_board_funcs->get_device_revision) return -ENODEV; - return hal_board_funcs->get_device_revision(revision); + return hal_device_board_funcs->get_device_revision(revision); } int hal_device_board_set_boot_success(void) { int ret; - if (!hal_board_funcs && !hal_initialized) { + if (!hal_device_board_funcs && !hal_initialized) { if ((ret = hal_device_board_get_backend()) < 0) return ret; } - if (!hal_board_funcs || - !hal_board_funcs->set_boot_success) + if (!hal_device_board_funcs || + !hal_device_board_funcs->set_boot_success) return -ENODEV; - return hal_board_funcs->set_boot_success(); + return hal_device_board_funcs->set_boot_success(); } @@ -111,190 +111,190 @@ int hal_device_board_clear_boot_mode(void) { int ret; - if (!hal_board_funcs && !hal_initialized) { + if (!hal_device_board_funcs && !hal_initialized) { if ((ret = hal_device_board_get_backend()) < 0) return ret; } - if (!hal_board_funcs || - !hal_board_funcs->clear_boot_mode) + if (!hal_device_board_funcs || + !hal_device_board_funcs->clear_boot_mode) return -ENODEV; - return hal_board_funcs->clear_boot_mode(); + return hal_device_board_funcs->clear_boot_mode(); } int hal_device_board_get_boot_mode(char *buffer, const int max_len) { int ret; - if (!hal_board_funcs && !hal_initialized) { + if (!hal_device_board_funcs && !hal_initialized) { if ((ret = hal_device_board_get_backend()) < 0) return ret; } - if (!hal_board_funcs || - !hal_board_funcs->get_boot_mode) + if (!hal_device_board_funcs || + !hal_device_board_funcs->get_boot_mode) return -ENODEV; - return hal_board_funcs->get_boot_mode(buffer, max_len); + return hal_device_board_funcs->get_boot_mode(buffer, max_len); } int hal_device_board_get_boot_reason(char *buffer, const int max_len) { int ret; - if (!hal_board_funcs && !hal_initialized) { + if (!hal_device_board_funcs && !hal_initialized) { if ((ret = hal_device_board_get_backend()) < 0) return ret; } - if (!hal_board_funcs || - !hal_board_funcs->get_boot_reason) + if (!hal_device_board_funcs || + !hal_device_board_funcs->get_boot_reason) return -ENODEV; - return hal_board_funcs->get_boot_reason(buffer, max_len); + return hal_device_board_funcs->get_boot_reason(buffer, max_len); } int hal_device_board_get_current_partition(char *partition_ab) { int ret; - if (!hal_board_funcs && !hal_initialized) { + if (!hal_device_board_funcs && !hal_initialized) { if ((ret = hal_device_board_get_backend()) < 0) return ret; } - if (!hal_board_funcs || - !hal_board_funcs->get_current_partition) + if (!hal_device_board_funcs || + !hal_device_board_funcs->get_current_partition) return -ENODEV; - return hal_board_funcs->get_current_partition(partition_ab); + return hal_device_board_funcs->get_current_partition(partition_ab); } int hal_device_board_switch_partition(char partition_ab) { int ret; - if (!hal_board_funcs && !hal_initialized) { + if (!hal_device_board_funcs && !hal_initialized) { if ((ret = hal_device_board_get_backend()) < 0) return ret; } - if (!hal_board_funcs || - !hal_board_funcs->switch_partition) + if (!hal_device_board_funcs || + !hal_device_board_funcs->switch_partition) return -ENODEV; - return hal_board_funcs->switch_partition(partition_ab); + return hal_device_board_funcs->switch_partition(partition_ab); } int hal_device_board_set_partition_ab_cloned(void) { int ret; - if (!hal_board_funcs && !hal_initialized) { + if (!hal_device_board_funcs && !hal_initialized) { if ((ret = hal_device_board_get_backend()) < 0) return ret; } - if (!hal_board_funcs || - !hal_board_funcs->set_partition_ab_cloned) + if (!hal_device_board_funcs || + !hal_device_board_funcs->set_partition_ab_cloned) return -ENODEV; - return hal_board_funcs->set_partition_ab_cloned(); + return hal_device_board_funcs->set_partition_ab_cloned(); } int hal_device_board_clear_partition_ab_cloned(void) { int ret; - if (!hal_board_funcs && !hal_initialized) { + if (!hal_device_board_funcs && !hal_initialized) { if ((ret = hal_device_board_get_backend()) < 0) return ret; } - if (!hal_board_funcs || - !hal_board_funcs->clear_partition_ab_cloned) + if (!hal_device_board_funcs || + !hal_device_board_funcs->clear_partition_ab_cloned) return -ENODEV; - return hal_board_funcs->clear_partition_ab_cloned(); + return hal_device_board_funcs->clear_partition_ab_cloned(); } int hal_device_board_get_partition_ab_cloned(int *cloned) { int ret; - if (!hal_board_funcs && !hal_initialized) { + if (!hal_device_board_funcs && !hal_initialized) { if ((ret = hal_device_board_get_backend()) < 0) return ret; } - if (!hal_board_funcs || - !hal_board_funcs->get_partition_ab_cloned) + if (!hal_device_board_funcs || + !hal_device_board_funcs->get_partition_ab_cloned) return -ENODEV; - return hal_board_funcs->get_partition_ab_cloned(cloned); + return hal_device_board_funcs->get_partition_ab_cloned(cloned); } int hal_device_board_set_partition_status(char partition_ab, const char *status) { int ret; - if (!hal_board_funcs && !hal_initialized) { + if (!hal_device_board_funcs && !hal_initialized) { if ((ret = hal_device_board_get_backend()) < 0) return ret; } - if (!hal_board_funcs || - !hal_board_funcs->set_partition_status) + if (!hal_device_board_funcs || + !hal_device_board_funcs->set_partition_status) return -ENODEV; - return hal_board_funcs->set_partition_status(partition_ab, status); + return hal_device_board_funcs->set_partition_status(partition_ab, status); } int hal_device_board_get_partition_status(char partition_ab, char *buffer, const int max_len) { int ret; - if (!hal_board_funcs && !hal_initialized) { + if (!hal_device_board_funcs && !hal_initialized) { if ((ret = hal_device_board_get_backend()) < 0) return ret; } - if (!hal_board_funcs || - !hal_board_funcs->get_partition_status) + if (!hal_device_board_funcs || + !hal_device_board_funcs->get_partition_status) return -ENODEV; - return hal_board_funcs->get_partition_status(partition_ab, buffer, max_len); + return hal_device_board_funcs->get_partition_status(partition_ab, buffer, max_len); } int hal_device_board_set_upgrade_status(int status) { int ret; - if (!hal_board_funcs && !hal_initialized) { + if (!hal_device_board_funcs && !hal_initialized) { if ((ret = hal_device_board_get_backend()) < 0) return ret; } - if (!hal_board_funcs || - !hal_board_funcs->set_upgrade_status) + if (!hal_device_board_funcs || + !hal_device_board_funcs->set_upgrade_status) return -ENODEV; - return hal_board_funcs->set_upgrade_status(status); + return hal_device_board_funcs->set_upgrade_status(status); } int hal_device_board_get_upgrade_status(int *status) { int ret; - if (!hal_board_funcs && !hal_initialized) { + if (!hal_device_board_funcs && !hal_initialized) { if ((ret = hal_device_board_get_backend()) < 0) return ret; } - if (!hal_board_funcs || - !hal_board_funcs->get_upgrade_status) + if (!hal_device_board_funcs || + !hal_device_board_funcs->get_upgrade_status) return -ENODEV; - return hal_board_funcs->get_upgrade_status(status); + return hal_device_board_funcs->get_upgrade_status(status); }