Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1410638 > unrolled thread

[PATCH] dma-mapping: Simplify get_dma_ops() control flow

Started byBjorn Helgaas <bhelgaas@google.com>
First post2016-05-31 23:30 +0200
Last post2016-06-01 10:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] dma-mapping: Simplify get_dma_ops() control flow Bjorn Helgaas <bhelgaas@google.com> - 2016-05-31 23:30 +0200
    Re: [PATCH] dma-mapping: Simplify get_dma_ops() control flow Christoph Hellwig <hch@infradead.org> - 2016-06-01 10:00 +0200

#1410638 — [PATCH] dma-mapping: Simplify get_dma_ops() control flow

FromBjorn Helgaas <bhelgaas@google.com>
Date2016-05-31 23:30 +0200
Subject[PATCH] dma-mapping: Simplify get_dma_ops() control flow
Message-ID<rEZoC-7SC-23@gated-at.bofh.it>
Simplify code flow of get_dma_ops() by getting rid of several negations.
No functional change intended.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 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);

[toc] | [next] | [standalone]


#1410901

FromChristoph Hellwig <hch@infradead.org>
Date2016-06-01 10:00 +0200
Message-ID<rF9ei-5BV-13@gated-at.bofh.it>
In reply to#1410638
Looks fine,

Reviewed-by: Christoph Hellwig <hch@lst.de>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web