Skip to contentSkip to conversation

x86/sgx: Clean up internal includes

PATCH New Jarkko Sakkinen 1 participant 1 message Sep 3, 2019

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

PATCH 1/1 x86/sgx: Clean up internal includes

Include arch.h from sgx.h and include sgx.h from other headers. Do not include sgx.h from .c files. This makes a sane include order. Any new header should only need to include sgx.h. The .c files must include the modules they use.

---
 arch/x86/kernel/cpu/sgx/driver.c  | 2 ++
 arch/x86/kernel/cpu/sgx/driver.h  | 3 ---
 arch/x86/kernel/cpu/sgx/encl.c    | 2 --
 arch/x86/kernel/cpu/sgx/encl.h    | 1 +
 arch/x86/kernel/cpu/sgx/encls.h   | 2 +-
 arch/x86/kernel/cpu/sgx/ioctl.c   | 2 ++
 arch/x86/kernel/cpu/sgx/main.c    | 3 +--
 arch/x86/kernel/cpu/sgx/reclaim.c | 3 ++-
 arch/x86/kernel/cpu/sgx/sgx.h     | 1 +
 9 files changed, 10 insertions(+), 9 deletions(-)
arch/x86/kernel/cpu/sgx/driver.c +2 -0
index a1da479ffd3a..1ceeb742c1da 100644
@@ -9,6 +9,8 @@
 #include <linux/suspend.h>
 #include <asm/traps.h>
 #include "driver.h"
+#include "encl.h"
+#include "encls.h"
 
 MODULE_DESCRIPTION("Intel SGX Enclave Driver");
 MODULE_AUTHOR("Jarkko Sakkinen <[email protected]>");
arch/x86/kernel/cpu/sgx/driver.h +0 -3
index 1e35933cf8a4..2f13886522a8 100644
@@ -10,9 +10,6 @@
 #include <linux/sched.h>
 #include <linux/workqueue.h>
 #include <uapi/asm/sgx.h>
-#include "arch.h"
-#include "encl.h"
-#include "encls.h"
 #include "sgx.h"
 
 #define SGX_DRV_NR_DEVICES	2
arch/x86/kernel/cpu/sgx/encl.c +0 -2
index 9bf49e30a568..1c1fbc95be33 100644
@@ -7,10 +7,8 @@
 #include <linux/shmem_fs.h>
 #include <linux/suspend.h>
 #include <linux/sched/mm.h>
-#include "arch.h"
 #include "encl.h"
 #include "encls.h"
-#include "sgx.h"
 
 static int __sgx_encl_eldu(struct sgx_encl_page *encl_page,
 			   struct sgx_epc_page *epc_page,
arch/x86/kernel/cpu/sgx/encl.h +1 -0
index c7608964d69e..95e5713a50ad 100644
@@ -15,6 +15,7 @@
 #include <linux/radix-tree.h>
 #include <linux/srcu.h>
 #include <linux/workqueue.h>
+#include "sgx.h"
 
 /**
  * enum sgx_encl_page_desc - defines bits for an enclave page's descriptor
arch/x86/kernel/cpu/sgx/encls.h +1 -1
index aea3b9d09936..6631afbf2f64 100644
@@ -8,7 +8,7 @@
 #include <linux/rwsem.h>
 #include <linux/types.h>
 #include <asm/asm.h>
-#include "arch.h"
+#include "sgx.h"
 
 /**
  * ENCLS_FAULT_FLAG - flag signifying an ENCLS return code is a trapnr
arch/x86/kernel/cpu/sgx/ioctl.c +2 -0
index e2205a433b87..e57dda38513b 100644
@@ -13,6 +13,8 @@
 #include <linux/slab.h>
 #include <linux/suspend.h>
 #include "driver.h"
+#include "encl.h"
+#include "encls.h"
 
 static struct sgx_va_page *sgx_encl_grow(struct sgx_encl *encl)
 {
arch/x86/kernel/cpu/sgx/main.c +1 -2
index e4f751651a65..c58ab5f28669 100644
@@ -9,9 +9,8 @@
 #include <linux/sched/signal.h>
 #include <linux/slab.h>
 #include "driver.h"
-#include "arch.h"
+#include "encl.h"
 #include "encls.h"
-#include "sgx.h"
 
 struct sgx_epc_section sgx_epc_sections[SGX_MAX_EPC_SECTIONS];
 int sgx_nr_epc_sections;
arch/x86/kernel/cpu/sgx/reclaim.c +2 -1
index bd8ac11a4278..d82ce1eaa60e 100644
@@ -10,7 +10,8 @@
 #include <linux/sched/mm.h>
 #include <linux/sched/signal.h>
 #include "driver.h"
-#include "sgx.h"
+#include "encl.h"
+#include "encls.h"
 
 struct task_struct *ksgxswapd_tsk;
 DECLARE_WAIT_QUEUE_HEAD(ksgxswapd_waitq);
arch/x86/kernel/cpu/sgx/sgx.h +1 -0
index f0ff7bd3d18e..bc6a644af2b5 100644
@@ -9,6 +9,7 @@
 #include <linux/types.h>
 #include <asm/asm.h>
 #include <uapi/asm/sgx_errno.h>
+#include "arch.h"
 
 struct sgx_epc_page {
 	unsigned long desc;
Signature · 1 line
2.20.1