static int do_cyclic_list(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
- struct cyclic_info *cyclic, *tmp;
+ struct cyclic_info *cyclic;
+ struct hlist_node *tmp;
u64 cnt, freq;
- list_for_each_entry_safe(cyclic, tmp, cyclic_get_list(), list) {
+ hlist_for_each_entry_safe(cyclic, tmp, cyclic_get_list(), list) {
cnt = cyclic->run_cnt * 1000000ULL * 100ULL;
freq = lldiv(cnt, timer_get_us() - cyclic->start_time_us);
printf("function: %s, cpu-time: %lld us, frequency: %lld.%02d times/s\n",
void hw_watchdog_reset(void);
-struct list_head *cyclic_get_list(void)
+struct hlist_head *cyclic_get_list(void)
{
return &gd->cyclic->cyclic_list;
}
cyclic->name = strdup(name);
cyclic->delay_us = delay_us;
cyclic->start_time_us = timer_get_us();
- list_add_tail(&cyclic->list, &gd->cyclic->cyclic_list);
+ hlist_add_head(&cyclic->list, &gd->cyclic->cyclic_list);
return cyclic;
}
int cyclic_unregister(struct cyclic_info *cyclic)
{
- list_del(&cyclic->list);
+ hlist_del(&cyclic->list);
free(cyclic);
return 0;
void cyclic_run(void)
{
- struct cyclic_info *cyclic, *tmp;
+ struct cyclic_info *cyclic;
+ struct hlist_node *tmp;
uint64_t now, cpu_time;
/* Prevent recursion */
return;
gd->flags |= GD_FLG_CYCLIC_RUNNING;
- list_for_each_entry_safe(cyclic, tmp, &gd->cyclic->cyclic_list, list) {
+ hlist_for_each_entry_safe(cyclic, tmp, &gd->cyclic->cyclic_list, list) {
/*
* Check if this cyclic function needs to get called, e.g.
* do not call the cyclic func too often
int cyclic_uninit(void)
{
- struct cyclic_info *cyclic, *tmp;
+ struct cyclic_info *cyclic;
+ struct hlist_node *tmp;
- list_for_each_entry_safe(cyclic, tmp, &gd->cyclic->cyclic_list, list)
+ hlist_for_each_entry_safe(cyclic, tmp, &gd->cyclic->cyclic_list, list)
cyclic_unregister(cyclic);
return 0;
return -ENOMEM;
memset(gd->cyclic, '\0', size);
- INIT_LIST_HEAD(&gd->cyclic->cyclic_list);
+ INIT_HLIST_HEAD(&gd->cyclic->cyclic_list);
return 0;
}
* @cyclic_list: Cylic list node
*/
struct cyclic_drv {
- struct list_head cyclic_list;
+ struct hlist_head cyclic_list;
};
/**
uint64_t cpu_time_us;
uint64_t run_cnt;
uint64_t next_call;
- struct list_head list;
+ struct hlist_node list;
bool already_warned;
};
*
* @return: pointer to cyclic_list
*/
-struct list_head *cyclic_get_list(void);
+struct hlist_head *cyclic_get_list(void);
/**
* cyclic_run() - Interate over all registered cyclic functions