Skip to content

Commit 1eb683a

Browse files
gmarullcarlescufi
authored andcommitted
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 <[email protected]>
1 parent 1b73d1e commit 1eb683a

File tree

87 files changed

+149
-735
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+149
-735
lines changed

drivers/adc/adc_test.c

+2-7
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,9 @@ static const struct adc_driver_api vnd_adc_api = {
4545
#endif
4646
};
4747

48-
static int vnd_adc_init(const struct device *dev)
49-
{
50-
return 0;
51-
}
52-
5348
#define VND_ADC_INIT(n) \
54-
DEVICE_DT_INST_DEFINE(n, &vnd_adc_init, NULL, \
55-
NULL, NULL, POST_KERNEL, \
49+
DEVICE_DT_INST_DEFINE(n, NULL, NULL, NULL, NULL, \
50+
POST_KERNEL, \
5651
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \
5752
&vnd_adc_api);
5853

drivers/bbram/bbram_emul.c

+1-6
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,6 @@ static const struct bbram_driver_api bbram_emul_driver_api = {
128128
.write = bbram_emul_write,
129129
};
130130

131-
static int bbram_emul_init(const struct device *dev)
132-
{
133-
return 0;
134-
}
135-
136131
#define BBRAM_INIT(inst) \
137132
static uint8_t bbram_emul_mem_##inst[DT_INST_PROP(inst, size)]; \
138133
static struct bbram_emul_data bbram_emul_data_##inst = { \
@@ -141,7 +136,7 @@ static int bbram_emul_init(const struct device *dev)
141136
static struct bbram_emul_config bbram_emul_config_##inst = { \
142137
.size = DT_INST_PROP(inst, size), \
143138
}; \
144-
DEVICE_DT_INST_DEFINE(inst, &bbram_emul_init, NULL, &bbram_emul_data_##inst, \
139+
DEVICE_DT_INST_DEFINE(inst, NULL, NULL, &bbram_emul_data_##inst, \
145140
&bbram_emul_config_##inst, PRE_KERNEL_1, CONFIG_BBRAM_INIT_PRIORITY, \
146141
&bbram_emul_driver_api);
147142

drivers/bbram/bbram_npcx.c

+1-8
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,6 @@ static const struct bbram_driver_api bbram_npcx_driver_api = {
9999
.write = bbram_npcx_write,
100100
};
101101

102-
static int bbram_npcx_init(const struct device *dev)
103-
{
104-
ARG_UNUSED(dev);
105-
106-
return 0;
107-
}
108-
109102
#define BBRAM_INIT(inst) \
110103
static struct { \
111104
} bbram_data_##inst; \
@@ -114,7 +107,7 @@ static int bbram_npcx_init(const struct device *dev)
114107
.size = DT_INST_REG_SIZE_BY_NAME(inst, memory), \
115108
.status_reg_addr = DT_INST_REG_ADDR_BY_NAME(inst, status), \
116109
}; \
117-
DEVICE_DT_INST_DEFINE(inst, bbram_npcx_init, NULL, &bbram_data_##inst, &bbram_cfg_##inst, \
110+
DEVICE_DT_INST_DEFINE(inst, NULL, NULL, &bbram_data_##inst, &bbram_cfg_##inst, \
118111
PRE_KERNEL_1, CONFIG_BBRAM_INIT_PRIORITY, &bbram_npcx_driver_api);
119112

120113
DT_INST_FOREACH_STATUS_OKAY(BBRAM_INIT);

drivers/bbram/bbram_xec.c

+1-9
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,12 @@ static const struct bbram_driver_api bbram_xec_driver_api = {
7979
.write = bbram_xec_write,
8080
};
8181

82-
static int bbram_xec_init(const struct device *dev)
83-
{
84-
ARG_UNUSED(dev);
85-
86-
return 0;
87-
}
88-
8982
#define BBRAM_INIT(inst) \
9083
static const struct bbram_xec_config bbram_cfg_##inst = { \
9184
.base = (uint8_t *)(DT_INST_REG_ADDR(inst)), \
9285
.size = DT_INST_REG_SIZE(inst), \
9386
}; \
94-
DEVICE_DT_INST_DEFINE(inst, bbram_xec_init, NULL, NULL, \
95-
&bbram_cfg_##inst, \
87+
DEVICE_DT_INST_DEFINE(inst, NULL, NULL, NULL, &bbram_cfg_##inst,\
9688
PRE_KERNEL_1, CONFIG_BBRAM_INIT_PRIORITY, \
9789
&bbram_xec_driver_api);
9890

drivers/can/can_fake.c

+2-9
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,9 @@ static const struct can_driver_api fake_can_driver_api = {
138138
#endif /* CONFIG_CAN_FD_MODE */
139139
};
140140

141-
static int fake_can_init(const struct device *dev)
142-
{
143-
ARG_UNUSED(dev);
144-
145-
return 0;
146-
}
147-
148141
#define FAKE_CAN_INIT(inst) \
149-
DEVICE_DT_INST_DEFINE(inst, &fake_can_init, NULL, NULL, NULL, \
150-
POST_KERNEL, CONFIG_CAN_INIT_PRIORITY, \
142+
DEVICE_DT_INST_DEFINE(inst, NULL, NULL, NULL, NULL, POST_KERNEL,\
143+
CONFIG_CAN_INIT_PRIORITY, \
151144
&fake_can_driver_api);
152145

153146
DT_INST_FOREACH_STATUS_OKAY(FAKE_CAN_INIT)

drivers/clock_control/clock_agilex.c

+1-11
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,6 @@
88
#include <zephyr/drivers/clock_control.h>
99
#include <zephyr/drivers/clock_control/clock_agilex_ll.h>
1010
#include <zephyr/dt-bindings/clock/intel_socfpga_clock.h>
11-
#include <zephyr/logging/log.h>
12-
13-
LOG_MODULE_REGISTER(clock_control, CONFIG_CLOCK_CONTROL_LOG_LEVEL);
14-
15-
static int clk_init(const struct device *dev)
16-
{
17-
ARG_UNUSED(dev);
18-
LOG_INF("Intel Clock driver initialized");
19-
return 0;
20-
}
2111

2212
static int clk_get_rate(const struct device *dev,
2313
clock_control_subsys_t sub_system,
@@ -49,6 +39,6 @@ static const struct clock_control_driver_api clk_api = {
4939
.get_rate = clk_get_rate
5040
};
5141

52-
DEVICE_DT_DEFINE(DT_NODELABEL(clock), clk_init, NULL, NULL, NULL,
42+
DEVICE_DT_DEFINE(DT_NODELABEL(clock), NULL, NULL, NULL, NULL,
5343
PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY,
5444
&clk_api);

drivers/clock_control/clock_control_ast10x0.c

+2-8
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,6 @@ static int aspeed_clock_control_get_rate(const struct device *dev,
146146
return 0;
147147
}
148148

149-
static int aspeed_clock_control_init(const struct device *dev)
150-
{
151-
ARG_UNUSED(dev);
152-
return 0;
153-
}
154-
155149
static const struct clock_control_driver_api aspeed_clk_api = {
156150
.on = aspeed_clock_control_on,
157151
.off = aspeed_clock_control_off,
@@ -162,7 +156,7 @@ static const struct clock_control_driver_api aspeed_clk_api = {
162156
static const struct clock_aspeed_config clock_aspeed_cfg_##n = { \
163157
.syscon = DEVICE_DT_GET(DT_NODELABEL(syscon)), \
164158
}; \
165-
DEVICE_DT_INST_DEFINE(n, &aspeed_clock_control_init, NULL, NULL, &clock_aspeed_cfg_##n, \
166-
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &aspeed_clk_api);
159+
DEVICE_DT_INST_DEFINE(n, NULL, NULL, NULL, &clock_aspeed_cfg_##n, PRE_KERNEL_1, \
160+
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &aspeed_clk_api);
167161

168162
DT_INST_FOREACH_STATUS_OKAY(ASPEED_CLOCK_INIT)

drivers/clock_control/clock_control_gd32.c

+2-9
Original file line numberDiff line numberDiff line change
@@ -203,17 +203,10 @@ static struct clock_control_driver_api clock_control_gd32_api = {
203203
.get_status = clock_control_gd32_get_status,
204204
};
205205

206-
static int clock_control_gd32_init(const struct device *dev)
207-
{
208-
ARG_UNUSED(dev);
209-
210-
return 0;
211-
}
212-
213206
static const struct clock_control_gd32_config config = {
214207
.base = DT_REG_ADDR(DT_INST_PARENT(0)),
215208
};
216209

217-
DEVICE_DT_INST_DEFINE(0, clock_control_gd32_init, NULL, NULL, &config,
218-
PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY,
210+
DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, &config, PRE_KERNEL_1,
211+
CONFIG_CLOCK_CONTROL_INIT_PRIORITY,
219212
&clock_control_gd32_api);

drivers/clock_control/clock_control_mcux_ccm.c

+3-11
Original file line numberDiff line numberDiff line change
@@ -263,20 +263,12 @@ static int mcux_ccm_get_subsys_rate(const struct device *dev,
263263
return 0;
264264
}
265265

266-
static int mcux_ccm_init(const struct device *dev)
267-
{
268-
return 0;
269-
}
270-
271266
static const struct clock_control_driver_api mcux_ccm_driver_api = {
272267
.on = mcux_ccm_on,
273268
.off = mcux_ccm_off,
274269
.get_rate = mcux_ccm_get_subsys_rate,
275270
};
276271

277-
DEVICE_DT_INST_DEFINE(0,
278-
&mcux_ccm_init,
279-
NULL,
280-
NULL, NULL,
281-
PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY,
282-
&mcux_ccm_driver_api);
272+
DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, NULL,
273+
PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY,
274+
&mcux_ccm_driver_api);

drivers/clock_control/clock_control_mcux_ccm_rev2.c

+3-11
Original file line numberDiff line numberDiff line change
@@ -111,20 +111,12 @@ static int mcux_ccm_get_subsys_rate(const struct device *dev,
111111
return 0;
112112
}
113113

114-
static int mcux_ccm_init(const struct device *dev)
115-
{
116-
return 0;
117-
}
118-
119114
static const struct clock_control_driver_api mcux_ccm_driver_api = {
120115
.on = mcux_ccm_on,
121116
.off = mcux_ccm_off,
122117
.get_rate = mcux_ccm_get_subsys_rate,
123118
};
124119

125-
DEVICE_DT_INST_DEFINE(0,
126-
&mcux_ccm_init,
127-
NULL,
128-
NULL, NULL,
129-
PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY,
130-
&mcux_ccm_driver_api);
120+
DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, NULL, PRE_KERNEL_1,
121+
CONFIG_CLOCK_CONTROL_INIT_PRIORITY,
122+
&mcux_ccm_driver_api);

drivers/clock_control/clock_control_mcux_mcg.c

+3-11
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,12 @@ static int mcux_mcg_get_rate(const struct device *dev,
5555
return 0;
5656
}
5757

58-
static int mcux_mcg_init(const struct device *dev)
59-
{
60-
return 0;
61-
}
62-
6358
static const struct clock_control_driver_api mcux_mcg_driver_api = {
6459
.on = mcux_mcg_on,
6560
.off = mcux_mcg_off,
6661
.get_rate = mcux_mcg_get_rate,
6762
};
6863

69-
DEVICE_DT_INST_DEFINE(0,
70-
&mcux_mcg_init,
71-
NULL,
72-
NULL, NULL,
73-
PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY,
74-
&mcux_mcg_driver_api);
64+
DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, NULL, PRE_KERNEL_1,
65+
CONFIG_CLOCK_CONTROL_INIT_PRIORITY,
66+
&mcux_mcg_driver_api);

drivers/clock_control/clock_control_mcux_pcc.c

+1-6
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,6 @@ static int mcux_pcc_get_rate(const struct device *dev,
5757
return 0;
5858
}
5959

60-
static int mcux_pcc_init(const struct device *dev)
61-
{
62-
return 0;
63-
}
64-
6560
static const struct clock_control_driver_api mcux_pcc_api = {
6661
.on = mcux_pcc_on,
6762
.off = mcux_pcc_off,
@@ -74,7 +69,7 @@ static const struct clock_control_driver_api mcux_pcc_api = {
7469
}; \
7570
\
7671
DEVICE_DT_INST_DEFINE(inst, \
77-
&mcux_pcc_init, \
72+
NULL, \
7873
NULL, \
7974
NULL, &mcux_pcc##inst##_config, \
8075
PRE_KERNEL_1, \

drivers/clock_control/clock_control_mcux_syscon.c

+1-6
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,6 @@ static int mcux_lpc_syscon_clock_control_get_subsys_rate(
171171
return 0;
172172
}
173173

174-
static int mcux_lpc_syscon_clock_control_init(const struct device *dev)
175-
{
176-
return 0;
177-
}
178-
179174
static const struct clock_control_driver_api mcux_lpc_syscon_api = {
180175
.on = mcux_lpc_syscon_clock_control_on,
181176
.off = mcux_lpc_syscon_clock_control_off,
@@ -185,7 +180,7 @@ static const struct clock_control_driver_api mcux_lpc_syscon_api = {
185180
#define LPC_CLOCK_INIT(n) \
186181
\
187182
DEVICE_DT_INST_DEFINE(n, \
188-
&mcux_lpc_syscon_clock_control_init, \
183+
NULL, \
189184
NULL, \
190185
NULL, NULL, \
191186
PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY, \

drivers/clock_control/clock_control_r8a7795_cpg_mssr.c

+1-7
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,6 @@ static int r8a7795_cpg_get_rate(const struct device *dev,
134134
return ret;
135135
}
136136

137-
static int r8a7795_cpg_mssr_init(const struct device *dev)
138-
{
139-
ARG_UNUSED(dev);
140-
return 0;
141-
}
142-
143137
static const struct clock_control_driver_api r8a7795_cpg_mssr_api = {
144138
.on = r8a7795_cpg_mssr_start,
145139
.off = r8a7795_cpg_mssr_stop,
@@ -152,7 +146,7 @@ static const struct clock_control_driver_api r8a7795_cpg_mssr_api = {
152146
}; \
153147
\
154148
DEVICE_DT_INST_DEFINE(inst, \
155-
&r8a7795_cpg_mssr_init, \
149+
NULL, \
156150
NULL, \
157151
NULL, &r8a7795_cpg_mssr##inst##_config, \
158152
PRE_KERNEL_1, \

drivers/clock_control/clock_control_rv32m1_pcc.c

+1-6
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,6 @@ static int rv32m1_pcc_get_rate(const struct device *dev,
5151
return 0;
5252
}
5353

54-
static int rv32m1_pcc_init(const struct device *dev)
55-
{
56-
return 0;
57-
}
58-
5954
static const struct clock_control_driver_api rv32m1_pcc_api = {
6055
.on = rv32m1_pcc_on,
6156
.off = rv32m1_pcc_off,
@@ -68,7 +63,7 @@ static const struct clock_control_driver_api rv32m1_pcc_api = {
6863
}; \
6964
\
7065
DEVICE_DT_INST_DEFINE(inst, \
71-
&rv32m1_pcc_init, \
66+
NULL, \
7267
NULL, \
7368
NULL, &rv32m1_pcc##inst##_config, \
7469
PRE_KERNEL_1, \

drivers/clock_control/clock_control_sam_pmc.c

+2-12
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,6 @@ static struct clock_control_driver_api atmel_sam_clock_control_api = {
135135
.get_status = atmel_sam_clock_control_get_status,
136136
};
137137

138-
static int atmel_sam_clock_control_init(const struct device *dev)
139-
{
140-
ARG_UNUSED(dev);
141-
142-
return 0;
143-
}
144-
145-
DEVICE_DT_INST_DEFINE(0, atmel_sam_clock_control_init,
146-
NULL,
147-
NULL,
148-
NULL,
149-
PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY,
138+
DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, NULL, PRE_KERNEL_1,
139+
CONFIG_CLOCK_CONTROL_INIT_PRIORITY,
150140
&atmel_sam_clock_control_api);

drivers/counter/counter_ace_v1x_art.c

+1-8
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,10 @@ int counter_ace_v1x_art_get_value(const struct device *dev, uint64_t *value)
102102
return 0;
103103
}
104104

105-
int counter_ace_v1x_art_init(const struct device *dev)
106-
{
107-
ARG_UNUSED(dev);
108-
109-
return 0;
110-
}
111-
112105
static const struct counter_driver_api ace_v1x_art_counter_apis = {
113106
.get_value_64 = counter_ace_v1x_art_get_value
114107
};
115108

116-
DEVICE_DT_DEFINE(DT_NODELABEL(ace_art_counter), counter_ace_v1x_art_init, NULL, NULL, NULL,
109+
DEVICE_DT_DEFINE(DT_NODELABEL(ace_art_counter), NULL, NULL, NULL, NULL,
117110
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
118111
&ace_v1x_art_counter_apis);

drivers/counter/counter_cmos.c

+2-9
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,6 @@ int get_value(const struct device *dev, uint32_t *ticks)
194194
return 0;
195195
}
196196

197-
static int init(const struct device *dev)
198-
{
199-
ARG_UNUSED(dev);
200-
201-
return 0;
202-
}
203-
204197
static const struct counter_config_info info = {
205198
.max_top_value = UINT_MAX,
206199
.freq = 1
@@ -210,5 +203,5 @@ static const struct counter_driver_api api = {
210203
.get_value = get_value
211204
};
212205

213-
DEVICE_DT_INST_DEFINE(0, &init, NULL, NULL, &info,
214-
POST_KERNEL, CONFIG_COUNTER_INIT_PRIORITY, &api);
206+
DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, &info, POST_KERNEL,
207+
CONFIG_COUNTER_INIT_PRIORITY, &api);

0 commit comments

Comments
 (0)