mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-18 19:04:38 +00:00
cyclic: introduce u-boot/schedule.h
I noticed an "unnecessary" include of <cyclic.h> in global_data.h, in the sense that nothing in cyclic.h is needed in order to define 'struct global_data'. Well, it's not unnecessary, as it implicitly ensures that everybody gets a declaration of schedule(), and schedule() is (obviously) called all over the tree. Almost none of those places directly include <cyclic.h>, but for historical reasons, many do include <watchdog.h> (most schedule() instances are replacements of WATCHDOG_RESET()). However, very few TUs actually need the declarations of the cyclic_register() and struct cyclic_info, and they also don't really need anything from the watchdog.h header. So introduce a new header which just contains a declaration of schedule(), which can then be included from all the places that do call schedule(). I removed the direct reference to cyclic_run(), because we shouldn't have two public functions for doing roughly the same without being very explicit about when one should call one or the other. Testing of later patches that explicitly include <schedule.h> when schedule() is used revealed a problem with host tool build on win32, which apparently picked up a host <schedule.h>. To avoid that problem, put the new header in include/u-boot/ and hence make the include statements say <u-boot/schedule.h>. Signed-off-by: Rasmus Villemoes <ravi@prevas.dk> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stefan Roese <sr@denx.de>
This commit is contained in:
parent
6250945367
commit
4457e5c61d
3 changed files with 26 additions and 11 deletions
|
@ -15,6 +15,7 @@
|
||||||
#include <linux/errno.h>
|
#include <linux/errno.h>
|
||||||
#include <linux/list.h>
|
#include <linux/list.h>
|
||||||
#include <asm/global_data.h>
|
#include <asm/global_data.h>
|
||||||
|
#include <u-boot/schedule.h>
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#include <linux/list.h>
|
#include <linux/list.h>
|
||||||
#include <asm/types.h>
|
#include <asm/types.h>
|
||||||
|
#include <u-boot/schedule.h> // to be removed later
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct cyclic_info - Information about cyclic execution function
|
* struct cyclic_info - Information about cyclic execution function
|
||||||
|
@ -94,13 +95,6 @@ struct hlist_head *cyclic_get_list(void);
|
||||||
*/
|
*/
|
||||||
void cyclic_run(void);
|
void cyclic_run(void);
|
||||||
|
|
||||||
/**
|
|
||||||
* schedule() - Schedule all potentially waiting tasks
|
|
||||||
*
|
|
||||||
* Basically a wrapper for cyclic_run(), pontentially enhanced by some
|
|
||||||
* other parts, that need to get handled periodically.
|
|
||||||
*/
|
|
||||||
void schedule(void);
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
static inline void cyclic_register(struct cyclic_info *cyclic, cyclic_func_t func,
|
static inline void cyclic_register(struct cyclic_info *cyclic, cyclic_func_t func,
|
||||||
|
@ -116,10 +110,6 @@ static inline void cyclic_run(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void schedule(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int cyclic_unregister_all(void)
|
static inline int cyclic_unregister_all(void)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
|
24
include/u-boot/schedule.h
Normal file
24
include/u-boot/schedule.h
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
||||||
|
|
||||||
|
#ifndef _U_BOOT_SCHEDULE_H
|
||||||
|
#define _U_BOOT_SCHEDULE_H
|
||||||
|
|
||||||
|
#if CONFIG_IS_ENABLED(CYCLIC)
|
||||||
|
/**
|
||||||
|
* schedule() - Schedule all potentially waiting tasks
|
||||||
|
*
|
||||||
|
* Run all pending tasks registered via the cyclic framework, and
|
||||||
|
* potentially perform other actions that need to be done
|
||||||
|
* periodically.
|
||||||
|
*/
|
||||||
|
void schedule(void);
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
static inline void schedule(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
Loading…
Add table
Reference in a new issue