From 5b0aa794b24739c639a3d81c91223657d5f2f4b3 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Wed, 26 Jun 2019 10:44:43 -0400 Subject: [PATCH] cleanup: include/: move misc/reboot.h to power/reboot.h move misc/reboot.h to power/reboot.h and create a shim for backward-compatibility. No functional changes to the headers. A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES. Related to #16539 Signed-off-by: Anas Nashif --- arch/arm/core/cortex_m/nmi.c | 2 +- arch/x86/core/reboot_rst_cnt.c | 2 +- drivers/watchdog/wdt_cmsdk_apb.c | 2 +- include/misc/reboot.h | 35 ++-------------- include/power/reboot.h | 42 +++++++++++++++++++ lib/updatehub/updatehub.c | 2 +- samples/subsys/nvs/src/main.c | 2 +- subsys/net/lib/openthread/platform/misc.c | 2 +- subsys/power/reboot.c | 2 +- subsys/shell/modules/kernel_service.c | 2 +- .../arm_runtime_nmi/src/arm_runtime_nmi.c | 2 +- .../fcb_init/src/settings_test_fcb_init.c | 2 +- 12 files changed, 56 insertions(+), 41 deletions(-) create mode 100644 include/power/reboot.h diff --git a/arch/arm/core/cortex_m/nmi.c b/arch/arm/core/cortex_m/nmi.c index 4066d84d9760b8..22f2c64756a639 100644 --- a/arch/arm/core/cortex_m/nmi.c +++ b/arch/arm/core/cortex_m/nmi.c @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include diff --git a/arch/x86/core/reboot_rst_cnt.c b/arch/x86/core/reboot_rst_cnt.c index b8100ea26f1360..a4fa94529a25ab 100644 --- a/arch/x86/core/reboot_rst_cnt.c +++ b/arch/x86/core/reboot_rst_cnt.c @@ -11,7 +11,7 @@ */ #include -#include +#include /* reboot through Reset Control Register (I/O port 0xcf9) */ diff --git a/drivers/watchdog/wdt_cmsdk_apb.c b/drivers/watchdog/wdt_cmsdk_apb.c index 99863a53c1fa7c..10859e347a2cfb 100644 --- a/drivers/watchdog/wdt_cmsdk_apb.c +++ b/drivers/watchdog/wdt_cmsdk_apb.c @@ -12,7 +12,7 @@ #include #include #include -#include +#include struct wdog_cmsdk_apb { /* offset: 0x000 (r/w) watchdog load register */ diff --git a/include/misc/reboot.h b/include/misc/reboot.h index 8bf7755eb58dc4..0e72799374110f 100644 --- a/include/misc/reboot.h +++ b/include/misc/reboot.h @@ -1,42 +1,15 @@ /* - * Copyright (c) 2015 Wind River Systems, Inc. + * Copyright (c) 2019 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ - -/** - * @file - * @brief Common target reboot functionality - * - * @details See misc/Kconfig and the reboot help for details. - */ - #ifndef ZEPHYR_INCLUDE_MISC_REBOOT_H_ #define ZEPHYR_INCLUDE_MISC_REBOOT_H_ -#ifdef __cplusplus -extern "C" { +#ifndef CONFIG_COMPAT_INCLUDES +#warning "This header file has moved, include instead." #endif -#define SYS_REBOOT_WARM 0 -#define SYS_REBOOT_COLD 1 - -/** - * @brief Reboot the system - * - * Reboot the system in the manner specified by @a type. Not all architectures - * or platforms support the various reboot types (SYS_REBOOT_COLD, - * SYS_REBOOT_WARM). - * - * When successful, this routine does not return. - * - * @return N/A - */ - -extern void sys_reboot(int type); - -#ifdef __cplusplus -} -#endif +#include #endif /* ZEPHYR_INCLUDE_MISC_REBOOT_H_ */ diff --git a/include/power/reboot.h b/include/power/reboot.h new file mode 100644 index 00000000000000..84e25353068906 --- /dev/null +++ b/include/power/reboot.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2015 Wind River Systems, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @file + * @brief Common target reboot functionality + * + * @details See misc/Kconfig and the reboot help for details. + */ + +#ifndef ZEPHYR_INCLUDE_POWER_REBOOT_H_ +#define ZEPHYR_INCLUDE_POWER_REBOOT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define SYS_REBOOT_WARM 0 +#define SYS_REBOOT_COLD 1 + +/** + * @brief Reboot the system + * + * Reboot the system in the manner specified by @a type. Not all architectures + * or platforms support the various reboot types (SYS_REBOOT_COLD, + * SYS_REBOOT_WARM). + * + * When successful, this routine does not return. + * + * @return N/A + */ + +extern void sys_reboot(int type); + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_INCLUDE_POWER_REBOOT_H_ */ diff --git a/lib/updatehub/updatehub.c b/lib/updatehub/updatehub.c index a44c0f267c0c6f..80c852a2403e33 100644 --- a/lib/updatehub/updatehub.c +++ b/lib/updatehub/updatehub.c @@ -18,7 +18,7 @@ LOG_MODULE_REGISTER(updatehub); #include #include #include -#include +#include #include #include diff --git a/samples/subsys/nvs/src/main.c b/samples/subsys/nvs/src/main.c index b08ffd01c6687b..5a152bba695ba0 100644 --- a/samples/subsys/nvs/src/main.c +++ b/samples/subsys/nvs/src/main.c @@ -39,7 +39,7 @@ #include -#include +#include #include #include #include diff --git a/subsys/net/lib/openthread/platform/misc.c b/subsys/net/lib/openthread/platform/misc.c index 5808e14cae407a..8484c22c877740 100644 --- a/subsys/net/lib/openthread/platform/misc.c +++ b/subsys/net/lib/openthread/platform/misc.c @@ -5,7 +5,7 @@ */ #include -#include +#include #include #include diff --git a/subsys/power/reboot.c b/subsys/power/reboot.c index fbe647bd38161f..805cf79184bfe7 100644 --- a/subsys/power/reboot.c +++ b/subsys/power/reboot.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include extern void sys_arch_reboot(int type); extern void sys_clock_disable(void); diff --git a/subsys/shell/modules/kernel_service.c b/subsys/shell/modules/kernel_service.c index 5a9bab8e0e837b..f0504dc4dee03b 100644 --- a/subsys/shell/modules/kernel_service.c +++ b/subsys/shell/modules/kernel_service.c @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tests/kernel/arm_runtime_nmi/src/arm_runtime_nmi.c b/tests/kernel/arm_runtime_nmi/src/arm_runtime_nmi.c index 981d2eeaf29225..eef08ba6c533c1 100644 --- a/tests/kernel/arm_runtime_nmi/src/arm_runtime_nmi.c +++ b/tests/kernel/arm_runtime_nmi/src/arm_runtime_nmi.c @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include #include diff --git a/tests/subsys/settings/fcb_init/src/settings_test_fcb_init.c b/tests/subsys/settings/fcb_init/src/settings_test_fcb_init.c index dee6ad2ac6ede6..84659c57b006ce 100644 --- a/tests/subsys/settings/fcb_init/src/settings_test_fcb_init.c +++ b/tests/subsys/settings/fcb_init/src/settings_test_fcb_init.c @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include