[PATCH] drm/amdgpu: protect chash related code under macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Shirish S <shirish.s@xxxxxxx>

The chash library is built only if CONFIG_CHASH
is enabled, however there is code in amdgpu_ih.c
which results in link error as it is not under
appropriate macro.
This patch brings chash related code in amdgpu_ih.c
under CONFIG_CHASH.

Signed-off-by: Shirish S <shirish.s at amd.com>
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c | 9 ++++++---
  1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
index f5f27e4..776c9c5 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
@@ -231,14 +231,14 @@ int amdgpu_ih_add_fault(struct amdgpu_device *adev, u64 key)
  	/* Only let the hash table fill up to 50% for best performance */
  	if (adev->irq.ih.faults->count >= (1 << (AMDGPU_PAGEFAULT_HASH_BITS-1)))
  		goto unlock_out;
-
+#ifdef CONFIG_CHASH
  	r = chash_table_copy_in(&adev->irq.ih.faults->hash, key, NULL);
  	if (!r)
  		adev->irq.ih.faults->count++;
  
  	/* chash_table_copy_in should never fail unless we're losing count */
  	WARN_ON_ONCE(r < 0);
-
+#endif
  unlock_out:
  	spin_unlock_irqrestore(&adev->irq.ih.faults->lock, flags);
  	return r;
@@ -256,12 +256,14 @@ int amdgpu_ih_add_fault(struct amdgpu_device *adev, u64 key)
   */
  void amdgpu_ih_clear_fault(struct amdgpu_device *adev, u64 key)
  {
+#ifdef CONFIG_CHASH
  	unsigned long flags;
  	int r;
-
+#endif
  	if (!adev->irq.ih.faults)
  		return;
  
+#ifdef CONFIG_CHASH
  	spin_lock_irqsave(&adev->irq.ih.faults->lock, flags);
  
  	r = chash_table_remove(&adev->irq.ih.faults->hash, key, NULL);
@@ -271,4 +273,5 @@ void amdgpu_ih_clear_fault(struct amdgpu_device *adev, u64 key)
  	}
  
  	spin_unlock_irqrestore(&adev->irq.ih.faults->lock, flags);
+#endif
  }
-- 
2.7.4



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux