Commit c7797d67 authored by Yijing Wang's avatar Yijing Wang Committed by Bjorn Helgaas

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

Use dev_is_pci() instead of checking bus type directly.
Signed-off-by: default avatarYijing Wang <wangyijing@huawei.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent 894d3343
...@@ -255,7 +255,7 @@ static u64 prefetch_spill_page; ...@@ -255,7 +255,7 @@ static u64 prefetch_spill_page;
#endif #endif
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
# define GET_IOC(dev) (((dev)->bus == &pci_bus_type) \ # define GET_IOC(dev) ((dev_is_pci(dev)) \
? ((struct ioc *) PCI_CONTROLLER(to_pci_dev(dev))->iommu) : NULL) ? ((struct ioc *) PCI_CONTROLLER(to_pci_dev(dev))->iommu) : NULL)
#else #else
# define GET_IOC(dev) NULL # define GET_IOC(dev) NULL
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
*/ */
static int sn_dma_supported(struct device *dev, u64 mask) static int sn_dma_supported(struct device *dev, u64 mask)
{ {
BUG_ON(dev->bus != &pci_bus_type); BUG_ON(!dev_is_pci(dev));
if (mask < 0x7fffffff) if (mask < 0x7fffffff)
return 0; return 0;
...@@ -50,7 +50,7 @@ static int sn_dma_supported(struct device *dev, u64 mask) ...@@ -50,7 +50,7 @@ static int sn_dma_supported(struct device *dev, u64 mask)
*/ */
int sn_dma_set_mask(struct device *dev, u64 dma_mask) int sn_dma_set_mask(struct device *dev, u64 dma_mask)
{ {
BUG_ON(dev->bus != &pci_bus_type); BUG_ON(!dev_is_pci(dev));
if (!sn_dma_supported(dev, dma_mask)) if (!sn_dma_supported(dev, dma_mask))
return 0; return 0;
...@@ -85,7 +85,7 @@ static void *sn_dma_alloc_coherent(struct device *dev, size_t size, ...@@ -85,7 +85,7 @@ static void *sn_dma_alloc_coherent(struct device *dev, size_t size,
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev); struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev);
BUG_ON(dev->bus != &pci_bus_type); BUG_ON(!dev_is_pci(dev));
/* /*
* Allocate the memory. * Allocate the memory.
...@@ -143,7 +143,7 @@ static void sn_dma_free_coherent(struct device *dev, size_t size, void *cpu_addr ...@@ -143,7 +143,7 @@ static void sn_dma_free_coherent(struct device *dev, size_t size, void *cpu_addr
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev); struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev);
BUG_ON(dev->bus != &pci_bus_type); BUG_ON(!dev_is_pci(dev));
provider->dma_unmap(pdev, dma_handle, 0); provider->dma_unmap(pdev, dma_handle, 0);
free_pages((unsigned long)cpu_addr, get_order(size)); 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,7 +187,7 @@ static dma_addr_t sn_dma_map_page(struct device *dev, struct page *page,
dmabarr = dma_get_attr(DMA_ATTR_WRITE_BARRIER, attrs); dmabarr = dma_get_attr(DMA_ATTR_WRITE_BARRIER, attrs);
BUG_ON(dev->bus != &pci_bus_type); BUG_ON(!dev_is_pci(dev));
phys_addr = __pa(cpu_addr); phys_addr = __pa(cpu_addr);
if (dmabarr) if (dmabarr)
...@@ -223,7 +223,7 @@ static void sn_dma_unmap_page(struct device *dev, dma_addr_t dma_addr, ...@@ -223,7 +223,7 @@ static void sn_dma_unmap_page(struct device *dev, dma_addr_t dma_addr,
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev); struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev);
BUG_ON(dev->bus != &pci_bus_type); BUG_ON(!dev_is_pci(dev));
provider->dma_unmap(pdev, dma_addr, dir); provider->dma_unmap(pdev, dma_addr, dir);
} }
...@@ -247,7 +247,7 @@ static void sn_dma_unmap_sg(struct device *dev, struct scatterlist *sgl, ...@@ -247,7 +247,7 @@ static void sn_dma_unmap_sg(struct device *dev, struct scatterlist *sgl,
struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev); struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev);
struct scatterlist *sg; struct scatterlist *sg;
BUG_ON(dev->bus != &pci_bus_type); BUG_ON(!dev_is_pci(dev));
for_each_sg(sgl, sg, nhwentries, i) { for_each_sg(sgl, sg, nhwentries, i) {
provider->dma_unmap(pdev, sg->dma_address, dir); 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,7 +284,7 @@ static int sn_dma_map_sg(struct device *dev, struct scatterlist *sgl,
dmabarr = dma_get_attr(DMA_ATTR_WRITE_BARRIER, attrs); dmabarr = dma_get_attr(DMA_ATTR_WRITE_BARRIER, attrs);
BUG_ON(dev->bus != &pci_bus_type); BUG_ON(!dev_is_pci(dev));
/* /*
* Setup a DMA address for each entry in the scatterlist. * 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, ...@@ -323,26 +323,26 @@ static int sn_dma_map_sg(struct device *dev, struct scatterlist *sgl,
static void sn_dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, static void sn_dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
size_t size, enum dma_data_direction dir) size_t size, enum dma_data_direction dir)
{ {
BUG_ON(dev->bus != &pci_bus_type); BUG_ON(!dev_is_pci(dev));
} }
static void sn_dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, static void sn_dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
size_t size, size_t size,
enum dma_data_direction dir) enum dma_data_direction dir)
{ {
BUG_ON(dev->bus != &pci_bus_type); BUG_ON(!dev_is_pci(dev));
} }
static void sn_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, static void sn_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
int nelems, enum dma_data_direction dir) int nelems, enum dma_data_direction dir)
{ {
BUG_ON(dev->bus != &pci_bus_type); BUG_ON(!dev_is_pci(dev));
} }
static void sn_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, static void sn_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
int nelems, enum dma_data_direction dir) int nelems, enum dma_data_direction dir)
{ {
BUG_ON(dev->bus != &pci_bus_type); BUG_ON(!dev_is_pci(dev));
} }
static int sn_dma_mapping_error(struct device *dev, dma_addr_t dma_addr) static int sn_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment