From: Dhaval Giani Date: Wed, 17 Oct 2007 14:55:11 +0000 (+0200) Subject: sched: fix !SYSFS build breakage X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b1a8c172c318534b96d0f0f1aecdad3898118b98;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git sched: fix !SYSFS build breakage When CONFIG_SYSFS is not set, CONFIG_FAIR_USER_SCHED fails to build with kernel/built-in.o: In function `uids_kobject_init': (.init.text+0x1488): undefined reference to `kernel_subsys' kernel/built-in.o: In function `uids_kobject_init': (.init.text+0x1490): undefined reference to `kernel_subsys' kernel/built-in.o: In function `uids_kobject_init': (.init.text+0x1480): undefined reference to `kernel_subsys' kernel/built-in.o: In function `uids_kobject_init': (.init.text+0x1494): undefined reference to `kernel_subsys' This patch fixes this build error. Signed-off-by: Srivatsa Vaddagiri Signed-off-by: Dhaval Giani Signed-off-by: Ingo Molnar --- diff --git a/include/linux/sched.h b/include/linux/sched.h index 592e3a55f818..4ac7d51ad0e1 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -530,10 +530,12 @@ struct user_struct { #ifdef CONFIG_FAIR_USER_SCHED struct task_group *tg; +#ifdef CONFIG_SYSFS struct kset kset; struct subsys_attribute user_attr; struct work_struct work; #endif +#endif }; #ifdef CONFIG_FAIR_USER_SCHED diff --git a/kernel/user.c b/kernel/user.c index f0e561e6d085..7e8215d87b40 100644 --- a/kernel/user.c +++ b/kernel/user.c @@ -87,9 +87,6 @@ static inline struct user_struct *uid_hash_find(uid_t uid, #ifdef CONFIG_FAIR_USER_SCHED -static struct kobject uids_kobject; /* represents /sys/kernel/uids directory */ -static DEFINE_MUTEX(uids_mutex); - static void sched_destroy_user(struct user_struct *up) { sched_destroy_group(up->tg); @@ -111,6 +108,19 @@ static void sched_switch_user(struct task_struct *p) sched_move_task(p); } +#else /* CONFIG_FAIR_USER_SCHED */ + +static void sched_destroy_user(struct user_struct *up) { } +static int sched_create_user(struct user_struct *up) { return 0; } +static void sched_switch_user(struct task_struct *p) { } + +#endif /* CONFIG_FAIR_USER_SCHED */ + +#if defined(CONFIG_FAIR_USER_SCHED) && defined(CONFIG_SYSFS) + +static struct kobject uids_kobject; /* represents /sys/kernel/uids directory */ +static DEFINE_MUTEX(uids_mutex); + static inline void uids_mutex_lock(void) { mutex_lock(&uids_mutex); @@ -257,11 +267,8 @@ static inline void free_user(struct user_struct *up, unsigned long flags) schedule_work(&up->work); } -#else /* CONFIG_FAIR_USER_SCHED */ +#else /* CONFIG_FAIR_USER_SCHED && CONFIG_SYSFS */ -static void sched_destroy_user(struct user_struct *up) { } -static int sched_create_user(struct user_struct *up) { return 0; } -static void sched_switch_user(struct task_struct *p) { } static inline int user_kobject_create(struct user_struct *up) { return 0; } static inline void uids_mutex_lock(void) { } static inline void uids_mutex_unlock(void) { } @@ -280,7 +287,7 @@ static inline void free_user(struct user_struct *up, unsigned long flags) kmem_cache_free(uid_cachep, up); } -#endif /* CONFIG_FAIR_USER_SCHED */ +#endif /* * Locate the user_struct for the passed UID. If found, take a ref on it. The