summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/usb_common.c2
-rw-r--r--common/usbc/usb_tc_drp_acc_trysrc_sm.c2
-rw-r--r--zephyr/shim/include/zephyr_hooks_shim.h6
-rw-r--r--zephyr/shim/src/hooks.c13
4 files changed, 12 insertions, 11 deletions
diff --git a/common/usb_common.c b/common/usb_common.c
index 05f464cc00..37cd0886bd 100644
--- a/common/usb_common.c
+++ b/common/usb_common.c
@@ -701,7 +701,6 @@ __overridable bool vboot_allow_usb_pd(void)
return false;
}
-#ifndef CONFIG_ZEPHYR /* TODO(b/176110981) */
/* VDM utility functions */
static void pd_usb_billboard_deferred(void)
{
@@ -719,7 +718,6 @@ static void pd_usb_billboard_deferred(void)
}
}
DECLARE_DEFERRED(pd_usb_billboard_deferred);
-#endif /* CONFIG_ZEPHYR */
#ifdef CONFIG_USB_PD_DISCHARGE
static void gpio_discharge_vbus(int port, int enable)
diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
index 1df7710301..abb4d8d518 100644
--- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c
+++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
@@ -2223,13 +2223,11 @@ static void tc_attach_wait_snk_run(const int port)
set_state_tc(port, TC_ATTACHED_SNK);
}
-#ifndef CONFIG_ZEPHYR /* TODO(b/176110981) */
if (IS_ENABLED(CONFIG_USB_PE_SM) &&
IS_ENABLED(CONFIG_USB_PD_ALT_MODE_DFP)) {
hook_call_deferred(&pd_usb_billboard_deferred_data,
PD_T_AME);
}
-#endif
}
}
diff --git a/zephyr/shim/include/zephyr_hooks_shim.h b/zephyr/shim/include/zephyr_hooks_shim.h
index 3bb0854b21..56cb88cfa4 100644
--- a/zephyr/shim/include/zephyr_hooks_shim.h
+++ b/zephyr/shim/include/zephyr_hooks_shim.h
@@ -25,21 +25,21 @@ struct deferred_data {
/**
* See include/hooks.h for documentation.
*/
-int hook_call_deferred(struct deferred_data *data, int us);
+int hook_call_deferred(const struct deferred_data *data, int us);
/**
* Runtime helper to setup deferred data.
*
* @param data The struct deferred_data.
*/
-void zephyr_shim_setup_deferred(struct deferred_data *data);
+void zephyr_shim_setup_deferred(const struct deferred_data *data);
/**
* See include/hooks.h for documentation.
*/
#define DECLARE_DEFERRED(routine) _DECLARE_DEFERRED(routine)
#define _DECLARE_DEFERRED(_routine) \
- static __maybe_unused struct deferred_data _routine##_data = { \
+ __maybe_unused const struct deferred_data _routine##_data = { \
.routine = _routine, \
}; \
static int _setup_deferred_##_routine(const struct device *unused) \
diff --git a/zephyr/shim/src/hooks.c b/zephyr/shim/src/hooks.c
index 5011ed79ea..e4b1ea8791 100644
--- a/zephyr/shim/src/hooks.c
+++ b/zephyr/shim/src/hooks.c
@@ -42,17 +42,22 @@ static int init_deferred_work_queue(const struct device *unused)
}
SYS_INIT(init_deferred_work_queue, APPLICATION, 0);
-void zephyr_shim_setup_deferred(struct deferred_data *data)
+void zephyr_shim_setup_deferred(const struct deferred_data *data)
{
- k_delayed_work_init(&data->delayed_work, deferred_work_queue_handler);
+ struct deferred_data *non_const = (struct deferred_data *)data;
+
+ k_delayed_work_init(&non_const->delayed_work,
+ deferred_work_queue_handler);
}
-int hook_call_deferred(struct deferred_data *data, int us)
+int hook_call_deferred(const struct deferred_data *data, int us)
{
+ struct deferred_data *non_const = (struct deferred_data *)data;
int rv;
rv = k_delayed_work_submit_to_queue(&deferred_work_queue,
- &data->delayed_work, K_USEC(us));
+ &non_const->delayed_work,
+ K_USEC(us));
if (rv < 0)
cprints(CC_HOOK, "Warning: deferred call not submitted.");
return rv;