init: remove the need for a dummy device pointer in SYS_INIT functions

The init infrastructure, found in `init.h`, is currently used by:

- `SYS_INIT`: to call functions before `main`
- `DEVICE_*`: to initialize devices

They are all sorted according to an initialization level + a priority.
`SYS_INIT` calls are really orthogonal to devices, however, the required
function signature requires a `const struct device *dev` as a first
argument. The only reason for that is because the same init machinery is
used by devices, so we have something like:

```c
struct init_entry {
	int (*init)(const struct device *dev);
	/* only set by DEVICE_*, otherwise NULL */
	const struct device *dev;
}
```

As a result, we end up with such weird/ugly pattern:

```c
static int my_init(const struct device *dev)
{
	/* always NULL! add ARG_UNUSED to avoid compiler warning */
	ARG_UNUSED(dev);
	...
}
```

This is really a result of poor internals isolation. This patch proposes
a to make init entries more flexible so that they can accept sytem
initialization calls like this:

```c
static int my_init(void)
{
	...
}
```

This is achieved using a union:

```c
union init_function {
	/* for SYS_INIT, used when init_entry.dev == NULL */
	int (*sys)(void);
	/* for DEVICE*, used when init_entry.dev != NULL */
	int (*dev)(const struct device *dev);
};

struct init_entry {
	/* stores init function (either for SYS_INIT or DEVICE*)
	union init_function init_fn;
	/* stores device pointer for DEVICE*, NULL for SYS_INIT. Allows
	 * to know which union entry to call.
	 */
	const struct device *dev;
}
```

This solution **does not increase ROM usage**, and allows to offer clean
public APIs for both SYS_INIT and DEVICE*. Note that however, init
machinery keeps a coupling with devices.

**NOTE**: This is a breaking change! All `SYS_INIT` functions will need
to be converted to the new signature. See the script offered in the
following commit.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

init: convert SYS_INIT functions to the new signature

Conversion scripted using scripts/utils/migrate_sys_init.py.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

manifest: update projects for SYS_INIT changes

Update modules with updated SYS_INIT calls:

- hal_ti
- lvgl
- sof
- TraceRecorderSource

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

tests: devicetree: devices: adjust test

Adjust test according to the recently introduced SYS_INIT
infrastructure.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

tests: kernel: threads: adjust SYS_INIT call

Adjust to the new signature: int (*init_fn)(void);

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2022-10-19 09:33:44 +02:00 committed by Fabio Baltieri
parent 2a76637963
commit a5fd0d184a
413 changed files with 499 additions and 818 deletions

View file

