mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
kernel: ksysfs: initialize kernel_kobj earlier
Software nodes depend on kernel_kobj which is initialized pretty late into the boot process - as a core_initcall(). Ahead of moving the software node initialization to driver_init() we must first make kernel_kobj available before it. Make ksysfs_init() visible in a new header - ksysfs.h - and call it in do_basic_setup() right before driver_init(). Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Link: https://patch.msgid.link/20260402-nokia770-gpio-swnodes-v5-1-d730db3dd299@oss.qualcomm.com Signed-off-by: Danilo Krummrich <dakr@kernel.org>
This commit is contained in:
committed by
Danilo Krummrich
parent
704b2a7d75
commit
9617b5b62c
@@ -7805,6 +7805,7 @@ F: include/linux/debugfs.h
|
||||
F: include/linux/device.h
|
||||
F: include/linux/fwnode.h
|
||||
F: include/linux/kobj*
|
||||
F: include/linux/ksysfs.h
|
||||
F: include/linux/property.h
|
||||
F: include/linux/sysfs.h
|
||||
F: kernel/ksysfs.c
|
||||
|
||||
8
include/linux/ksysfs.h
Normal file
8
include/linux/ksysfs.h
Normal file
@@ -0,0 +1,8 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
|
||||
#ifndef _KSYSFS_H_
|
||||
#define _KSYSFS_H_
|
||||
|
||||
void ksysfs_init(void);
|
||||
|
||||
#endif /* _KSYSFS_H_ */
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <linux/kmod.h>
|
||||
#include <linux/kprobes.h>
|
||||
#include <linux/kmsan.h>
|
||||
#include <linux/ksysfs.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/kernel_stat.h>
|
||||
#include <linux/start_kernel.h>
|
||||
@@ -1473,6 +1474,7 @@ static void __init do_initcalls(void)
|
||||
static void __init do_basic_setup(void)
|
||||
{
|
||||
cpuset_init_smp();
|
||||
ksysfs_init();
|
||||
driver_init();
|
||||
init_irq_proc();
|
||||
do_ctors();
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <asm/byteorder.h>
|
||||
#include <linux/kobject.h>
|
||||
#include <linux/ksysfs.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/sysfs.h>
|
||||
#include <linux/export.h>
|
||||
@@ -213,7 +214,7 @@ static const struct attribute_group kernel_attr_group = {
|
||||
.attrs = kernel_attrs,
|
||||
};
|
||||
|
||||
static int __init ksysfs_init(void)
|
||||
void __init ksysfs_init(void)
|
||||
{
|
||||
int error;
|
||||
|
||||
@@ -234,14 +235,12 @@ static int __init ksysfs_init(void)
|
||||
goto group_exit;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return;
|
||||
|
||||
group_exit:
|
||||
sysfs_remove_group(kernel_kobj, &kernel_attr_group);
|
||||
kset_exit:
|
||||
kobject_put(kernel_kobj);
|
||||
exit:
|
||||
return error;
|
||||
pr_err("failed to initialize the kernel kobject: %d\n", error);
|
||||
}
|
||||
|
||||
core_initcall(ksysfs_init);
|
||||
|
||||
Reference in New Issue
Block a user