@@ -724,7 +724,7 @@ a653sched_adjust_global(const struct scheduler *ops,
* callback functions.
* The symbol must be visible to the rest of Xen at link time.
*/
-const struct scheduler sched_arinc653_def = {
+static const struct scheduler sched_arinc653_def = {
.name = "ARINC 653 Scheduler",
.opt_name = "arinc653",
.sched_id = XEN_SCHEDULER_ARINC653,
@@ -1991,7 +1991,7 @@ static void csched_tick_resume(const struct scheduler *ops, unsigned int cpu)
static struct csched_private _csched_priv;
-const struct scheduler sched_credit_def = {
+static const struct scheduler sched_credit_def = {
.name = "SMP Credit Scheduler",
.opt_name = "credit",
.sched_id = XEN_SCHEDULER_CREDIT,
@@ -2194,7 +2194,7 @@ csched2_deinit(const struct scheduler *ops)
static struct csched2_private _csched2_priv;
-const struct scheduler sched_credit2_def = {
+static const struct scheduler sched_credit2_def = {
.name = "SMP Credit Scheduler rev2",
.opt_name = "credit2",
.sched_id = XEN_SCHEDULER_CREDIT2,
@@ -1170,7 +1170,7 @@ rt_dom_cntl(
static struct rt_private _rt_priv;
-const struct scheduler sched_rtds_def = {
+static const struct scheduler sched_rtds_def = {
.name = "SMP RTDS Scheduler",
.opt_name = "rtds",
.sched_id = XEN_SCHEDULER_RTDS,
@@ -64,20 +64,9 @@ static void poll_timer_fn(void *data);
DEFINE_PER_CPU(struct schedule_data, schedule_data);
DEFINE_PER_CPU(struct scheduler *, scheduler);
-static const struct scheduler *schedulers[] = {
-#ifdef CONFIG_SCHED_CREDIT
- &sched_credit_def,
-#endif
-#ifdef CONFIG_SCHED_CREDIT2
- &sched_credit2_def,
-#endif
-#ifdef CONFIG_SCHED_ARINC653
- &sched_arinc653_def,
-#endif
-#ifdef CONFIG_SCHED_RTDS
- &sched_rtds_def,
-#endif
-};
+extern const struct scheduler *__start_schedulers_array[], *__end_schedulers_array[];
+#define NUM_SCHEDULERS (__end_schedulers_array - __start_schedulers_array)
+static const struct scheduler **schedulers = __start_schedulers_array;
static struct scheduler __read_mostly ops;
@@ -1468,7 +1457,7 @@ void __init scheduler_init(void)
open_softirq(SCHEDULE_SOFTIRQ, schedule);
- for ( i = 0; i < ARRAY_SIZE(schedulers); i++ )
+ for ( i = 0; i < NUM_SCHEDULERS; i++)
{
if ( schedulers[i]->global_init && schedulers[i]->global_init() < 0 )
schedulers[i] = NULL;
@@ -1479,7 +1468,7 @@ void __init scheduler_init(void)
if ( !ops.name )
{
printk("Could not find scheduler: %s\n", opt_sched);
- for ( i = 0; i < ARRAY_SIZE(schedulers); i++ )
+ for ( i = 0; i < NUM_SCHEDULERS; i++ )
if ( schedulers[i] )
{
ops = *schedulers[i];
@@ -1599,7 +1588,7 @@ struct scheduler *scheduler_alloc(unsigned int sched_id, int *perr)
int i;
struct scheduler *sched;
- for ( i = 0; i < ARRAY_SIZE(schedulers); i++ )
+ for ( i = 0; i < NUM_SCHEDULERS; i++ )
if ( schedulers[i] && schedulers[i]->sched_id == sched_id )
goto found;
*perr = -ENOENT;
@@ -165,11 +165,6 @@ struct scheduler {
void (*tick_resume) (const struct scheduler *, unsigned int);
};
-extern const struct scheduler sched_credit_def;
-extern const struct scheduler sched_credit2_def;
-extern const struct scheduler sched_arinc653_def;
-extern const struct scheduler sched_rtds_def;
-
#define REGISTER_SCHEDULER(x) static const struct scheduler *x##_entry \
__used_section(".data.schedulers") = &x;