includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h>

As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.

The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.

NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2022-08-25 09:58:46 +02:00 committed by Carles Cufí
commit 79e6b0e0f6
1082 changed files with 1120 additions and 1080 deletions

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/zephyr.h>
#include <zephyr/kernel.h>
#include <stdio.h>
#include <stdint.h>
#include <errno.h>

View file

@ -9,7 +9,7 @@
#ifndef ZEPHYR_TESTSUITE_INCLUDE_TC_UTIL_H_
#define ZEPHYR_TESTSUITE_INCLUDE_TC_UTIL_H_
#include <zephyr/zephyr.h>
#include <zephyr/kernel.h>
#include <string.h>
#ifdef CONFIG_SHELL

View file

@ -13,7 +13,7 @@
#ifndef _TIMESTAMP_H_
#define _TIMESTAMP_H_
#include <zephyr/zephyr.h>
#include <zephyr/kernel.h>
#include <limits.h>
#if defined(__GNUC__)

View file

@ -44,7 +44,7 @@ typedef struct esf z_arch_esf_t;
#include <zephyr/sys/printk.h>
#define PRINT printk
#include <zephyr/zephyr.h>
#include <zephyr/kernel.h>
#include <zephyr/ztest_assert.h>
#include <zephyr/ztest_mock.h>

View file

@ -7,7 +7,7 @@
#ifndef ZEPHYR_INCLUDE_ZTEST_FATAL_HOOK_H_
#define ZEPHYR_INCLUDE_ZTEST_FATAL_HOOK_H_
#include <zephyr/zephyr.h>
#include <zephyr/kernel.h>
#ifdef __cplusplus
extern "C" {

View file

@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/zephyr.h>
#include <zephyr/kernel.h>
#include <zephyr/ztest.h>