[PATCH] drm/amdgpu: Fix build errors with HMM disabled

Kuehling, Felix Felix.Kuehling at amd.com
Mon Jul 8 16:05:06 UTC 2019


Only define struct amdgpu_mn if HMM_MIRROR is enabled. Add back a
forward declaration for the case that it isn't.

Fixes: 6f1c3e61d2d8 ("drm/amdgpu: Prepare for hmm_range_register API change")
Signed-off-by: Felix Kuehling <Felix.Kuehling at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h
index 281fd9fef662..33ca6214db90 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h
@@ -35,6 +35,8 @@ enum amdgpu_mn_type {
 	AMDGPU_MN_TYPE_HSA,
 };
 
+#if defined(CONFIG_HMM_MIRROR)
+
 /**
  * struct amdgpu_mn
  *
@@ -69,7 +71,6 @@ struct amdgpu_mn {
 	struct hmm_mirror	mirror;
 };
 
-#if defined(CONFIG_HMM_MIRROR)
 void amdgpu_mn_lock(struct amdgpu_mn *mn);
 void amdgpu_mn_unlock(struct amdgpu_mn *mn);
 struct amdgpu_mn *amdgpu_mn_get(struct amdgpu_device *adev,
@@ -78,6 +79,9 @@ int amdgpu_mn_register(struct amdgpu_bo *bo, unsigned long addr);
 void amdgpu_mn_unregister(struct amdgpu_bo *bo);
 void amdgpu_hmm_init_range(struct hmm_range *range);
 #else
+
+struct amdgpu_mn;
+
 static inline void amdgpu_mn_lock(struct amdgpu_mn *mn) {}
 static inline void amdgpu_mn_unlock(struct amdgpu_mn *mn) {}
 static inline struct amdgpu_mn *amdgpu_mn_get(struct amdgpu_device *adev,
-- 
2.17.1



More information about the amd-gfx mailing list