File tree Expand file tree Collapse file tree 15 files changed +57
-165
lines changed
tests/subsys/greybus/gpio/src Expand file tree Collapse file tree 15 files changed +57
-165
lines changed Original file line number Diff line number Diff line change 77#include <stdio.h>
88#include <zephyr.h>
99
10- struct device ;
11- extern int greybus_service_init (struct device * bus );
12-
1310void main (void )
1411{
15- int r = greybus_service_init (NULL );
16- if (r < 0 ) {
17- printf ("gb_service_deferred_init() failed: %d\n" , r );
18- }
1912}
Original file line number Diff line number Diff line change 77#include <stdio.h>
88#include <zephyr.h>
99
10- struct device ;
11- extern int greybus_service_init (struct device * bus );
12-
1310void main (void )
1411{
15- int r = greybus_service_init (NULL );
16- if (r < 0 ) {
17- printf ("gb_service_deferred_init() failed: %d\n" , r );
18- }
1912}
Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ zephyr_library_sources(
1313
1414 platform/manifest.c
1515 platform/platform.c
16- platform/deferred-init.c
1716
1817 platform/service.c
1918
Original file line number Diff line number Diff line change @@ -161,6 +161,41 @@ config GREYBUS_VIBRATOR
161161 help
162162 Select this for Greybus Vibrator support.
163163
164+ config GREYBUS_SERVICE_INIT_PRIORITY
165+ int "default Greybus Service Init Priority"
166+ default 85
167+ range 0 99
168+ help
169+ Greybus service init priority to ensure device initialization order.
170+
171+ config GREYBUS_STRING_INIT_PRIORITY
172+ int "default Greybus String Init Priority"
173+ default 86
174+ range 0 99
175+ help
176+ Greybus string init priority to ensure device initialization order.
177+
178+ config GREYBUS_INTERFACE_INIT_PRIORITY
179+ int "default Greybus Interface Init Priority"
180+ default 87
181+ range 0 99
182+ help
183+ Greybus interface init priority to ensure device initialization order.
184+
185+ config GREYBUS_BUNDLE_INIT_PRIORITY
186+ int "default Greybus Bundle Init Priority"
187+ default 88
188+ range 0 99
189+ help
190+ Greybus bundle init priority to ensure device initialization order.
191+
192+ config GREYBUS_CPORT_INIT_PRIORITY
193+ int "default Greybus Cport Init Priority"
194+ default 89
195+ range 0 99
196+ help
197+ Greybus cport init priority to ensure device initialization order.
198+
164199module = GREYBUS
165200module-str = gb
166201source "subsys/logging/Kconfig.template.log_config"
Original file line number Diff line number Diff line change @@ -32,11 +32,6 @@ static int greybus_bundle_init(const struct device *dev) {
3232 return 0 ;
3333}
3434
35- extern int gb_service_defer_init (const struct device * , int (* init )(const struct device * ));
36- static int defer_greybus_bundle_init (const struct device * dev ) {
37- return gb_service_defer_init (dev , & greybus_bundle_init );
38- }
39-
4035#define DEFINE_GREYBUS_BUNDLE (_num ) \
4136 \
4237 static const struct greybus_bundle_config \
@@ -48,10 +43,10 @@ static int defer_greybus_bundle_init(const struct device *dev) {
4843 }; \
4944 \
5045 DEVICE_DT_INST_DEFINE(_num, \
51- defer_greybus_bundle_init , \
46+ greybus_bundle_init , \
5247 NULL, NULL, \
5348 &greybus_bundle_config_##_num, \
5449 POST_KERNEL, \
55- CONFIG_KERNEL_INIT_PRIORITY_DEVICE , NULL);
50+ CONFIG_GREYBUS_BUNDLE_INIT_PRIORITY , NULL);
5651
5752DT_INST_FOREACH_STATUS_OKAY (DEFINE_GREYBUS_BUNDLE );
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ static int greybus_init(const struct device *bus) {
3838 DEVICE_DT_INST_DEFINE(_num, \
3939 greybus_init, NULL, NULL, \
4040 &greybus_config_##_num, POST_KERNEL, \
41- CONFIG_KERNEL_INIT_PRIORITY_DEVICE , \
41+ CONFIG_GREYBUS_SERVICE_INIT_PRIORITY , \
4242 NULL);
4343
4444DT_INST_FOREACH_STATUS_OKAY (DEFINE_GREYBUS );
Original file line number Diff line number Diff line change @@ -32,11 +32,6 @@ static int greybus_control_init(const struct device *dev) {
3232 return 0 ;
3333}
3434
35- extern int gb_service_defer_init (const struct device * , int (* init )(const struct device * ));
36- static int defer_greybus_control_init (const struct device * dev ) {
37- return gb_service_defer_init (dev , & greybus_control_init );
38- }
39-
4035#define DEFINE_GREYBUS_CONTROL (_num ) \
4136 \
4237 BUILD_ASSERT(DT_PROP(DT_PARENT(DT_DRV_INST(_num)), bundle_class) \
@@ -54,9 +49,9 @@ static int defer_greybus_control_init(const struct device *dev) {
5449 }; \
5550 \
5651 DEVICE_DT_INST_DEFINE(_num, \
57- defer_greybus_control_init , \
52+ greybus_control_init , \
5853 NULL, NULL, \
5954 &greybus_control_config_##_num, POST_KERNEL, \
60- CONFIG_KERNEL_INIT_PRIORITY_DEVICE , NULL);
55+ CONFIG_GREYBUS_CPORT_INIT_PRIORITY , NULL);
6156
6257DT_INST_FOREACH_STATUS_OKAY (DEFINE_GREYBUS_CONTROL );
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -124,11 +124,6 @@ static int greybus_gpio_control_init(const struct device *dev) {
124124 return 0 ;
125125}
126126
127- extern int gb_service_defer_init (const struct device * , int (* init )(const struct device * ));
128- static int defer_greybus_gpio_control_init (const struct device * dev ) {
129- return gb_service_defer_init (dev , & greybus_gpio_control_init );
130- }
131-
132127#define DEFINE_GREYBUS_GPIO_CONTROL (_num ) \
133128 \
134129 BUILD_ASSERT(DT_PROP(DT_PARENT(DT_DRV_INST(_num)), bundle_class) \
@@ -152,9 +147,9 @@ static int defer_greybus_gpio_control_init(const struct device *dev) {
152147 greybus_gpio_control_data_##_num; \
153148 \
154149 DEVICE_DT_INST_DEFINE(_num, \
155- defer_greybus_gpio_control_init , NULL, \
150+ greybus_gpio_control_init , NULL, \
156151 &greybus_gpio_control_data_##_num, \
157152 &greybus_gpio_control_config_##_num, POST_KERNEL, \
158- CONFIG_KERNEL_INIT_PRIORITY_DEVICE , NULL);
153+ CONFIG_GREYBUS_CPORT_INIT_PRIORITY , NULL);
159154
160155DT_INST_FOREACH_STATUS_OKAY (DEFINE_GREYBUS_GPIO_CONTROL );
Original file line number Diff line number Diff line change @@ -61,11 +61,6 @@ static int greybus_i2c_control_init(const struct device *dev) {
6161 return 0 ;
6262}
6363
64- extern int gb_service_defer_init (const struct device * , int (* init )(const struct device * ));
65- static int defer_greybus_i2c_control_init (const struct device * dev ) {
66- return gb_service_defer_init (dev , & greybus_i2c_control_init );
67- }
68-
6964#define DEFINE_GREYBUS_I2C_CONTROL (_num ) \
7065 \
7166 BUILD_ASSERT(DT_PROP(DT_PARENT(DT_DRV_INST(_num)), bundle_class) \
@@ -89,9 +84,9 @@ static int defer_greybus_i2c_control_init(const struct device *dev) {
8984 greybus_i2c_control_data_##_num; \
9085 \
9186 DEVICE_INIT(i2c_i2c_control_##_num, "GBI2C_" #_num, \
92- defer_greybus_i2c_control_init , \
87+ greybus_i2c_control_init , \
9388 &greybus_i2c_control_data_##_num, \
9489 &greybus_i2c_control_config_##_num, POST_KERNEL, \
95- CONFIG_KERNEL_INIT_PRIORITY_DEVICE );
90+ CONFIG_GREYBUS_CPORT_INIT_PRIORITY );
9691
9792DT_INST_FOREACH_STATUS_OKAY (DEFINE_GREYBUS_I2C_CONTROL );
You can’t perform that action at this time.
0 commit comments