mirror of
https://github.com/Dasharo/zephyr.git
synced 2026-03-06 14:57:20 -08:00
device: remove redundant init functions
Remove all init functions that do nothing, and provide a `NULL` to *DEVICE*DEFINE* macros. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
committed by
Carles Cufí
parent
1b73d1e0c6
commit
1eb683a514
@@ -45,14 +45,9 @@ static const struct adc_driver_api vnd_adc_api = {
|
||||
#endif
|
||||
};
|
||||
|
||||
static int vnd_adc_init(const struct device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define VND_ADC_INIT(n) \
|
||||
DEVICE_DT_INST_DEFINE(n, &vnd_adc_init, NULL, \
|
||||
NULL, NULL, POST_KERNEL, \
|
||||
DEVICE_DT_INST_DEFINE(n, NULL, NULL, NULL, NULL, \
|
||||
POST_KERNEL, \
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \
|
||||
&vnd_adc_api);
|
||||
|
||||
|
||||
@@ -128,11 +128,6 @@ static const struct bbram_driver_api bbram_emul_driver_api = {
|
||||
.write = bbram_emul_write,
|
||||
};
|
||||
|
||||
static int bbram_emul_init(const struct device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define BBRAM_INIT(inst) \
|
||||
static uint8_t bbram_emul_mem_##inst[DT_INST_PROP(inst, size)]; \
|
||||
static struct bbram_emul_data bbram_emul_data_##inst = { \
|
||||
@@ -141,7 +136,7 @@ static int bbram_emul_init(const struct device *dev)
|
||||
static struct bbram_emul_config bbram_emul_config_##inst = { \
|
||||
.size = DT_INST_PROP(inst, size), \
|
||||
}; \
|
||||
DEVICE_DT_INST_DEFINE(inst, &bbram_emul_init, NULL, &bbram_emul_data_##inst, \
|
||||
DEVICE_DT_INST_DEFINE(inst, NULL, NULL, &bbram_emul_data_##inst, \
|
||||
&bbram_emul_config_##inst, PRE_KERNEL_1, CONFIG_BBRAM_INIT_PRIORITY, \
|
||||
&bbram_emul_driver_api);
|
||||
|
||||
|
||||
@@ -99,13 +99,6 @@ static const struct bbram_driver_api bbram_npcx_driver_api = {
|
||||
.write = bbram_npcx_write,
|
||||
};
|
||||
|
||||
static int bbram_npcx_init(const struct device *dev)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define BBRAM_INIT(inst) \
|
||||
static struct { \
|
||||
} bbram_data_##inst; \
|
||||
@@ -114,7 +107,7 @@ static int bbram_npcx_init(const struct device *dev)
|
||||
.size = DT_INST_REG_SIZE_BY_NAME(inst, memory), \
|
||||
.status_reg_addr = DT_INST_REG_ADDR_BY_NAME(inst, status), \
|
||||
}; \
|
||||
DEVICE_DT_INST_DEFINE(inst, bbram_npcx_init, NULL, &bbram_data_##inst, &bbram_cfg_##inst, \
|
||||
DEVICE_DT_INST_DEFINE(inst, NULL, NULL, &bbram_data_##inst, &bbram_cfg_##inst, \
|
||||
PRE_KERNEL_1, CONFIG_BBRAM_INIT_PRIORITY, &bbram_npcx_driver_api);
|
||||
|
||||
DT_INST_FOREACH_STATUS_OKAY(BBRAM_INIT);
|
||||
|
||||
@@ -79,20 +79,12 @@ static const struct bbram_driver_api bbram_xec_driver_api = {
|
||||
.write = bbram_xec_write,
|
||||
};
|
||||
|
||||
static int bbram_xec_init(const struct device *dev)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define BBRAM_INIT(inst) \
|
||||
static const struct bbram_xec_config bbram_cfg_##inst = { \
|
||||
.base = (uint8_t *)(DT_INST_REG_ADDR(inst)), \
|
||||
.size = DT_INST_REG_SIZE(inst), \
|
||||
}; \
|
||||
DEVICE_DT_INST_DEFINE(inst, bbram_xec_init, NULL, NULL, \
|
||||
&bbram_cfg_##inst, \
|
||||
DEVICE_DT_INST_DEFINE(inst, NULL, NULL, NULL, &bbram_cfg_##inst,\
|
||||
PRE_KERNEL_1, CONFIG_BBRAM_INIT_PRIORITY, \
|
||||
&bbram_xec_driver_api);
|
||||
|
||||
|
||||
@@ -138,16 +138,9 @@ static const struct can_driver_api fake_can_driver_api = {
|
||||
#endif /* CONFIG_CAN_FD_MODE */
|
||||
};
|
||||
|
||||
static int fake_can_init(const struct device *dev)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define FAKE_CAN_INIT(inst) \
|
||||
DEVICE_DT_INST_DEFINE(inst, &fake_can_init, NULL, NULL, NULL, \
|
||||
POST_KERNEL, CONFIG_CAN_INIT_PRIORITY, \
|
||||
DEVICE_DT_INST_DEFINE(inst, NULL, NULL, NULL, NULL, POST_KERNEL,\
|
||||
CONFIG_CAN_INIT_PRIORITY, \
|
||||
&fake_can_driver_api);
|
||||
|
||||
DT_INST_FOREACH_STATUS_OKAY(FAKE_CAN_INIT)
|
||||
|
||||
@@ -8,16 +8,6 @@
|
||||
#include <zephyr/drivers/clock_control.h>
|
||||
#include <zephyr/drivers/clock_control/clock_agilex_ll.h>
|
||||
#include <zephyr/dt-bindings/clock/intel_socfpga_clock.h>
|
||||
#include <zephyr/logging/log.h>
|
||||
|
||||
LOG_MODULE_REGISTER(clock_control, CONFIG_CLOCK_CONTROL_LOG_LEVEL);
|
||||
|
||||
static int clk_init(const struct device *dev)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
LOG_INF("Intel Clock driver initialized");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int clk_get_rate(const struct device *dev,
|
||||
clock_control_subsys_t sub_system,
|
||||
@@ -49,6 +39,6 @@ static const struct clock_control_driver_api clk_api = {
|
||||
.get_rate = clk_get_rate
|
||||
};
|
||||
|
||||
DEVICE_DT_DEFINE(DT_NODELABEL(clock), clk_init, NULL, NULL, NULL,
|
||||
DEVICE_DT_DEFINE(DT_NODELABEL(clock), NULL, NULL, NULL, NULL,
|
||||
PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY,
|
||||
&clk_api);
|
||||
|
||||
@@ -146,12 +146,6 @@ static int aspeed_clock_control_get_rate(const struct device *dev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int aspeed_clock_control_init(const struct device *dev)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct clock_control_driver_api aspeed_clk_api = {
|
||||
.on = aspeed_clock_control_on,
|
||||
.off = aspeed_clock_control_off,
|
||||
@@ -162,7 +156,7 @@ static const struct clock_control_driver_api aspeed_clk_api = {
|
||||
static const struct clock_aspeed_config clock_aspeed_cfg_##n = { \
|
||||
.syscon = DEVICE_DT_GET(DT_NODELABEL(syscon)), \
|
||||
}; \
|
||||
DEVICE_DT_INST_DEFINE(n, &aspeed_clock_control_init, NULL, NULL, &clock_aspeed_cfg_##n, \
|
||||
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &aspeed_clk_api);
|
||||
DEVICE_DT_INST_DEFINE(n, NULL, NULL, NULL, &clock_aspeed_cfg_##n, PRE_KERNEL_1, \
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &aspeed_clk_api);
|
||||
|
||||
DT_INST_FOREACH_STATUS_OKAY(ASPEED_CLOCK_INIT)
|
||||
|
||||
@@ -203,17 +203,10 @@ static struct clock_control_driver_api clock_control_gd32_api = {
|
||||
.get_status = clock_control_gd32_get_status,
|
||||
};
|
||||
|
||||
static int clock_control_gd32_init(const struct device *dev)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct clock_control_gd32_config config = {
|
||||
.base = DT_REG_ADDR(DT_INST_PARENT(0)),
|
||||
};
|
||||
|
||||
DEVICE_DT_INST_DEFINE(0, clock_control_gd32_init, NULL, NULL, &config,
|
||||
PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY,
|
||||
DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, &config, PRE_KERNEL_1,
|
||||
CONFIG_CLOCK_CONTROL_INIT_PRIORITY,
|
||||
&clock_control_gd32_api);
|
||||
|
||||
@@ -263,20 +263,12 @@ static int mcux_ccm_get_subsys_rate(const struct device *dev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mcux_ccm_init(const struct device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct clock_control_driver_api mcux_ccm_driver_api = {
|
||||
.on = mcux_ccm_on,
|
||||
.off = mcux_ccm_off,
|
||||
.get_rate = mcux_ccm_get_subsys_rate,
|
||||
};
|
||||
|
||||
DEVICE_DT_INST_DEFINE(0,
|
||||
&mcux_ccm_init,
|
||||
NULL,
|
||||
NULL, NULL,
|
||||
PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY,
|
||||
&mcux_ccm_driver_api);
|
||||
DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, NULL,
|
||||
PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY,
|
||||
&mcux_ccm_driver_api);
|
||||
|
||||
@@ -111,20 +111,12 @@ static int mcux_ccm_get_subsys_rate(const struct device *dev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mcux_ccm_init(const struct device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct clock_control_driver_api mcux_ccm_driver_api = {
|
||||
.on = mcux_ccm_on,
|
||||
.off = mcux_ccm_off,
|
||||
.get_rate = mcux_ccm_get_subsys_rate,
|
||||
};
|
||||
|
||||
DEVICE_DT_INST_DEFINE(0,
|
||||
&mcux_ccm_init,
|
||||
NULL,
|
||||
NULL, NULL,
|
||||
PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY,
|
||||
&mcux_ccm_driver_api);
|
||||
DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, NULL, PRE_KERNEL_1,
|
||||
CONFIG_CLOCK_CONTROL_INIT_PRIORITY,
|
||||
&mcux_ccm_driver_api);
|
||||
|
||||
@@ -55,20 +55,12 @@ static int mcux_mcg_get_rate(const struct device *dev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mcux_mcg_init(const struct device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct clock_control_driver_api mcux_mcg_driver_api = {
|
||||
.on = mcux_mcg_on,
|
||||
.off = mcux_mcg_off,
|
||||
.get_rate = mcux_mcg_get_rate,
|
||||
};
|
||||
|
||||
DEVICE_DT_INST_DEFINE(0,
|
||||
&mcux_mcg_init,
|
||||
NULL,
|
||||
NULL, NULL,
|
||||
PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY,
|
||||
&mcux_mcg_driver_api);
|
||||
DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, NULL, PRE_KERNEL_1,
|
||||
CONFIG_CLOCK_CONTROL_INIT_PRIORITY,
|
||||
&mcux_mcg_driver_api);
|
||||
|
||||
@@ -57,11 +57,6 @@ static int mcux_pcc_get_rate(const struct device *dev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mcux_pcc_init(const struct device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct clock_control_driver_api mcux_pcc_api = {
|
||||
.on = mcux_pcc_on,
|
||||
.off = mcux_pcc_off,
|
||||
@@ -74,7 +69,7 @@ static const struct clock_control_driver_api mcux_pcc_api = {
|
||||
}; \
|
||||
\
|
||||
DEVICE_DT_INST_DEFINE(inst, \
|
||||
&mcux_pcc_init, \
|
||||
NULL, \
|
||||
NULL, \
|
||||
NULL, &mcux_pcc##inst##_config, \
|
||||
PRE_KERNEL_1, \
|
||||
|
||||
@@ -171,11 +171,6 @@ static int mcux_lpc_syscon_clock_control_get_subsys_rate(
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mcux_lpc_syscon_clock_control_init(const struct device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct clock_control_driver_api mcux_lpc_syscon_api = {
|
||||
.on = mcux_lpc_syscon_clock_control_on,
|
||||
.off = mcux_lpc_syscon_clock_control_off,
|
||||
@@ -185,7 +180,7 @@ static const struct clock_control_driver_api mcux_lpc_syscon_api = {
|
||||
#define LPC_CLOCK_INIT(n) \
|
||||
\
|
||||
DEVICE_DT_INST_DEFINE(n, \
|
||||
&mcux_lpc_syscon_clock_control_init, \
|
||||
NULL, \
|
||||
NULL, \
|
||||
NULL, NULL, \
|
||||
PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY, \
|
||||
|
||||
@@ -134,12 +134,6 @@ static int r8a7795_cpg_get_rate(const struct device *dev,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int r8a7795_cpg_mssr_init(const struct device *dev)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct clock_control_driver_api r8a7795_cpg_mssr_api = {
|
||||
.on = r8a7795_cpg_mssr_start,
|
||||
.off = r8a7795_cpg_mssr_stop,
|
||||
@@ -152,7 +146,7 @@ static const struct clock_control_driver_api r8a7795_cpg_mssr_api = {
|
||||
}; \
|
||||
\
|
||||
DEVICE_DT_INST_DEFINE(inst, \
|
||||
&r8a7795_cpg_mssr_init, \
|
||||
NULL, \
|
||||
NULL, \
|
||||
NULL, &r8a7795_cpg_mssr##inst##_config, \
|
||||
PRE_KERNEL_1, \
|
||||
|
||||
@@ -51,11 +51,6 @@ static int rv32m1_pcc_get_rate(const struct device *dev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rv32m1_pcc_init(const struct device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct clock_control_driver_api rv32m1_pcc_api = {
|
||||
.on = rv32m1_pcc_on,
|
||||
.off = rv32m1_pcc_off,
|
||||
@@ -68,7 +63,7 @@ static const struct clock_control_driver_api rv32m1_pcc_api = {
|
||||
}; \
|
||||
\
|
||||
DEVICE_DT_INST_DEFINE(inst, \
|
||||
&rv32m1_pcc_init, \
|
||||
NULL, \
|
||||
NULL, \
|
||||
NULL, &rv32m1_pcc##inst##_config, \
|
||||
PRE_KERNEL_1, \
|
||||
|
||||
@@ -135,16 +135,6 @@ static struct clock_control_driver_api atmel_sam_clock_control_api = {
|
||||
.get_status = atmel_sam_clock_control_get_status,
|
||||
};
|
||||
|
||||
static int atmel_sam_clock_control_init(const struct device *dev)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEVICE_DT_INST_DEFINE(0, atmel_sam_clock_control_init,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY,
|
||||
DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, NULL, PRE_KERNEL_1,
|
||||
CONFIG_CLOCK_CONTROL_INIT_PRIORITY,
|
||||
&atmel_sam_clock_control_api);
|
||||
|
||||
@@ -102,17 +102,10 @@ int counter_ace_v1x_art_get_value(const struct device *dev, uint64_t *value)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int counter_ace_v1x_art_init(const struct device *dev)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct counter_driver_api ace_v1x_art_counter_apis = {
|
||||
.get_value_64 = counter_ace_v1x_art_get_value
|
||||
};
|
||||
|
||||
DEVICE_DT_DEFINE(DT_NODELABEL(ace_art_counter), counter_ace_v1x_art_init, NULL, NULL, NULL,
|
||||
DEVICE_DT_DEFINE(DT_NODELABEL(ace_art_counter), NULL, NULL, NULL, NULL,
|
||||
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&ace_v1x_art_counter_apis);
|
||||
|
||||
@@ -194,13 +194,6 @@ int get_value(const struct device *dev, uint32_t *ticks)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int init(const struct device *dev)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct counter_config_info info = {
|
||||
.max_top_value = UINT_MAX,
|
||||
.freq = 1
|
||||
@@ -210,5 +203,5 @@ static const struct counter_driver_api api = {
|
||||
.get_value = get_value
|
||||
};
|
||||
|
||||
DEVICE_DT_INST_DEFINE(0, &init, NULL, NULL, &info,
|
||||
POST_KERNEL, CONFIG_COUNTER_INIT_PRIORITY, &api);
|
||||
DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, &info, POST_KERNEL,
|
||||
CONFIG_COUNTER_INIT_PRIORITY, &api);
|
||||
|
||||
@@ -320,11 +320,6 @@ static int intel_sha_device_free(const struct device *dev, struct hash_ctx *ctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int intel_sha_device_init(const struct device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int intel_sha_device_hw_caps(const struct device *dev)
|
||||
{
|
||||
return (CAP_SEPARATE_IO_BUFS | CAP_SYNC_OPS);
|
||||
@@ -341,7 +336,7 @@ static struct crypto_driver_api hash_enc_funcs = {
|
||||
static struct sha_container sha_data_##inst = { \
|
||||
.dfsha = (volatile struct sha_hw_regs *)DT_INST_REG_ADDR_BY_IDX(inst, 0) \
|
||||
}; \
|
||||
DEVICE_DT_INST_DEFINE(inst, intel_sha_device_init, NULL, &sha_data_##inst, NULL, \
|
||||
DEVICE_DT_INST_DEFINE(inst, NULL, NULL, &sha_data_##inst, NULL, \
|
||||
POST_KERNEL, CONFIG_CRYPTO_INIT_PRIORITY, (void *)&hash_enc_funcs);
|
||||
|
||||
DT_INST_FOREACH_STATUS_OKAY(INTEL_SHA_DEVICE_INIT)
|
||||
|
||||
@@ -599,11 +599,6 @@ static int mtls_query_caps(const struct device *dev)
|
||||
return MTLS_SUPPORT;
|
||||
}
|
||||
|
||||
static int mtls_shim_init(const struct device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct crypto_driver_api mtls_crypto_funcs = {
|
||||
.cipher_begin_session = mtls_session_setup,
|
||||
.cipher_free_session = mtls_session_free,
|
||||
@@ -614,6 +609,5 @@ static struct crypto_driver_api mtls_crypto_funcs = {
|
||||
};
|
||||
|
||||
DEVICE_DEFINE(crypto_mtls, CONFIG_CRYPTO_MBEDTLS_SHIM_DRV_NAME,
|
||||
&mtls_shim_init, NULL, NULL, NULL,
|
||||
POST_KERNEL, CONFIG_CRYPTO_INIT_PRIORITY,
|
||||
(void *)&mtls_crypto_funcs);
|
||||
NULL, NULL, NULL, NULL, POST_KERNEL, CONFIG_CRYPTO_INIT_PRIORITY,
|
||||
(void *)&mtls_crypto_funcs);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user