linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: dma-mapping: Return dma_direct_ops variable when dev == NULL
@ 2014-01-14  9:44 Chunhe Lan
  2014-01-14 10:14 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 4+ messages in thread
From: Chunhe Lan @ 2014-01-14  9:44 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Chunhe Lan

Without this patch, kind of below error will be dumped if
'insmod ixgbevf.ko' is executed:

    ixgbevf: Intel(R) 10 Gigabit PCI Express Virtual Function
             Network Driver - version 2.7.12-k
    ixgbevf: Copyright (c) 2009 - 2012 Intel Corporation.
    ixgbevf 0000:01:10.0: enabling device (0000 -> 0002)
    ixgbevf 0000:01:10.0: No usable DMA configuration, aborting
    ixgbevf: probe of 0000:01:10.0 failed with error -5
    ......
    ......

Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Tested-by: Chunhe Lan <Chunhe.Lan@freescale.com>
---
 arch/powerpc/include/asm/dma-mapping.h |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h
index e27e9ad..b8c10de 100644
--- a/arch/powerpc/include/asm/dma-mapping.h
+++ b/arch/powerpc/include/asm/dma-mapping.h
@@ -84,10 +84,15 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)
 	 * only ISA DMA device we support is the floppy and we have a hack
 	 * in the floppy driver directly to get a device for us.
 	 */
-	if (unlikely(dev == NULL))
-		return NULL;
-
-	return dev->archdata.dma_ops;
+	if (dev && dev->archdata.dma_ops)
+		return dev->archdata.dma_ops;
+	/*
+	 * In some cases (for example, use the Intel(R) 10 Gigabit PCI
+	 * expression Virtual Function Network Driver -- ixgbevf.ko),
+	 * their value of dev is the NULL. If return NULL, the driver is
+	 * aborting. So return dma_direct_ops variable when dev == NULL.
+	 */
+	return &dma_direct_ops;
 }
 
 static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops)
-- 
1.7.6.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-01-15  3:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-14  9:44 [PATCH] powerpc: dma-mapping: Return dma_direct_ops variable when dev == NULL Chunhe Lan
2014-01-14 10:14 ` Benjamin Herrenschmidt
2014-01-15  3:36   ` Chunhe Lan
2014-01-15  3:47     ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).