Skip to contentSkip to conversation

x86/sgx: Annotate SGX driver init functions with __init

PATCH In review Sean Christopherson 2 participants 2 messages Jul 11, 2019 – Jul 12, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/sgx: Annotate SGX driver init functions with __init

The SGX driver can no longer be built as a loadable module, ergo its initialization functions are only called during actual init.

---
 arch/x86/kernel/cpu/sgx/driver/driver.h | 2 +-
 arch/x86/kernel/cpu/sgx/driver/main.c   | 9 ++++-----
 2 files changed, 5 insertions(+), 6 deletions(-)
arch/x86/kernel/cpu/sgx/driver/driver.h +1 -1
index c71570a9cd01..8af7c38dddd0 100644
@@ -34,6 +34,6 @@ extern u32 sgx_xsave_size_tbl[64];
 extern const struct file_operations sgx_provision_fops;
 
 long sgx_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);
-int sgx_drv_init(void);
+int __init sgx_drv_init(void);
 
 #endif /* __ARCH_X86_INTEL_SGX_H__ */
arch/x86/kernel/cpu/sgx/driver/main.c +4 -5
index c7fc32e26105..da6d849d3cb4 100644
@@ -198,10 +198,9 @@ static void sgx_dev_release(struct device *dev)
 {
 }
 
-static int sgx_dev_init(const char *name, struct device *dev,
-			struct cdev *cdev,
-			const struct file_operations *fops,
-			int minor)
+static __init int sgx_dev_init(const char *name, struct device *dev,
+			       struct cdev *cdev,
+			       const struct file_operations *fops, int minor)
 {
 	int ret;
 
@@ -222,7 +221,7 @@ static int sgx_dev_init(const char *name, struct device *dev,
 	return 0;
 }
 
-int sgx_drv_init(void)
+int __init sgx_drv_init(void)
 {
 	unsigned int eax, ebx, ecx, edx;
 	u64 attr_mask, xfrm_mask;
Signature · 1 line
2.22.0
#1 lore raw
Quoted 4 lines · Sean Christopherson

The SGX driver can no longer be built as a loadable module, ergo its initialization functions are only called during actual init.

Sure, just something forgot to done. Thanks.

/Jarkko