[PATCH] dma-mapping: Simplify get_dma_ops() control flow
From: Bjorn Helgaas
Date: Tue May 31 2016 - 17:27:18 EST
Simplify code flow of get_dma_ops() by getting rid of several negations.
No functional change intended.
Signed-off-by: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
---
arch/x86/include/asm/dma-mapping.h | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h
index 3a27b93..96db8ea 100644
--- a/arch/x86/include/asm/dma-mapping.h
+++ b/arch/x86/include/asm/dma-mapping.h
@@ -30,14 +30,11 @@ extern struct dma_map_ops *dma_ops;
static inline struct dma_map_ops *get_dma_ops(struct device *dev)
{
-#ifndef CONFIG_X86_DEV_DMA_OPS
- return dma_ops;
-#else
- if (unlikely(!dev) || !dev->archdata.dma_ops)
- return dma_ops;
- else
+#ifdef CONFIG_X86_DEV_DMA_OPS
+ if (likely(dev) && dev->archdata.dma_ops)
return dev->archdata.dma_ops;
#endif
+ return dma_ops;
}
bool arch_dma_alloc_attrs(struct device **dev, gfp_t *gfp);