diff options
author | Keith Short <keithshort@chromium.org> | 2022-03-24 13:04:49 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-03-29 18:07:29 +0000 |
commit | 49bd176f91e764b530193dfa89390c3c6bed62c6 (patch) | |
tree | 19b74368ba55bb47849faf241bfcb3faa4921cb1 | |
parent | e105fe224b19c9210092672f477b09b90c6d9f64 (diff) | |
download | chrome-ec-49bd176f91e764b530193dfa89390c3c6bed62c6.tar.gz |
zephyr: shim: convert HOOK_INIT to SYS_INIT
Convert all HOOK_INIT calls to the equivalent SYS_INIT.
BUG=b:226434387
BRANCH=none
TEST=zmake testall
Signed-off-by: Keith Short <keithshort@chromium.org>
Change-Id: Ie046e07cf78a4f4b3704401a605d2fb15069479e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3553849
Reviewed-by: Al Semjonovs <asemjonovs@google.com>
-rw-r--r-- | zephyr/shim/chip/npcx/shi.c | 7 | ||||
-rw-r--r-- | zephyr/shim/src/bc12_pi3usb9201.c | 7 | ||||
-rw-r--r-- | zephyr/shim/src/cbi/cros_cbi.c | 8 | ||||
-rw-r--r-- | zephyr/shim/src/espi.c | 8 | ||||
-rw-r--r-- | zephyr/shim/src/hooks.c | 7 | ||||
-rw-r--r-- | zephyr/shim/src/motionsense_sensors.c | 7 | ||||
-rw-r--r-- | zephyr/shim/src/pwm_led.c | 7 | ||||
-rw-r--r-- | zephyr/test/drivers/src/stubs.c | 7 |
8 files changed, 40 insertions, 18 deletions
diff --git a/zephyr/shim/chip/npcx/shi.c b/zephyr/shim/chip/npcx/shi.c index c25fcd9935..0f0d2f1178 100644 --- a/zephyr/shim/chip/npcx/shi.c +++ b/zephyr/shim/chip/npcx/shi.c @@ -76,8 +76,9 @@ static void shi_power_change(struct ap_power_ev_callback *cb, } } -static void shi_init(void) +static int shi_init(const struct device *unused) { + ARG_UNUSED(unused); static struct ap_power_ev_callback cb; ap_power_ev_init_callback(&cb, shi_power_change, @@ -95,9 +96,11 @@ static void shi_init(void) (system_jumped_late() && chipset_in_state(CHIPSET_STATE_ON))) { shi_enable(); } + + return 0; } /* Call hook after chipset sets initial power state */ -DECLARE_HOOK(HOOK_INIT, shi_init, HOOK_PRIO_POST_CHIPSET); +SYS_INIT(shi_init, APPLICATION, HOOK_PRIO_POST_CHIPSET); /* Get protocol information */ static enum ec_status shi_get_protocol_info(struct host_cmd_handler_args *args) diff --git a/zephyr/shim/src/bc12_pi3usb9201.c b/zephyr/shim/src/bc12_pi3usb9201.c index 49e6902e74..a102e442f1 100644 --- a/zephyr/shim/src/bc12_pi3usb9201.c +++ b/zephyr/shim/src/bc12_pi3usb9201.c @@ -36,11 +36,14 @@ const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = { GPIO_INT_FROM_NODE(DT_INST_PHANDLE(inst, irq)))) \ ); -static void bc12_enable_irqs(void) +static int bc12_enable_irqs(const struct device *unused) { + ARG_UNUSED(unused); DT_INST_FOREACH_STATUS_OKAY(BC12_GPIO_ENABLE_INTERRUPT) + + return 0; } -DECLARE_HOOK(HOOK_INIT, bc12_enable_irqs, HOOK_PRIO_DEFAULT); +SYS_INIT(bc12_enable_irqs, APPLICATION, HOOK_PRIO_DEFAULT); #if DT_INST_NODE_HAS_PROP(0, irq) void usb0_evt(enum gpio_signal signal) diff --git a/zephyr/shim/src/cbi/cros_cbi.c b/zephyr/shim/src/cbi/cros_cbi.c index 7ae1fbc098..424f542cc4 100644 --- a/zephyr/shim/src/cbi/cros_cbi.c +++ b/zephyr/shim/src/cbi/cros_cbi.c @@ -8,10 +8,12 @@ #include "cros_board_info.h" #include "hooks.h" -static void cros_cbi_ec_init(void) +static int cros_cbi_ec_init(const struct device *unused) { + ARG_UNUSED(unused); cros_cbi_ssfc_init(); cros_cbi_fw_config_init(); -} -DECLARE_HOOK(HOOK_INIT, cros_cbi_ec_init, HOOK_PRIO_FIRST); + return 0; +} +SYS_INIT(cros_cbi_ec_init, APPLICATION, HOOK_PRIO_FIRST); diff --git a/zephyr/shim/src/espi.c b/zephyr/shim/src/espi.c index 37a051e57c..dc9a5cd46e 100644 --- a/zephyr/shim/src/espi.c +++ b/zephyr/shim/src/espi.c @@ -307,8 +307,9 @@ void lpc_update_host_event_status(void) lpc_generate_sci(); } -static void host_command_init(void) +static int host_command_init(const struct device *unused) { + ARG_UNUSED(unused); /* We support LPC args and version 3 protocol */ *(lpc_get_memmap_range() + EC_MEMMAP_HOST_CMD_FLAGS) = EC_HOST_CMD_FLAG_LPC_ARGS_SUPPORTED | @@ -318,9 +319,10 @@ static void host_command_init(void) init_done = 1; lpc_update_host_event_status(); -} -DECLARE_HOOK(HOOK_INIT, host_command_init, HOOK_PRIO_INIT_LPC); + return 0; +} +SYS_INIT(host_command_init, APPLICATION, HOOK_PRIO_INIT_LPC); static void handle_acpi_write(uint32_t data) { diff --git a/zephyr/shim/src/hooks.c b/zephyr/shim/src/hooks.c index c5b2c0ec41..6f9fb2d14d 100644 --- a/zephyr/shim/src/hooks.c +++ b/zephyr/shim/src/hooks.c @@ -80,8 +80,9 @@ static void hook_tick_work(struct k_work *work) work_queue_error(&hook_ticks_work_data, rv); } -static void check_hook_task_priority(void) +static int check_hook_task_priority(const struct device *unused) { + ARG_UNUSED(unused); k_tid_t thread = &k_sys_work_q.thread; /* @@ -93,8 +94,10 @@ static void check_hook_task_priority(void) "ERROR: %s has priority %d but must be >= %d\n", k_thread_name_get(thread), k_thread_priority_get(thread), (TASK_ID_COUNT - 1)); + + return 0; } -DECLARE_HOOK(HOOK_INIT, check_hook_task_priority, HOOK_PRIO_FIRST); +SYS_INIT(check_hook_task_priority, APPLICATION, HOOK_PRIO_FIRST); static int zephyr_shim_setup_hooks(const struct device *unused) { diff --git a/zephyr/shim/src/motionsense_sensors.c b/zephyr/shim/src/motionsense_sensors.c index 0cc55339df..a5f4f96d4f 100644 --- a/zephyr/shim/src/motionsense_sensors.c +++ b/zephyr/shim/src/motionsense_sensors.c @@ -383,12 +383,15 @@ BUILD_ASSERT(ARRAY_SIZE(motion_als_sensors) == ALS_COUNT); #define SENSOR_GPIO_ENABLE_INTERRUPT(i, id) \ gpio_enable_dt_interrupt( \ GPIO_INT_FROM_NODE(DT_PHANDLE_BY_IDX(id, sensor_irqs, i))); -static void sensor_enable_irqs(void) +static int sensor_enable_irqs(const struct device *unused) { + ARG_UNUSED(unused); LISTIFY(DT_PROP_LEN(SENSOR_INFO_NODE, sensor_irqs), SENSOR_GPIO_ENABLE_INTERRUPT, (), SENSOR_INFO_NODE) + + return 0; } -DECLARE_HOOK(HOOK_INIT, sensor_enable_irqs, HOOK_PRIO_DEFAULT); +SYS_INIT(sensor_enable_irqs, APPLICATION, HOOK_PRIO_DEFAULT); #endif /* Handle the alternative motion sensors */ diff --git a/zephyr/shim/src/pwm_led.c b/zephyr/shim/src/pwm_led.c index cfa7005f04..ad11456ab5 100644 --- a/zephyr/shim/src/pwm_led.c +++ b/zephyr/shim/src/pwm_led.c @@ -208,12 +208,15 @@ static void led_set_charge_port_tick(void) } DECLARE_HOOK(HOOK_TICK, led_set_charge_port_tick, HOOK_PRIO_DEFAULT); -static void board_led_init(void) +static int board_led_init(const struct device *unused) { + ARG_UNUSED(unused); /* Illuminate motherboard and daughter board LEDs equally to start. */ pwm_led_set_duty(&_pwm_led_dt_sidesel, 50); + + return 0; } -DECLARE_HOOK(HOOK_INIT, board_led_init, HOOK_PRIO_DEFAULT); +SYS_INIT(board_led_init, APPLICATION, HOOK_PRIO_DEFAULT); #endif /* DT_INST_NODE_HAS_PROP(0, sidesel) */ diff --git a/zephyr/test/drivers/src/stubs.c b/zephyr/test/drivers/src/stubs.c index d1a56b5fec..3c5a3d17f7 100644 --- a/zephyr/test/drivers/src/stubs.c +++ b/zephyr/test/drivers/src/stubs.c @@ -321,8 +321,9 @@ void ppc_alert(enum gpio_signal signal) /* TODO: This code should really be generic, and run based on something in * the dts. */ -static void stubs_interrupt_init(void) +static int stubs_interrupt_init(const struct device *unused) { + ARG_UNUSED(unused); /* Enable TCPC interrupts. */ gpio_enable_dt_interrupt(GPIO_INT_FROM_NODELABEL(int_usb_c0)); gpio_enable_dt_interrupt(GPIO_INT_FROM_NODELABEL(int_usb_c1)); @@ -346,8 +347,10 @@ static void stubs_interrupt_init(void) /* Enable SwitchCap interrupt */ gpio_enable_dt_interrupt(GPIO_INT_FROM_NODELABEL(int_switchcap_pg)); + + return 0; } -DECLARE_HOOK(HOOK_INIT, stubs_interrupt_init, HOOK_PRIO_POST_I2C); +SYS_INIT(stubs_interrupt_init, APPLICATION, HOOK_PRIO_POST_I2C); void board_set_switchcap_power(int enable) { |