Skip to contentSkip to conversation

sparc/PCI: Use dev_is_pci() to identify PCI devices

PATCH Superseded Yijing Wang 1 participant 1 message Dec 10, 2013

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 sparc/PCI: Use dev_is_pci() to identify PCI devices

Use dev_is_pci() instead of checking bus type directly.

---

v1->v2: Keep #ifdef CONFIG_PCI code to avoid build error, found by
kbuild test.

---
 arch/sparc/include/asm/dma-mapping.h |    7 +++----
 arch/sparc/kernel/iommu.c            |    2 +-
 arch/sparc/kernel/ioport.c           |    2 +-
 3 files changed, 5 insertions(+), 6 deletions(-)
arch/sparc/include/asm/dma-mapping.h +3 -4
index 05fe53f..ab529f1 100644
@@ -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,12 @@ 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 (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;
@@ -66,7 +65,7 @@ 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;
arch/sparc/kernel/iommu.c +1 -1
index 070ed14..76663b0 100644
@@ -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
 
arch/sparc/kernel/ioport.c +1 -1
index 2096468..5b8aab9 100644
@@ -667,7 +667,7 @@ 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;
Signature · 1 line
1.7.1