@ -145,9 +145,8 @@ void arch_sched_ipi(void)
}
}
static int arc_smp_init(const struct device *dev)
static int arc_smp_init(void)
{
ARG_UNUSED(dev);
struct arc_connect_bcr bcr;
/* necessary master core init */

View file

@ -216,9 +216,8 @@ int arch_icache_flush_and_invd_range(void *addr, size_t size)
return -ENOTSUP;
}
static int init_dcache(const struct device *unused)
static int init_dcache(void)
{
ARG_UNUSED(unused);
arch_dcache_enable();

View file

@ -54,9 +54,8 @@ void arch_irq_offload(irq_offload_routine_t routine, const void *parameter)
}
/* need to be executed on every core in the system */
int arc_irq_offload_init(const struct device *unused)
int arc_irq_offload_init(void)
{
ARG_UNUSED(unused);
IRQ_CONNECT(IRQ_OFFLOAD_LINE, IRQ_OFFLOAD_PRIO, arc_irq_offload_handler, NULL, 0);

View file

@ -238,9 +238,8 @@ int arc_core_mpu_buffer_validate(void *addr, size_t size, int write)
* This function provides the default configuration mechanism for the Memory
* Protection Unit (MPU).
*/
static int arc_mpu_init(const struct device *arg)
static int arc_mpu_init(void)
{
ARG_UNUSED(arg);
uint32_t num_regions = get_num_regions();

View file

@ -814,9 +814,8 @@ int arc_core_mpu_buffer_validate(void *addr, size_t size, int write)
* This function provides the default configuration mechanism for the Memory
* Protection Unit (MPU).
*/
static int arc_mpu_init(const struct device *arg)
static int arc_mpu_init(void)
{
ARG_UNUSED(arg);
uint32_t num_regions;
uint32_t i;

View file

@ -48,7 +48,7 @@ static void sjli_table_init(void)
/*
* @brief initialization of secureshield related functions.
*/
static int arc_secureshield_init(const struct device *arg)
static int arc_secureshield_init(void)
{
sjli_table_init();

View file

@ -58,9 +58,8 @@ BUILD_ASSERT(!(CONFIG_CORTEX_M_NULL_POINTER_EXCEPTION_PAGE_SIZE &
(CONFIG_CORTEX_M_NULL_POINTER_EXCEPTION_PAGE_SIZE - 1)),
"the size of the partition must be power of 2");
static int z_arm_debug_enable_null_pointer_detection(const struct device *arg)
static int z_arm_debug_enable_null_pointer_detection(void)
{
ARG_UNUSED(arg);
z_arm_dwt_init();
z_arm_dwt_enable_debug_monitor();

View file

@ -226,9 +226,8 @@ void z_arm64_flush_fpu_ipi(unsigned int cpu)
}
#endif
static int arm64_smp_init(const struct device *dev)
static int arm64_smp_init(void)
{
ARG_UNUSED(dev);
/*
* SGI0 is use for sched ipi, this might be changed to use Kconfig

View file

@ -42,9 +42,8 @@ static int xen_map_shared_info(const shared_info_t *shared_page)
return HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp);
}
static int xen_enlighten_init(const struct device *dev)
static int xen_enlighten_init(void)
{
ARG_UNUSED(dev);
int ret = 0;
shared_info_t *info = (shared_info_t *) shared_info_buf;

View file

@ -118,9 +118,8 @@ static void ipi_handler(const void *unused)
#endif
}
static int riscv_smp_init(const struct device *dev)
static int riscv_smp_init(void)
{
ARG_UNUSED(dev);
IRQ_CONNECT(RISCV_MACHINE_SOFT_IRQ, 0, ipi_handler, NULL, 0);
irq_enable(RISCV_MACHINE_SOFT_IRQ);

View file

@ -17,9 +17,8 @@
*/
#if defined(CONFIG_DISABLE_SSBD) || defined(CONFIG_ENABLE_EXTENDED_IBRS)
static int spec_ctrl_init(const struct device *dev)
static int spec_ctrl_init(void)
{
ARG_UNUSED(dev);
uint32_t enable_bits = 0U;
uint32_t cpuid7 = z_x86_cpuid_extended_features();

View file

@ -702,7 +702,7 @@ void z_x86_dump_page_tables(pentry_t *ptables)
#if DUMP_PAGE_TABLES
__pinned_func
static int dump_kernel_tables(const struct device *unused)
static int dump_kernel_tables(void)
{
z_x86_dump_page_tables(z_x86_kernel_ptables);

View file

@ -123,7 +123,7 @@
#define PM6_LR_CSS_STAT ((1 << BIT2) << PM6_OFFSET)
static int pmod_mux_init(const struct device *dev)
static int pmod_mux_init(void)
{
volatile uint32_t *mux_regs = (uint32_t *)(PMODMUX_BASE_ADDR);

View file

@ -10,9 +10,8 @@
#define HSDK_CREG_GPIO_MUX_REG 0xf0001484
#define HSDK_CREG_GPIO_MUX_VAL 0x00000400
static int hsdk_creg_gpio_mux_init(const struct device *dev)
static int hsdk_creg_gpio_mux_init(void)
{
ARG_UNUSED(dev);
sys_write32(HSDK_CREG_GPIO_MUX_REG, HSDK_CREG_GPIO_MUX_VAL);

View file

@ -30,9 +30,8 @@
#define AUX_CLN_DATA 0x641
static int haps_arcv3_init(const struct device *dev)
static int haps_arcv3_init(void)
{
ARG_UNUSED(dev);
z_arc_v2_aux_reg_write(AUX_CLN_ADDR, ARC_CLN_PER0_BASE);
z_arc_v2_aux_reg_write(AUX_CLN_DATA, 0xF00);

View file

@ -7,7 +7,7 @@
#include <zephyr/drivers/gpio.h>
#include <zephyr/init.h>
static int rf_init(const struct device *dev)
static int rf_init(void)
{
const struct gpio_dt_spec rf1 =
GPIO_DT_SPEC_GET(DT_NODELABEL(rf_switch), rf1_gpios);
@ -16,7 +16,6 @@ static int rf_init(const struct device *dev)
const struct gpio_dt_spec rf3 =
GPIO_DT_SPEC_GET(DT_NODELABEL(rf_switch), rf3_gpios);
ARG_UNUSED(dev);
/* configure RFSW8001 GPIOs (110: RF1/RF2 coexistence mode) */
if (!device_is_ready(rf1.port) ||

View file

@ -7,9 +7,8 @@
#include <zephyr/init.h>
#include <zephyr/drivers/gpio.h>
static int board_init(const struct device *dev)
static int board_init(void)
{
ARG_UNUSED(dev);
int res;
static const struct gpio_dt_spec pull_up =

View file

@ -7,9 +7,8 @@
#include <zephyr/init.h>
#include <zephyr/drivers/gpio.h>
static int board_init(const struct device *dev)
static int board_init(void)
{
ARG_UNUSED(dev);
/* Set led1 inactive since the Arduino bootloader leaves it active */
const struct gpio_dt_spec led1 = GPIO_DT_SPEC_GET(DT_ALIAS(led1), gpios);

View file

@ -60,9 +60,8 @@ bool board_daplink_is_fitted(void)
return !NVIC_GetPendingIRQ(DT_IRQN(DAPLINK_QSPI_MUX_NODE));
}
static int board_init(const struct device *dev)
static int board_init(void)
{
ARG_UNUSED(dev);
/*
* Automatically select normal mode unless the DAPLink shield is fitted

View file

@ -41,9 +41,8 @@ const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
/**
* Antenna switch GPIO init routine.
*/
static int board_antenna_init(const struct device *dev)
static int board_antenna_init(void)
{
ARG_UNUSED(dev);
/* set all paths to low */
IOCPinTypeGpioOutput(BOARD_RF_HIGH_PA);

View file

@ -23,9 +23,8 @@ static void remoteproc_mgr_config(void)
#endif /* !CONFIG_TRUSTED_EXECUTION_NONSECURE */
}
static int remoteproc_mgr_boot(const struct device *dev)
static int remoteproc_mgr_boot(void)
{
ARG_UNUSED(dev);
/* Secure domain may configure permissions for the Network MCU. */
remoteproc_mgr_config();

View file

@ -89,9 +89,8 @@
#define I2C_CC32XX_PIN_16_I2C_SCL 0x90F /*!< PIN 16 is used for I2C_SCL */
#define I2C_CC32XX_PIN_17_I2C_SDA 0x910 /*!< PIN 17 is used for I2C_SDA */
int pinmux_initialize(const struct device *port)
int pinmux_initialize(void)
{
ARG_UNUSED(port);
#ifdef CONFIG_UART_CC32XX
/* Configure PIN_55 for UART0 UART0_TX */

View file

@ -64,9 +64,8 @@
#define I2C_CC32XX_PIN_16_I2C_SCL 0x90F /*!< PIN 16 is used for I2C_SCL */
#define I2C_CC32XX_PIN_17_I2C_SDA 0x910 /*!< PIN 17 is used for I2C_SDA */
int pinmux_initialize(const struct device *port)
int pinmux_initialize(void)
{
ARG_UNUSED(port);
#ifdef CONFIG_UART_CC32XX
/* Configure PIN_55 for UART0 UART0_TX */

View file

@ -12,9 +12,8 @@
#include "em_cmu.h"
#include "board.h"
static int efm32gg_slwstk6121a_init(const struct device *dev)
static int efm32gg_slwstk6121a_init(void)
{
ARG_UNUSED(dev);
const struct device *cur_dev;

View file

@ -11,11 +11,10 @@
#include <zephyr/sys/printk.h>
#include "em_cmu.h"
static int efm32gg_stk3701a_init(const struct device *dev)
static int efm32gg_stk3701a_init(void)
{
const struct device *cur_dev;
ARG_UNUSED(dev);
/* Enable the board controller to be able to use the serial port */
cur_dev = DEVICE_DT_GET(BC_ENABLE_GPIO_NODE);

View file

@ -9,11 +9,10 @@
#include <zephyr/drivers/gpio.h>
#include <zephyr/sys/printk.h>
static int efm32hg_slstk3400a_init(const struct device *dev)
static int efm32hg_slstk3400a_init(void)
{
const struct device *bce_dev; /* Board Controller Enable Gpio Device */
ARG_UNUSED(dev);
/* Enable the board controller to be able to use the serial port */
bce_dev = DEVICE_DT_GET(BC_ENABLE_GPIO_NODE);

View file

@ -9,11 +9,10 @@
#include <zephyr/drivers/gpio.h>
#include <zephyr/sys/printk.h>
static int efm32pg_stk3401a_init(const struct device *dev)
static int efm32pg_stk3401a_init(void)
{
const struct device *bce_dev; /* Board Controller Enable Gpio Device */
ARG_UNUSED(dev);
/* Enable the board controller to be able to use the serial port */
bce_dev = DEVICE_DT_GET(BC_ENABLE_GPIO_NODE);

View file

@ -9,11 +9,10 @@
#include <zephyr/drivers/gpio.h>
#include <zephyr/sys/printk.h>
static int efm32pg_stk3402a_init(const struct device *dev)
static int efm32pg_stk3402a_init(void)
{
const struct device *bce_dev; /* Board Controller Enable Gpio Device */
ARG_UNUSED(dev);
/* Enable the board controller to be able to use the serial port */
bce_dev = DEVICE_DT_GET(BC_ENABLE_GPIO_NODE);

View file

@ -9,11 +9,10 @@
#include <zephyr/drivers/gpio.h>
#include <zephyr/sys/printk.h>
static int efm32wg_stk3800_init(const struct device *dev)
static int efm32wg_stk3800_init(void)
{
const struct device *bce_dev; /* Board Controller Enable Gpio Device */
ARG_UNUSED(dev);
/* Enable the board controller to be able to use the serial port */
bce_dev = DEVICE_DT_GET(BC_ENABLE_GPIO_NODE);

View file

@ -17,11 +17,10 @@
#define VCOM_ENABLE_GPIO_PIN 5
#endif /* CONFIG_BOARD_EFR32_RADIO_BRD4180A */
static int efr32_radio_init(const struct device *dev)
static int efr32_radio_init(void)
{
const struct device *vce_dev; /* Virtual COM Port Enable GPIO Device */
ARG_UNUSED(dev);
/* Enable the board controller to be able to use the serial port */
vce_dev = DEVICE_DT_GET(VCOM_ENABLE_GPIO_NODE);

View file

@ -16,7 +16,7 @@ LOG_MODULE_REGISTER(efr32bg_sltb010a, CONFIG_BOARD_EFR32BG22_LOG_LEVEL);
static int efr32bg_sltb010a_init_clocks(void);
static int efr32bg_sltb010a_init(const struct device *dev)
static int efr32bg_sltb010a_init(void)
{
int ret;
@ -26,7 +26,6 @@ static int efr32bg_sltb010a_init(const struct device *dev)
static struct gpio_dt_spec wake_up_gpio_dev =
GPIO_DT_SPEC_GET(DT_NODELABEL(wake_up_trigger), gpios);
ARG_UNUSED(dev);
if (!device_is_ready(wake_up_gpio_dev.port)) {
LOG_ERR("Wake-up GPIO device was not found!\n");

View file

@ -28,12 +28,11 @@ static int enable_supply(const struct supply_cfg *cfg)
return rv;
}
static int efr32mg_sltb004a_init(const struct device *dev)
static int efr32mg_sltb004a_init(void)
{
struct supply_cfg cfg;
int rc = 0;
ARG_UNUSED(dev);
(void)cfg;
#define CCS811 DT_NODELABEL(ccs811)

View file

@ -17,7 +17,7 @@ LOG_MODULE_REGISTER(efr32xg24_dk2601b, CONFIG_BOARD_EFR32MG24_LOG_LEVEL);
static int efr32xg24_dk2601b_init_clocks(void);
static int efr32xg24_dk2601b_init(const struct device *dev)
static int efr32xg24_dk2601b_init(void)
{
int ret;
@ -27,7 +27,6 @@ static int efr32xg24_dk2601b_init(const struct device *dev)
static struct gpio_dt_spec wake_up_gpio_dev =
GPIO_DT_SPEC_GET(DT_NODELABEL(wake_up_trigger), gpios);
ARG_UNUSED(dev);
if (!device_is_ready(wake_up_gpio_dev.port)) {
LOG_ERR("Wake-up GPIO device was not found!\n");

View file

@ -9,9 +9,8 @@
#include <fsl_iocon.h>
#include <soc.h>
static int lpcxpresso_55s69_pinmux_init(const struct device *dev)
static int lpcxpresso_55s69_pinmux_init(void)
{
ARG_UNUSED(dev);
#if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm6), nxp_lpc_i2s, okay)) && \
(DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm7), nxp_lpc_i2s, okay)) && \

View file

@ -10,9 +10,8 @@
#include "soc.h"
static int board_pinmux_init(const struct device *dev)
static int board_pinmux_init(void)
{
ARG_UNUSED(dev);
/* See table 2-4 from the Data sheet*/
#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart0), okay)

View file

@ -14,7 +14,7 @@
#define MIO_DEFAULT 0x0
#define MIO_UART0 0xc0
static int mercury_xu_init(const struct device *port)
static int mercury_xu_init(void)
{
/* pinmux settings for uart */
sys_write32(MIO_UART0, MIO_PIN_38);
@ -24,7 +24,6 @@ static int mercury_xu_init(const struct device *port)
sys_write32(MIO_DEFAULT, MIO_PIN_18);
sys_write32(MIO_DEFAULT, MIO_PIN_19);
ARG_UNUSED(port);
return 0;
}

View file

@ -45,7 +45,7 @@ static int32_t board_calc_volt_level(void)
return volt;
}
static int board_config_pmic(const struct device *dev)
static int board_config_pmic(void)
{
uint32_t volt;
int ret = 0;
@ -79,7 +79,7 @@ static int board_config_pmic(const struct device *dev)
}
#endif
static int mimxrt595_evk_init(const struct device *dev)
static int mimxrt595_evk_init(void)
{
/* Set the correct voltage range according to the board. */
power_pad_vrange_t vrange = {

View file

@ -7,9 +7,8 @@
#include <zephyr/devicetree.h>
#include <fsl_device_registers.h>
static int mimxrt685_evk_init(const struct device *dev)
static int mimxrt685_evk_init(void)
{
ARG_UNUSED(dev);
/* flexcomm1 and flexcomm3 are configured to loopback the TX signal to RX */
#if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm1), nxp_lpc_i2s, okay)) && \

View file

@ -152,9 +152,8 @@ static void arm_mps2_pinmux_defaults(void)
CMSDK_AHB_GPIO2_DEV->altfuncset = gpio_2;
}
static int arm_mps2_pinmux_init(const struct device *port)
static int arm_mps2_pinmux_init(void)
{
ARG_UNUSED(port);
arm_mps2_pinmux_defaults();

View file

@ -152,9 +152,8 @@ static void arm_mps2_pinmux_defaults(void)
CMSDK_AHB_GPIO2_DEV->altfuncset = gpio_2;
}
static int arm_mps2_pinmux_init(const struct device *port)
static int arm_mps2_pinmux_init(void)
{
ARG_UNUSED(port);
arm_mps2_pinmux_defaults();

View file

@ -7,9 +7,8 @@
#include <zephyr/init.h>
#include <hal/nrf_power.h>
static int board_nrf52840dongle_nrf52840_init(const struct device *dev)
static int board_nrf52840dongle_nrf52840_init(void)
{
ARG_UNUSED(dev);
/* if the nrf52840dongle_nrf52840 board is powered from USB
* (high voltage mode), GPIO output voltage is set to 1.8 volts by

View file

@ -49,11 +49,10 @@ static void remoteproc_mgr_config(void)
#endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) */
}
static int remoteproc_mgr_boot(const struct device *dev)
static int remoteproc_mgr_boot(void)
{
int ret;
ARG_UNUSED(dev);
ret = core_config();
if (ret) {

View file

@ -33,9 +33,8 @@ static void remoteproc_mgr_config(void)
#endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) */
}
static int remoteproc_mgr_boot(const struct device *dev)
static int remoteproc_mgr_boot(void)
{
ARG_UNUSED(dev);
/* Secure domain may configure permissions for the Network MCU. */
remoteproc_mgr_config();

View file

@ -159,7 +159,7 @@ static int reset_pin_configure(void)
}
#endif /* USE_RESET_GPIO */
static int init(const struct device *dev)
static int init(void)
{
int rc;
@ -214,7 +214,7 @@ SYS_INIT(init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
#define EXT_MEM_CTRL DT_NODELABEL(external_flash_pins_routing)
#if DT_NODE_EXISTS(EXT_MEM_CTRL)
static int early_init(const struct device *dev)
static int early_init(void)
{
/* As soon as possible after the system starts up, enable the analog
* switch that routes signals to the external flash. Otherwise, the

View file

@ -28,9 +28,8 @@ static inline void external_antenna(bool on)
gpio_pin_configure_dt(&pcb_gpio, (on ? GPIO_OUTPUT_INACTIVE : GPIO_OUTPUT_ACTIVE));
}
static int board_particle_argon_init(const struct device *dev)
static int board_particle_argon_init(void)
{
ARG_UNUSED(dev);
/*
* On power-up the SKY13351 is left uncontrolled, so neither

View file

@ -27,9 +27,8 @@ static inline void external_antenna(bool on)
gpio_pin_configure_dt(&ufl_gpio, (on ? GPIO_OUTPUT_ACTIVE : GPIO_OUTPUT_INACTIVE));
}
static int board_particle_boron_init(const struct device *dev)
static int board_particle_boron_init(void)
{
ARG_UNUSED(dev);
external_antenna(false);

View file

@ -28,9 +28,8 @@ static inline void external_antenna(bool on)
gpio_pin_configure_dt(&pcb_gpio, (on ? GPIO_OUTPUT_INACTIVE : GPIO_OUTPUT_ACTIVE));
}
static int board_particle_xenon_init(const struct device *dev)
static int board_particle_xenon_init(void)
{
ARG_UNUSED(dev);
/*
* On power-up the SKY13351 is left uncontrolled, so neither

View file

@ -15,9 +15,8 @@ LOG_MODULE_REGISTER(pine64_pinetime_key_out);
static const struct gpio_dt_spec key_out = GPIO_DT_SPEC_GET(KEY_OUT_NODE, gpios);
static int pinetime_key_out_init(const struct device *arg)
static int pinetime_key_out_init(void)
{
ARG_UNUSED(arg);
int ret;
if (!device_is_ready(key_out.port)) {

View file

@ -232,9 +232,8 @@ uint32_t sys_clock_cycle_get_32(void)
return ret;
}
static int sys_clock_driver_init(const struct device *dev)
static int sys_clock_driver_init(void)
{
ARG_UNUSED(dev);
/* FIXME switch to 1 MHz once this is fixed in QEMU */
nrf_timer_prescaler_set(TIMER, NRF_TIMER_FREQ_2MHz);

View file

@ -8,9 +8,8 @@
#include <soc.h>
#include "board.h"
static int qomu_board_init(const struct device *arg)
static int qomu_board_init(void)
{
ARG_UNUSED(arg);
/* IO MUX setup for UART */
eos_s3_io_mux(UART_TX_PAD, UART_TX_PAD_CFG);

View file

@ -8,9 +8,8 @@
#include <soc.h>
#include <board.h>
static int eos_s3_board_init(const struct device *arg)
static int eos_s3_board_init(void)
{
ARG_UNUSED(arg);
/* IO MUX setup for UART */
eos_s3_io_mux(UART_TX_PAD, UART_TX_PAD_CFG);

View file

@ -10,9 +10,8 @@
/* Peripheral voltage ON/OFF GPIO */
#define PERIPH_PON_PIN 0
static int board_reel_board_init(const struct device *dev)
static int board_reel_board_init(void)
{
ARG_UNUSED(dev);
volatile NRF_GPIO_Type *gpio = NRF_P1;
/*

View file

@ -10,9 +10,8 @@
#define GPIO0 DT_NODELABEL(gpio0)
#define POWER_LATCH_PIN 31
static int board_sparkfun_thing_plus_nrf9160_init(const struct device *dev)
static int board_sparkfun_thing_plus_nrf9160_init(void)
{
ARG_UNUSED(dev);
/* Get handle of the GPIO device. */
const struct device *const gpio = DEVICE_DT_GET(GPIO0);

View file

@ -8,7 +8,7 @@
#include <stm32_ll_adc.h>
#include <zephyr/devicetree.h>
static int enable_adc_reference(const struct device *dev)
static int enable_adc_reference(void)
{
uint8_t init_status;
/* VREF+ is not connected to VDDA by default */

View file

@ -7,12 +7,11 @@
#include <zephyr/drivers/gpio.h>
#include <zephyr/init.h>
static int board_swan_init(const struct device *dev)
static int board_swan_init(void)
{
const struct gpio_dt_spec dischrg =
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), dischrg_gpios);
ARG_UNUSED(dev);
if (!device_is_ready(dischrg.port)) {
return -ENODEV;

View file

@ -11,7 +11,7 @@
static const struct gpio_dt_spec ccs_gpio =
GPIO_DT_SPEC_GET(DT_NODELABEL(ccs_pwr), enable_gpios);
static int pwr_ctrl_init(const struct device *dev)
static int pwr_ctrl_init(void)
{
int ret;

View file

@ -57,9 +57,8 @@ static void enable_cpunet(void)
#endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */
}
static int setup(const struct device *dev)
static int setup(void)
{
ARG_UNUSED(dev);
#if !defined(CONFIG_TRUSTED_EXECUTION_SECURE)
if (IS_ENABLED(CONFIG_SENSOR)) {

View file

@ -8,9 +8,8 @@
#include <zephyr/init.h>
#include <zephyr/drivers/pinctrl.h>
static int twr_ke18f_pinmux_init(const struct device *dev)
static int twr_ke18f_pinmux_init(void)
{
ARG_UNUSED(dev);
int err; /* Used by pinctrl functions */

View file

@ -11,9 +11,8 @@
#define MODE_PIN 4 /* P1.04 */
#define A_SEL_PIN 2 /* P1.02 */
static int bmd345_fem_init(const struct device *dev)
static int bmd345_fem_init(void)
{
ARG_UNUSED(dev);
int ret;
const struct device *mode_asel_port_dev;

View file

@ -132,9 +132,8 @@ static void arm_v2m_beetle_pinmux_defaults(void)
CMSDK_AHB_GPIO1_DEV->data |= (0x1 << 15);
}
static int arm_v2m_beetle_pinmux_init(const struct device *port)
static int arm_v2m_beetle_pinmux_init(void)
{
ARG_UNUSED(port);
arm_v2m_beetle_pinmux_defaults();

View file

@ -55,9 +55,8 @@ static void arm_musca_b1_pinmux_defaults(void)
}
#endif
static int arm_musca_pinmux_init(const struct device *port)
static int arm_musca_pinmux_init(void)
{
ARG_UNUSED(port);
arm_musca_b1_pinmux_defaults();

View file

@ -54,9 +54,8 @@ static void arm_musca_s1_pinmux_defaults(void)
}
#endif
static int arm_musca_pinmux_init(const struct device *port)
static int arm_musca_pinmux_init(void)
{
ARG_UNUSED(port);
arm_musca_s1_pinmux_defaults();

View file

@ -65,9 +65,8 @@ static int actinius_board_set_charger_enable(void)
}
#endif /* CHARGER_ENABLE */
static int actinius_board_init(const struct device *dev)
static int actinius_board_init(void)
{
ARG_UNUSED(dev);
int result = 0;

View file

@ -191,18 +191,16 @@ bool bst_irq_sniffer(int irq_number)
}
}
static int bst_fake_device_driver_pre2_init(const struct device *arg)
static int bst_fake_device_driver_pre2_init(void)
{
ARG_UNUSED(arg);
if (current_test && current_test->test_fake_ddriver_prekernel_f) {
current_test->test_fake_ddriver_prekernel_f();
}
return 0;
}
static int bst_fake_device_driver_post_init(const struct device *arg)
static int bst_fake_device_driver_post_init(void)
{
ARG_UNUSED(arg);
if (current_test && current_test->test_fake_ddriver_postkernel_f) {
current_test->test_fake_ddriver_postkernel_f();
}

View file

@ -59,9 +59,8 @@ void posix_flush_stdout(void)
*
* @return 0 if successful, otherwise failed.
*/
static int printk_init(const struct device *arg)
static int printk_init(void)
{
ARG_UNUSED(arg);
extern void __printk_hook_install(int (*fn)(int));
__printk_hook_install(print_char);

View file

@ -8,13 +8,12 @@
#include <zephyr/init.h>
#include <zephyr/drivers/gpio.h>
static int rv32m1_vega_board_init(const struct device *dev)
static int rv32m1_vega_board_init(void)
{
const struct device *const gpiob = DEVICE_DT_GET(DT_NODELABEL(gpiob));
const struct device *const gpioc = DEVICE_DT_GET(DT_NODELABEL(gpioc));
const struct device *const gpiod = DEVICE_DT_GET(DT_NODELABEL(gpiod));
ARG_UNUSED(dev);
__ASSERT_NO_MSG(device_is_ready(gpiob));
__ASSERT_NO_MSG(device_is_ready(gpioc));

View file

@ -8,9 +8,8 @@
#define IP101GRI_RESET_N_PIN 5
static int board_esp32_ethernet_kit_init(const struct device *dev)
static int board_esp32_ethernet_kit_init(void)
{
ARG_UNUSED(dev);
const struct device *gpio = DEVICE_DT_GET(DT_NODELABEL(gpio0));
if (!device_is_ready(gpio)) {

View file

@ -11,9 +11,8 @@
#define LED_B_PIN DT_GPIO_PIN(DT_ALIAS(led0), gpios)
#define BL_PIN 5
static int board_esp_wrover_kit_init(const struct device *dev)
static int board_esp_wrover_kit_init(void)
{
ARG_UNUSED(dev);
const struct device *gpio;
gpio = DEVICE_DT_GET(DT_NODELABEL(gpio0));

View file

@ -9,9 +9,8 @@
#define VEXT_PIN DT_GPIO_PIN(DT_NODELABEL(vext), gpios)
#define OLED_RST DT_GPIO_PIN(DT_NODELABEL(oledrst), gpios)
static int board_heltec_wifi_lora32_v2_init(const struct device *dev)
static int board_heltec_wifi_lora32_v2_init(void)
{
ARG_UNUSED(dev);
const struct device *gpio;
gpio = DEVICE_DT_GET(DT_NODELABEL(gpio0));

View file

@ -8,9 +8,8 @@
#define LED_B_PIN DT_GPIO_PIN(DT_ALIAS(led0), gpios)
static int board_odroid_go_init(const struct device *dev)
static int board_odroid_go_init(void)
{
ARG_UNUSED(dev);
const struct device *gpio;
gpio = DEVICE_DT_GET(DT_NODELABEL(gpio0));

View file

@ -740,9 +740,8 @@ struct k_work_q adc_npcx_work_q;
static K_KERNEL_STACK_DEFINE(adc_npcx_work_q_stack,
CONFIG_ADC_CMP_NPCX_WORKQUEUE_STACK_SIZE);
static int adc_npcx_init_cmp_work_q(const struct device *dev)
static int adc_npcx_init_cmp_work_q(void)
{
ARG_UNUSED(dev);
struct k_work_queue_config cfg = {
.name = "adc_cmp_work",
.no_yield = false,

View file

@ -553,9 +553,8 @@ static const struct bt_hci_driver drv = {
#endif
};
static int bt_uart_init(const struct device *unused)
static int bt_uart_init(void)
{
ARG_UNUSED(unused);
if (!device_is_ready(h4_dev)) {
return -ENODEV;

View file

@ -767,9 +767,8 @@ static const struct bt_hci_driver drv = {
.send = h5_queue,
};
static int bt_uart_init(const struct device *unused)
static int bt_uart_init(void)
{
ARG_UNUSED(unused);
if (!device_is_ready(h5_dev)) {
return -ENODEV;

View file

@ -241,9 +241,8 @@ static const struct bt_hci_driver drv = {
#endif
};
static int bt_b91_init(const struct device *unused)
static int bt_b91_init(void)
{
ARG_UNUSED(unused);
bt_hci_driver_register(&drv);

View file

@ -327,9 +327,8 @@ static const struct bt_hci_driver drv = {
#endif
};
static int bt_esp32_init(const struct device *unused)
static int bt_esp32_init(void)
{
ARG_UNUSED(unused);
bt_hci_driver_register(&drv);

View file

@ -607,11 +607,10 @@ static const struct bt_hci_driver drv = {
.send = bt_ipm_send,
};
static int _bt_ipm_init(const struct device *unused)
static int _bt_ipm_init(void)
{
int err;
ARG_UNUSED(unused);
bt_hci_driver_register(&drv);

View file

@ -327,9 +327,8 @@ static const struct bt_hci_driver drv = {
#endif
};
static int bt_rpmsg_init(const struct device *unused)
static int bt_rpmsg_init(void)
{
ARG_UNUSED(unused);
int err;

View file

@ -517,9 +517,8 @@ static const struct bt_hci_driver drv = {
.send = bt_spi_send,
};
static int bt_spi_init(const struct device *unused)
static int bt_spi_init(void)
{
ARG_UNUSED(unused);
if (!spi_is_ready_dt(&bus)) {
LOG_ERR("SPI device not ready");

View file

@ -245,9 +245,8 @@ static const struct bt_hci_driver drv = {
.send = uc_send,
};
static int bt_uc_init(const struct device *unused)
static int bt_uc_init(void)
{
ARG_UNUSED(unused);
bt_hci_driver_register(&drv);

View file

@ -66,10 +66,9 @@ static void efi_console_hook_install(void)
*
* @return 0 if successful, otherwise failed.
*/
static int efi_console_init(const struct device *arg)
static int efi_console_init(void)
{
ARG_UNUSED(arg);
efi_console_hook_install();

View file

@ -64,9 +64,8 @@ static void ipm_console_hook_install(void)
__printk_hook_install(console_out);
}
static int ipm_console_init(const struct device *dev)
static int ipm_console_init(void)
{
ARG_UNUSED(dev);
LOG_DBG("IPM console initialization");

View file

@ -45,9 +45,8 @@ extern void __printk_hook_install(int (*fn)(int));
* @brief Initialize the console/debug port
* @return 0 if successful, otherwise failed.
*/
static int jailhouse_console_init(const struct device *arg)
static int jailhouse_console_init(void)
{
ARG_UNUSED(arg);
__stdout_hook_install(console_out);
__printk_hook_install(console_out);
return 0;

View file

@ -256,9 +256,8 @@ static void native_stdio_runner(void *p1, void *p2, void *p3)
}
#endif /* CONFIG_NATIVE_POSIX_STDIN_CONSOLE */
static int native_posix_console_init(const struct device *arg)
static int native_posix_console_init(void)
{
ARG_UNUSED(arg);
#if defined(CONFIG_NATIVE_POSIX_STDOUT_CONSOLE)
native_posix_stdout_init();

View file

@ -26,9 +26,8 @@ static int ram_console_out(int character)
return character;
}
static int ram_console_init(const struct device *d)
static int ram_console_init(void)
{
ARG_UNUSED(d);
__printk_hook_install(ram_console_out);
__stdout_hook_install(ram_console_out);

View file

@ -78,9 +78,8 @@ static int rtt_console_out(int character)
return character;
}
static int rtt_console_init(const struct device *d)
static int rtt_console_init(void)
{
ARG_UNUSED(d);
#ifdef CONFIG_PRINTK
__printk_hook_install(rtt_console_out);

View file

@ -16,9 +16,8 @@ int arch_printk_char_out(int _c)
return 0;
}
static int semihost_console_init(const struct device *dev)
static int semihost_console_init(void)
{
ARG_UNUSED(dev);
/*
* The printk output callback is arch_printk_char_out by default and

View file

@ -607,11 +607,8 @@ static void uart_console_hook_install(void)
*
* @return 0 if successful, otherwise failed.
*/
static int uart_console_init(const struct device *arg)
static int uart_console_init(void)
{
ARG_UNUSED(arg);
if (!device_is_ready(uart_console_dev)) {
return -ENODEV;
}

View file

@ -894,9 +894,8 @@ LISTIFY(CONFIG_UART_MUX_DEVICE_COUNT, DEFINE_UART_MUX_CFG_DATA, (;), _);
LISTIFY(CONFIG_UART_MUX_DEVICE_COUNT, DEFINE_UART_MUX_DEV_DATA, (;), _);
LISTIFY(CONFIG_UART_MUX_DEVICE_COUNT, DEFINE_UART_MUX_DEVICE, (;), _);
static int init_uart_mux(const struct device *dev)
static int init_uart_mux(void)
{
ARG_UNUSED(dev);
k_work_queue_start(&uart_mux_workq, uart_mux_stack,
K_KERNEL_STACK_SIZEOF(uart_mux_stack),

View file

@ -46,9 +46,8 @@ int arch_printk_char_out(int c)
return 0;
}
static int winstream_console_init(const struct device *d)
static int winstream_console_init(void)
{
ARG_UNUSED(d);
const struct device *dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
if (!device_is_ready(dev)) {

View file

@ -62,9 +62,8 @@ static void xt_sim_console_hook_install(void)
* @brief Initialize the console/debug port
* @return 0 if successful, otherwise failed.
*/
static int xt_sim_console_init(const struct device *arg)
static int xt_sim_console_init(void)
{
ARG_UNUSED(arg);
xt_sim_console_hook_install();
return 0;
}

View file

@ -462,9 +462,8 @@ DT_INST_FOREACH_STATUS_OKAY(VERIFY_CACHE_SIZE_IS_NOT_ZERO_IF_NOT_READ_ONLY)
" has cache size which is not a multiple of its sector size");
DT_INST_FOREACH_STATUS_OKAY(VERIFY_CACHE_SIZE_IS_MULTIPLY_OF_SECTOR_SIZE)
static int disk_flash_init(const struct device *dev)
static int disk_flash_init(void)
{
ARG_UNUSED(dev);
int err = 0;
for (int i = 0; i < ARRAY_SIZE(flash_disks); i++) {

View file

@ -102,9 +102,8 @@ static struct disk_info ram_disk = {
.ops = &ram_disk_ops,
};
static int disk_ram_init(const struct device *dev)
static int disk_ram_init(void)
{
ARG_UNUSED(dev);
return disk_access_register(&ram_disk);
}

View file

@ -396,9 +396,8 @@ struct mb_display *mb_display_get(void)
return &display;
}
static int mb_display_init_on_boot(const struct device *dev)
static int mb_display_init_on_boot(void)
{
ARG_UNUSED(dev);
display.lm_dev = DEVICE_DT_GET_ONE(nordic_nrf_led_matrix);
if (!device_is_ready(display.lm_dev)) {

View file

@ -90,7 +90,7 @@ static const struct gpio_hogs gpio_hogs[] = {
DT_FOREACH_STATUS_OKAY_NODE(GPIO_HOGS_COND_INIT)
};
static int gpio_hogs_init(const struct device *dev)
static int gpio_hogs_init(void)
{
const struct gpio_hogs *hogs;
const struct gpio_hog_dt_spec *spec;
@ -98,7 +98,6 @@ static int gpio_hogs_init(const struct device *dev)
int i;
int j;
ARG_UNUSED(dev);
for (i = 0; i < ARRAY_SIZE(gpio_hogs); i++) {
hogs = &gpio_hogs[i];

View file

@ -722,9 +722,8 @@ DEVICE_DT_INST_DEFINE(inst, \
DT_INST_FOREACH_STATUS_OKAY(GPIO_ITE_DEV_CFG_DATA)
static int gpio_it8xxx2_init_set(const struct device *arg)
static int gpio_it8xxx2_init_set(void)
{
ARG_UNUSED(arg);
if (IS_ENABLED(CONFIG_SOC_IT8XXX2_GPIO_GROUP_K_L_DEFAULT_PULL_DOWN)) {
const struct device *const gpiok = DEVICE_DT_GET(DT_NODELABEL(gpiok));

View file

@ -62,7 +62,7 @@ __ramfunc static void hwinfo_sam_read_device_id(void)
}
}
static int hwinfo_sam_init(const struct device *arg)
static int hwinfo_sam_init(void)
{
Efc *efc = (Efc *)DT_REG_ADDR(DT_INST(0, atmel_sam_flash_controller));
uint32_t fmr;

View file

@ -53,13 +53,12 @@ int z_impl_hwinfo_get_supported_reset_cause(uint32_t *supported)
return 0;
}
static int hwinfo_rstc_init(const struct device *dev)
static int hwinfo_rstc_init(void)
{
Rstc *regs = (Rstc *)DT_INST_REG_ADDR(0);
const struct atmel_sam_pmc_config clock_cfg = SAM_DT_INST_CLOCK_PMC_CFG(0);
uint32_t mode;
ARG_UNUSED(dev);
/* Enable RSTC in PMC */
(void)clock_control_on(SAM_DT_PMC_CONTROLLER,

View file

@ -207,9 +207,8 @@ static void i3c_ibi_work_handler(struct k_work *work)
}
}
static int i3c_ibi_work_q_init(const struct device *dev)
static int i3c_ibi_work_q_init(void)
{
ARG_UNUSED(dev);
struct k_work_queue_config cfg = {
.name = "i3c_ibi_workq",
.no_yield = true,

View file

@ -58,7 +58,7 @@ static void arc_shared_intc_init(void)
}
/* Allow to schedule IRQ to all cores after we bring up all secondary cores */
static int arc_shared_intc_update_post_smp(const struct device *unused)
static int arc_shared_intc_update_post_smp(void)
{
__ASSERT(z_arc_v2_core_id() == ARC_MP_PRIMARY_CPU_ID,
"idu interrupts must be updated from primary core");
@ -134,7 +134,7 @@ void arc_core_private_intc_init(void)
#endif /* CONFIG_ARC_CONNECT */
}
static int arc_irq_init(const struct device *unused)
static int arc_irq_init(void)
{
#ifdef CONFIG_ARC_CONNECT
arc_shared_intc_init();

View file

@ -228,9 +228,8 @@ static void gic_cpu_init(void)
/**
* @brief Initialize the GIC device driver
*/
int arm_gic_init(const struct device *unused)
int arm_gic_init(void)
{
ARG_UNUSED(unused);
/* Init of Distributor interface registers */
gic_dist_init();

Some files were not shown because too many files have changed in this diff Show more