[PATCH] habanalabs: Move repeatedly included headers to habanalabs.h

From: Oded Gabbay
Date: Wed Nov 04 2020 - 09:09:29 EST


From: Tomer Tayar <ttayar@xxxxxxxxx>

Several header files are repeatedly included in many files.
Move these files to habanalabs.h which is included by all.

Signed-off-by: Tomer Tayar <ttayar@xxxxxxxxx>
Reviewed-by: Oded Gabbay <ogabbay@xxxxxxxxxx>
Signed-off-by: Oded Gabbay <ogabbay@xxxxxxxxxx>
---
drivers/misc/habanalabs/common/command_buffer.c | 1 -
drivers/misc/habanalabs/common/device.c | 1 -
drivers/misc/habanalabs/common/firmware_if.c | 2 --
drivers/misc/habanalabs/common/habanalabs.h | 4 ++++
drivers/misc/habanalabs/common/memory.c | 1 -
drivers/misc/habanalabs/common/mmu_v1.c | 1 -
drivers/misc/habanalabs/gaudi/gaudi.c | 2 --
drivers/misc/habanalabs/gaudi/gaudi_coresight.c | 2 --
drivers/misc/habanalabs/goya/goya.c | 2 --
drivers/misc/habanalabs/goya/goya_coresight.c | 2 --
10 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/drivers/misc/habanalabs/common/command_buffer.c b/drivers/misc/habanalabs/common/command_buffer.c
index 901e213daf40..1fb05bf02340 100644
--- a/drivers/misc/habanalabs/common/command_buffer.c
+++ b/drivers/misc/habanalabs/common/command_buffer.c
@@ -11,7 +11,6 @@
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
-#include <linux/genalloc.h>

static int cb_map_mem(struct hl_ctx *ctx, struct hl_cb *cb)
{
diff --git a/drivers/misc/habanalabs/common/device.c b/drivers/misc/habanalabs/common/device.c
index 20572224099a..421e37123b03 100644
--- a/drivers/misc/habanalabs/common/device.c
+++ b/drivers/misc/habanalabs/common/device.c
@@ -10,7 +10,6 @@
#include "habanalabs.h"

#include <linux/pci.h>
-#include <linux/sched/signal.h>
#include <linux/hwmon.h>
#include <uapi/misc/habanalabs.h>

diff --git a/drivers/misc/habanalabs/common/firmware_if.c b/drivers/misc/habanalabs/common/firmware_if.c
index d84a70ec0ce1..fb9d901d5059 100644
--- a/drivers/misc/habanalabs/common/firmware_if.c
+++ b/drivers/misc/habanalabs/common/firmware_if.c
@@ -9,8 +9,6 @@
#include "../include/common/hl_boot_if.h"

#include <linux/firmware.h>
-#include <linux/genalloc.h>
-#include <linux/io-64-nonatomic-lo-hi.h>
#include <linux/slab.h>

#define FW_FILE_MAX_SIZE 0x1400000 /* maximum size of 20MB */
diff --git a/drivers/misc/habanalabs/common/habanalabs.h b/drivers/misc/habanalabs/common/habanalabs.h
index ce516e9e1ebe..9f5a3c07f421 100644
--- a/drivers/misc/habanalabs/common/habanalabs.h
+++ b/drivers/misc/habanalabs/common/habanalabs.h
@@ -19,6 +19,10 @@
#include <linux/scatterlist.h>
#include <linux/hashtable.h>
#include <linux/bitfield.h>
+#include <linux/genalloc.h>
+#include <linux/sched/signal.h>
+#include <linux/io-64-nonatomic-lo-hi.h>
+#include <linux/coresight.h>

#define HL_NAME "habanalabs"

diff --git a/drivers/misc/habanalabs/common/memory.c b/drivers/misc/habanalabs/common/memory.c
index 75e269bc42a7..5c1dae6aaf4d 100644
--- a/drivers/misc/habanalabs/common/memory.c
+++ b/drivers/misc/habanalabs/common/memory.c
@@ -11,7 +11,6 @@

#include <linux/uaccess.h>
#include <linux/slab.h>
-#include <linux/genalloc.h>

#define HL_MMU_DEBUG 0

diff --git a/drivers/misc/habanalabs/common/mmu_v1.c b/drivers/misc/habanalabs/common/mmu_v1.c
index ec7e8a3c37b8..ac3784523baa 100644
--- a/drivers/misc/habanalabs/common/mmu_v1.c
+++ b/drivers/misc/habanalabs/common/mmu_v1.c
@@ -8,7 +8,6 @@
#include "habanalabs.h"
#include "../include/hw_ip/mmu/mmu_general.h"

-#include <linux/genalloc.h>
#include <linux/slab.h>

static inline u64 get_phys_addr(struct hl_ctx *ctx, u64 shadow_addr);
diff --git a/drivers/misc/habanalabs/gaudi/gaudi.c b/drivers/misc/habanalabs/gaudi/gaudi.c
index 9e38ac6f7264..ae73ffb4ad64 100644
--- a/drivers/misc/habanalabs/gaudi/gaudi.c
+++ b/drivers/misc/habanalabs/gaudi/gaudi.c
@@ -17,8 +17,6 @@
#include <linux/pci.h>
#include <linux/firmware.h>
#include <linux/hwmon.h>
-#include <linux/genalloc.h>
-#include <linux/io-64-nonatomic-lo-hi.h>
#include <linux/iommu.h>
#include <linux/seq_file.h>

diff --git a/drivers/misc/habanalabs/gaudi/gaudi_coresight.c b/drivers/misc/habanalabs/gaudi/gaudi_coresight.c
index 881531d4d9da..1f0edf78fba1 100644
--- a/drivers/misc/habanalabs/gaudi/gaudi_coresight.c
+++ b/drivers/misc/habanalabs/gaudi/gaudi_coresight.c
@@ -11,8 +11,6 @@
#include "../include/gaudi/gaudi_masks.h"

#include <uapi/misc/habanalabs.h>
-#include <linux/coresight.h>
-
#define SPMU_SECTION_SIZE MME0_ACC_SPMU_MAX_OFFSET
#define SPMU_EVENT_TYPES_OFFSET 0x400
#define SPMU_MAX_COUNTERS 6
diff --git a/drivers/misc/habanalabs/goya/goya.c b/drivers/misc/habanalabs/goya/goya.c
index 80df2f3d438c..1b81102d1bec 100644
--- a/drivers/misc/habanalabs/goya/goya.c
+++ b/drivers/misc/habanalabs/goya/goya.c
@@ -12,9 +12,7 @@
#include "../include/goya/goya_reg_map.h"

#include <linux/pci.h>
-#include <linux/genalloc.h>
#include <linux/hwmon.h>
-#include <linux/io-64-nonatomic-lo-hi.h>
#include <linux/iommu.h>
#include <linux/seq_file.h>

diff --git a/drivers/misc/habanalabs/goya/goya_coresight.c b/drivers/misc/habanalabs/goya/goya_coresight.c
index 4027a6a334d7..6fa03933b438 100644
--- a/drivers/misc/habanalabs/goya/goya_coresight.c
+++ b/drivers/misc/habanalabs/goya/goya_coresight.c
@@ -12,8 +12,6 @@

#include <uapi/misc/habanalabs.h>

-#include <linux/coresight.h>
-
#define GOYA_PLDM_CORESIGHT_TIMEOUT_USEC (CORESIGHT_TIMEOUT_USEC * 100)

#define SPMU_SECTION_SIZE DMA_CH_0_CS_SPMU_MAX_OFFSET
--
2.17.1