* [PATCH 4/9] sparc/pci: Use dev_is_pci() to check whether it is pci device
@ 2013-12-05 11:57 Yijing Wang
0 siblings, 0 replies; only message in thread
From: Yijing Wang @ 2013-12-05 11:57 UTC (permalink / raw)
To: Bjorn Helgaas, David S. Miller
Cc: linux-pci, sparclinux, linux-kernel, Yijing Wang, Hanjun Guo
Use PCI standard marco dev_is_pci() instead of directly compare
pci_bus_type to check whether it is pci device.
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
arch/sparc/include/asm/dma-mapping.h | 10 ++++------
arch/sparc/kernel/iommu.c | 2 +-
arch/sparc/kernel/ioport.c | 4 +---
3 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/arch/sparc/include/asm/dma-mapping.h b/arch/sparc/include/asm/dma-mapping.h
index 05fe53f..751c299 100644
--- a/arch/sparc/include/asm/dma-mapping.h
+++ b/arch/sparc/include/asm/dma-mapping.h
@@ -4,6 +4,7 @@
#include <linux/scatterlist.h>
#include <linux/mm.h>
#include <linux/dma-debug.h>
+#include <linux/pci.h>
#define DMA_ERROR_CODE (~(dma_addr_t)0x0)
@@ -16,14 +17,13 @@ extern struct dma_map_ops *dma_ops;
extern struct dma_map_ops *leon_dma_ops;
extern struct dma_map_ops pci32_dma_ops;
-extern struct bus_type pci_bus_type;
static inline struct dma_map_ops *get_dma_ops(struct device *dev)
{
-#if defined(CONFIG_SPARC32) && defined(CONFIG_PCI)
+#if defined(CONFIG_SPARC32)
if (sparc_cpu_model == sparc_leon)
return leon_dma_ops;
- else if (dev->bus == &pci_bus_type)
+ else if (dev_is_pci(dev))
return &pci32_dma_ops;
#endif
return dma_ops;
@@ -65,14 +65,12 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
static inline int dma_set_mask(struct device *dev, u64 mask)
{
-#ifdef CONFIG_PCI
- if (dev->bus == &pci_bus_type) {
+ if (dev_is_pci(dev)) {
if (!dev->dma_mask || !dma_supported(dev, mask))
return -EINVAL;
*dev->dma_mask = mask;
return 0;
}
-#endif
return -EINVAL;
}
diff --git a/arch/sparc/kernel/iommu.c b/arch/sparc/kernel/iommu.c
index 070ed14..76663b0 100644
--- a/arch/sparc/kernel/iommu.c
+++ b/arch/sparc/kernel/iommu.c
@@ -854,7 +854,7 @@ int dma_supported(struct device *dev, u64 device_mask)
return 1;
#ifdef CONFIG_PCI
- if (dev->bus == &pci_bus_type)
+ if (dev_is_pci(dev))
return pci64_dma_supported(to_pci_dev(dev), device_mask);
#endif
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index 2096468..0ead3cd 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -666,10 +666,8 @@ EXPORT_SYMBOL(dma_ops);
*/
int dma_supported(struct device *dev, u64 mask)
{
-#ifdef CONFIG_PCI
- if (dev->bus == &pci_bus_type)
+ if (dev_is_pci(dev))
return 1;
-#endif
return 0;
}
EXPORT_SYMBOL(dma_supported);
--
1.7.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-12-05 11:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-05 11:57 [PATCH 4/9] sparc/pci: Use dev_is_pci() to check whether it is pci device Yijing Wang
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).