aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYijing Wang <wangyijing@huawei.com>2013-12-05 06:56:39 -0500
committerBjorn Helgaas <bhelgaas@google.com>2013-12-09 18:50:22 -0500
commitc7797d67ceaf33f5f28017d588a15d2c64ab309e (patch)
tree80186549d2a35106e3d7756cf67ecb05accb0a3d
parent894d33437872d974c636da55563a8474fa6713c5 (diff)
ia64/PCI: Use dev_is_pci() to identify PCI devices
Use dev_is_pci() instead of checking bus type directly. Signed-off-by: Yijing Wang <wangyijing@huawei.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r--arch/ia64/hp/common/sba_iommu.c2
-rw-r--r--arch/ia64/sn/pci/pci_dma.c24
2 files changed, 13 insertions, 13 deletions
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index 4c530a82fc46..8e858b593e4f 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -255,7 +255,7 @@ static u64 prefetch_spill_page;
255#endif 255#endif
256 256
257#ifdef CONFIG_PCI 257#ifdef CONFIG_PCI
258# define GET_IOC(dev) (((dev)->bus == &pci_bus_type) \ 258# define GET_IOC(dev) ((dev_is_pci(dev)) \
259 ? ((struct ioc *) PCI_CONTROLLER(to_pci_dev(dev))->iommu) : NULL) 259 ? ((struct ioc *) PCI_CONTROLLER(to_pci_dev(dev))->iommu) : NULL)
260#else 260#else
261# define GET_IOC(dev) NULL 261# define GET_IOC(dev) NULL
diff --git a/arch/ia64/sn/pci/pci_dma.c b/arch/ia64/sn/pci/pci_dma.c
index 3290d6e00c31..d0853e8e8623 100644
--- a/arch/ia64/sn/pci/pci_dma.c
+++ b/arch/ia64/sn/pci/pci_dma.c
@@ -34,7 +34,7 @@
34 */ 34 */
35static int sn_dma_supported(struct device *dev, u64 mask) 35static int sn_dma_supported(struct device *dev, u64 mask)
36{ 36{
37 BUG_ON(dev->bus != &pci_bus_type); 37 BUG_ON(!dev_is_pci(dev));
38 38
39 if (mask < 0x7fffffff) 39 if (mask < 0x7fffffff)
40 return 0; 40 return 0;
@@ -50,7 +50,7 @@ static int sn_dma_supported(struct device *dev, u64 mask)
50 */ 50 */
51int sn_dma_set_mask(struct device *dev, u64 dma_mask) 51int sn_dma_set_mask(struct device *dev, u64 dma_mask)
52{ 52{
53 BUG_ON(dev->bus != &pci_bus_type); 53 BUG_ON(!dev_is_pci(dev));
54 54
55 if (!sn_dma_supported(dev, dma_mask)) 55 if (!sn_dma_supported(dev, dma_mask))
56 return 0; 56 return 0;
@@ -85,7 +85,7 @@ static void *sn_dma_alloc_coherent(struct device *dev, size_t size,
85 struct pci_dev *pdev = to_pci_dev(dev); 85 struct pci_dev *pdev = to_pci_dev(dev);
86 struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev); 86 struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev);
87 87
88 BUG_ON(dev->bus != &pci_bus_type); 88 BUG_ON(!dev_is_pci(dev));
89 89
90 /* 90 /*
91 * Allocate the memory. 91 * Allocate the memory.
@@ -143,7 +143,7 @@ static void sn_dma_free_coherent(struct device *dev, size_t size, void *cpu_addr
143 struct pci_dev *pdev = to_pci_dev(dev); 143 struct pci_dev *pdev = to_pci_dev(dev);
144 struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev); 144 struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev);
145 145
146 BUG_ON(dev->bus != &pci_bus_type); 146 BUG_ON(!dev_is_pci(dev));
147 147
148 provider->dma_unmap(pdev, dma_handle, 0); 148 provider->dma_unmap(pdev, dma_handle, 0);
149 free_pages((unsigned long)cpu_addr, get_order(size)); 149 free_pages((unsigned long)cpu_addr, get_order(size));
@@ -187,7 +187,7 @@ static dma_addr_t sn_dma_map_page(struct device *dev, struct page *page,
187 187
188 dmabarr = dma_get_attr(DMA_ATTR_WRITE_BARRIER, attrs); 188 dmabarr = dma_get_attr(DMA_ATTR_WRITE_BARRIER, attrs);
189 189
190 BUG_ON(dev->bus != &pci_bus_type); 190 BUG_ON(!dev_is_pci(dev));
191 191
192 phys_addr = __pa(cpu_addr); 192 phys_addr = __pa(cpu_addr);
193 if (dmabarr) 193 if (dmabarr)
@@ -223,7 +223,7 @@ static void sn_dma_unmap_page(struct device *dev, dma_addr_t dma_addr,
223 struct pci_dev *pdev = to_pci_dev(dev); 223 struct pci_dev *pdev = to_pci_dev(dev);
224 struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev); 224 struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev);
225 225
226 BUG_ON(dev->bus != &pci_bus_type); 226 BUG_ON(!dev_is_pci(dev));
227 227
228 provider->dma_unmap(pdev, dma_addr, dir); 228 provider->dma_unmap(pdev, dma_addr, dir);
229} 229}
@@ -247,7 +247,7 @@ static void sn_dma_unmap_sg(struct device *dev, struct scatterlist *sgl,
247 struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev); 247 struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev);
248 struct scatterlist *sg; 248 struct scatterlist *sg;
249 249
250 BUG_ON(dev->bus != &pci_bus_type); 250 BUG_ON(!dev_is_pci(dev));
251 251
252 for_each_sg(sgl, sg, nhwentries, i) { 252 for_each_sg(sgl, sg, nhwentries, i) {
253 provider->dma_unmap(pdev, sg->dma_address, dir); 253 provider->dma_unmap(pdev, sg->dma_address, dir);
@@ -284,7 +284,7 @@ static int sn_dma_map_sg(struct device *dev, struct scatterlist *sgl,
284 284
285 dmabarr = dma_get_attr(DMA_ATTR_WRITE_BARRIER, attrs); 285 dmabarr = dma_get_attr(DMA_ATTR_WRITE_BARRIER, attrs);
286 286
287 BUG_ON(dev->bus != &pci_bus_type); 287 BUG_ON(!dev_is_pci(dev));
288 288
289 /* 289 /*
290 * Setup a DMA address for each entry in the scatterlist. 290 * Setup a DMA address for each entry in the scatterlist.
@@ -323,26 +323,26 @@ static int sn_dma_map_sg(struct device *dev, struct scatterlist *sgl,
323static void sn_dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, 323static void sn_dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
324 size_t size, enum dma_data_direction dir) 324 size_t size, enum dma_data_direction dir)
325{ 325{
326 BUG_ON(dev->bus != &pci_bus_type); 326 BUG_ON(!dev_is_pci(dev));
327} 327}
328 328
329static void sn_dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, 329static void sn_dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
330 size_t size, 330 size_t size,
331 enum dma_data_direction dir) 331 enum dma_data_direction dir)
332{ 332{
333 BUG_ON(dev->bus != &pci_bus_type); 333 BUG_ON(!dev_is_pci(dev));
334} 334}
335 335
336static void sn_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, 336static void sn_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
337 int nelems, enum dma_data_direction dir) 337 int nelems, enum dma_data_direction dir)
338{ 338{
339 BUG_ON(dev->bus != &pci_bus_type); 339 BUG_ON(!dev_is_pci(dev));
340} 340}
341 341
342static void sn_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, 342static void sn_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
343 int nelems, enum dma_data_direction dir) 343 int nelems, enum dma_data_direction dir)
344{ 344{
345 BUG_ON(dev->bus != &pci_bus_type); 345 BUG_ON(!dev_is_pci(dev));
346} 346}
347 347
348static int sn_dma_mapping_error(struct device *dev, dma_addr_t dma_addr) 348static int sn_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)