Skip to contentSkip to conversation

arm: dma-mapping: Reset the device's dma_ops

PATCH Superseded Sricharan R 2 participants 2 messages Nov 17, 2016

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: dma-mapping: Reset the device's dma_ops

arch_teardown_dma_ops() being the inverse of arch_setup_dma_ops() ,dma_ops should be cleared in the teardown path. Otherwise this causes problem when the probe of device is retried after being deferred. The device's iommu structures are cleared after EPROBEDEFER error, but on the next try dma_ops will still be set to old value, which is not right.

---
 arch/arm/mm/dma-mapping.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm/mm/dma-mapping.c +1 -0
index ab4f745..a40f03e 100644
@@ -2358,6 +2358,7 @@ static void arm_teardown_iommu_dma_ops(struct device *dev)
 
 	__arm_iommu_detach_device(dev);
 	arm_iommu_release_mapping(mapping);
+	set_dma_ops(dev, NULL);
 }
 
 #else
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
#1 lore raw

PATCH 1/1 arm: dma-mapping: Reset the device's dma_ops

Hi Sricharan,

Quoted 9 lines · Sricharan R

arch_teardown_dma_ops() being the inverse of arch_setup_dma_ops() ,dma_ops should be cleared in the teardown path. Otherwise this causes problem when the probe of device is retried after being deferred. The device's iommu structures are cleared after EPROBEDEFER error, but on the next try dma_ops will still be set to old value, which is not right.

Quoted 9 lines
---
  arch/arm/mm/dma-mapping.c | 1 +
  1 file changed, 1 insertion(+)
arch/arm/mm/dma-mapping.c +0 -0
index ab4f745..a40f03e 100644

arch/arm/mm/dma-mapping.c static void arm_teardown_iommu_dma_ops(struct device *dev) · line 2364

Quoted 7 lines
arch/arm/mm/dma-mapping.c +1 -0
@@ -2358,6 +2358,7 @@ static void arm_teardown_iommu_dma_ops(struct device *dev)
 
  	__arm_iommu_detach_device(dev);
  	arm_iommu_release_mapping(mapping);
+	set_dma_ops(dev, NULL);
  }
 
  #else

Best regards

Signature · 2 lines
Marek Szyprowski, PhD
Samsung R&D Institute Poland