diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2013-12-13 13:01:27 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2013-12-13 13:01:27 -0500 |
commit | 1d72e71d4542d2eff16c74242f7e5dfca38fb49a (patch) | |
tree | dfdf37c552b98b9b82e1037be5037748dad3841c /arch | |
parent | 6c52f51ccbb371d9161a1081560df7d31df4c495 (diff) | |
parent | 09296c0bbbc107586a43e9ca7c7214153bbbefa6 (diff) |
Merge branch 'pci/yijing-dev_is_pci' into next
* pci/yijing-dev_is_pci:
alpha/PCI: Use dev_is_pci() to identify PCI devices
arm/PCI: Use dev_is_pci() to identify PCI devices
arm/PCI: Use dev_is_pci() to identify PCI devices
parisc/PCI: Use dev_is_pci() to identify PCI devices
sparc/PCI: Use dev_is_pci() to identify PCI devices
ia64/PCI: Use dev_is_pci() to identify PCI devices
x86/PCI: Use dev_is_pci() to identify PCI devices
PCI: Use dev_is_pci() to identify PCI devices
Diffstat (limited to 'arch')
-rw-r--r-- | arch/alpha/kernel/pci_iommu.c | 2 | ||||
-rw-r--r-- | arch/arm/common/it8152.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-ixp4xx/common-pci.c | 6 | ||||
-rw-r--r-- | arch/ia64/hp/common/sba_iommu.c | 2 | ||||
-rw-r--r-- | arch/ia64/sn/pci/pci_dma.c | 24 | ||||
-rw-r--r-- | arch/parisc/kernel/drivers.c | 22 | ||||
-rw-r--r-- | arch/sparc/kernel/iommu.c | 2 | ||||
-rw-r--r-- | arch/sparc/kernel/ioport.c | 5 | ||||
-rw-r--r-- | arch/x86/kernel/acpi/boot.c | 4 |
9 files changed, 28 insertions, 43 deletions
diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c index a21d0ab3b19e..eddee7720343 100644 --- a/arch/alpha/kernel/pci_iommu.c +++ b/arch/alpha/kernel/pci_iommu.c | |||
@@ -325,7 +325,7 @@ pci_map_single_1(struct pci_dev *pdev, void *cpu_addr, size_t size, | |||
325 | /* Helper for generic DMA-mapping functions. */ | 325 | /* Helper for generic DMA-mapping functions. */ |
326 | static struct pci_dev *alpha_gendev_to_pci(struct device *dev) | 326 | static struct pci_dev *alpha_gendev_to_pci(struct device *dev) |
327 | { | 327 | { |
328 | if (dev && dev->bus == &pci_bus_type) | 328 | if (dev && dev_is_pci(dev)) |
329 | return to_pci_dev(dev); | 329 | return to_pci_dev(dev); |
330 | 330 | ||
331 | /* Assume that non-PCI devices asking for DMA are either ISA or EISA, | 331 | /* Assume that non-PCI devices asking for DMA are either ISA or EISA, |
diff --git a/arch/arm/common/it8152.c b/arch/arm/common/it8152.c index 001f4913799c..5114b68e99d5 100644 --- a/arch/arm/common/it8152.c +++ b/arch/arm/common/it8152.c | |||
@@ -257,7 +257,7 @@ static int it8152_needs_bounce(struct device *dev, dma_addr_t dma_addr, size_t s | |||
257 | */ | 257 | */ |
258 | static int it8152_pci_platform_notify(struct device *dev) | 258 | static int it8152_pci_platform_notify(struct device *dev) |
259 | { | 259 | { |
260 | if (dev->bus == &pci_bus_type) { | 260 | if (dev_is_pci(dev)) { |
261 | if (dev->dma_mask) | 261 | if (dev->dma_mask) |
262 | *dev->dma_mask = (SZ_64M - 1) | PHYS_OFFSET; | 262 | *dev->dma_mask = (SZ_64M - 1) | PHYS_OFFSET; |
263 | dev->coherent_dma_mask = (SZ_64M - 1) | PHYS_OFFSET; | 263 | dev->coherent_dma_mask = (SZ_64M - 1) | PHYS_OFFSET; |
@@ -268,7 +268,7 @@ static int it8152_pci_platform_notify(struct device *dev) | |||
268 | 268 | ||
269 | static int it8152_pci_platform_notify_remove(struct device *dev) | 269 | static int it8152_pci_platform_notify_remove(struct device *dev) |
270 | { | 270 | { |
271 | if (dev->bus == &pci_bus_type) | 271 | if (dev_is_pci(dev)) |
272 | dmabounce_unregister_dev(dev); | 272 | dmabounce_unregister_dev(dev); |
273 | 273 | ||
274 | return 0; | 274 | return 0; |
diff --git a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c index 6d6bde3e15fa..200970d56f6d 100644 --- a/arch/arm/mach-ixp4xx/common-pci.c +++ b/arch/arm/mach-ixp4xx/common-pci.c | |||
@@ -326,7 +326,7 @@ static int ixp4xx_needs_bounce(struct device *dev, dma_addr_t dma_addr, size_t s | |||
326 | */ | 326 | */ |
327 | static int ixp4xx_pci_platform_notify(struct device *dev) | 327 | static int ixp4xx_pci_platform_notify(struct device *dev) |
328 | { | 328 | { |
329 | if(dev->bus == &pci_bus_type) { | 329 | if (dev_is_pci(dev)) { |
330 | *dev->dma_mask = SZ_64M - 1; | 330 | *dev->dma_mask = SZ_64M - 1; |
331 | dev->coherent_dma_mask = SZ_64M - 1; | 331 | dev->coherent_dma_mask = SZ_64M - 1; |
332 | dmabounce_register_dev(dev, 2048, 4096, ixp4xx_needs_bounce); | 332 | dmabounce_register_dev(dev, 2048, 4096, ixp4xx_needs_bounce); |
@@ -336,9 +336,9 @@ static int ixp4xx_pci_platform_notify(struct device *dev) | |||
336 | 336 | ||
337 | static int ixp4xx_pci_platform_notify_remove(struct device *dev) | 337 | static int ixp4xx_pci_platform_notify_remove(struct device *dev) |
338 | { | 338 | { |
339 | if(dev->bus == &pci_bus_type) { | 339 | if (dev_is_pci(dev)) |
340 | dmabounce_unregister_dev(dev); | 340 | dmabounce_unregister_dev(dev); |
341 | } | 341 | |
342 | return 0; | 342 | return 0; |
343 | } | 343 | } |
344 | 344 | ||
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 | */ |
35 | static int sn_dma_supported(struct device *dev, u64 mask) | 35 | static 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 | */ |
51 | int sn_dma_set_mask(struct device *dev, u64 dma_mask) | 51 | int 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, | |||
323 | static void sn_dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, | 323 | static 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 | ||
329 | static void sn_dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, | 329 | static 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 | ||
336 | static void sn_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, | 336 | static 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 | ||
342 | static void sn_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, | 342 | static 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 | ||
348 | static int sn_dma_mapping_error(struct device *dev, dma_addr_t dma_addr) | 348 | static int sn_dma_mapping_error(struct device *dev, dma_addr_t dma_addr) |
diff --git a/arch/parisc/kernel/drivers.c b/arch/parisc/kernel/drivers.c index 14285caec71a..dba508fe1683 100644 --- a/arch/parisc/kernel/drivers.c +++ b/arch/parisc/kernel/drivers.c | |||
@@ -282,18 +282,6 @@ find_pa_parent_type(const struct parisc_device *padev, int type) | |||
282 | return NULL; | 282 | return NULL; |
283 | } | 283 | } |
284 | 284 | ||
285 | #ifdef CONFIG_PCI | ||
286 | static inline int is_pci_dev(struct device *dev) | ||
287 | { | ||
288 | return dev->bus == &pci_bus_type; | ||
289 | } | ||
290 | #else | ||
291 | static inline int is_pci_dev(struct device *dev) | ||
292 | { | ||
293 | return 0; | ||
294 | } | ||
295 | #endif | ||
296 | |||
297 | /* | 285 | /* |
298 | * get_node_path fills in @path with the firmware path to the device. | 286 | * get_node_path fills in @path with the firmware path to the device. |
299 | * Note that if @node is a parisc device, we don't fill in the 'mod' field. | 287 | * Note that if @node is a parisc device, we don't fill in the 'mod' field. |
@@ -306,7 +294,7 @@ static void get_node_path(struct device *dev, struct hardware_path *path) | |||
306 | int i = 5; | 294 | int i = 5; |
307 | memset(&path->bc, -1, 6); | 295 | memset(&path->bc, -1, 6); |
308 | 296 | ||
309 | if (is_pci_dev(dev)) { | 297 | if (dev_is_pci(dev)) { |
310 | unsigned int devfn = to_pci_dev(dev)->devfn; | 298 | unsigned int devfn = to_pci_dev(dev)->devfn; |
311 | path->mod = PCI_FUNC(devfn); | 299 | path->mod = PCI_FUNC(devfn); |
312 | path->bc[i--] = PCI_SLOT(devfn); | 300 | path->bc[i--] = PCI_SLOT(devfn); |
@@ -314,7 +302,7 @@ static void get_node_path(struct device *dev, struct hardware_path *path) | |||
314 | } | 302 | } |
315 | 303 | ||
316 | while (dev != &root) { | 304 | while (dev != &root) { |
317 | if (is_pci_dev(dev)) { | 305 | if (dev_is_pci(dev)) { |
318 | unsigned int devfn = to_pci_dev(dev)->devfn; | 306 | unsigned int devfn = to_pci_dev(dev)->devfn; |
319 | path->bc[i--] = PCI_SLOT(devfn) | (PCI_FUNC(devfn)<< 5); | 307 | path->bc[i--] = PCI_SLOT(devfn) | (PCI_FUNC(devfn)<< 5); |
320 | } else if (dev->bus == &parisc_bus_type) { | 308 | } else if (dev->bus == &parisc_bus_type) { |
@@ -695,7 +683,7 @@ static int check_parent(struct device * dev, void * data) | |||
695 | if (dev->bus == &parisc_bus_type) { | 683 | if (dev->bus == &parisc_bus_type) { |
696 | if (match_parisc_device(dev, d->index, d->modpath)) | 684 | if (match_parisc_device(dev, d->index, d->modpath)) |
697 | d->dev = dev; | 685 | d->dev = dev; |
698 | } else if (is_pci_dev(dev)) { | 686 | } else if (dev_is_pci(dev)) { |
699 | if (match_pci_device(dev, d->index, d->modpath)) | 687 | if (match_pci_device(dev, d->index, d->modpath)) |
700 | d->dev = dev; | 688 | d->dev = dev; |
701 | } else if (dev->bus == NULL) { | 689 | } else if (dev->bus == NULL) { |
@@ -753,7 +741,7 @@ struct device *hwpath_to_device(struct hardware_path *modpath) | |||
753 | if (!parent) | 741 | if (!parent) |
754 | return NULL; | 742 | return NULL; |
755 | } | 743 | } |
756 | if (is_pci_dev(parent)) /* pci devices already parse MOD */ | 744 | if (dev_is_pci(parent)) /* pci devices already parse MOD */ |
757 | return parent; | 745 | return parent; |
758 | else | 746 | else |
759 | return parse_tree_node(parent, 6, modpath); | 747 | return parse_tree_node(parent, 6, modpath); |
@@ -772,7 +760,7 @@ void device_to_hwpath(struct device *dev, struct hardware_path *path) | |||
772 | padev = to_parisc_device(dev); | 760 | padev = to_parisc_device(dev); |
773 | get_node_path(dev->parent, path); | 761 | get_node_path(dev->parent, path); |
774 | path->mod = padev->hw_path; | 762 | path->mod = padev->hw_path; |
775 | } else if (is_pci_dev(dev)) { | 763 | } else if (dev_is_pci(dev)) { |
776 | get_node_path(dev, path); | 764 | get_node_path(dev, path); |
777 | } | 765 | } |
778 | } | 766 | } |
diff --git a/arch/sparc/kernel/iommu.c b/arch/sparc/kernel/iommu.c index 070ed141aac7..76663b019eb5 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) | |||
854 | return 1; | 854 | return 1; |
855 | 855 | ||
856 | #ifdef CONFIG_PCI | 856 | #ifdef CONFIG_PCI |
857 | if (dev->bus == &pci_bus_type) | 857 | if (dev_is_pci(dev)) |
858 | return pci64_dma_supported(to_pci_dev(dev), device_mask); | 858 | return pci64_dma_supported(to_pci_dev(dev), device_mask); |
859 | #endif | 859 | #endif |
860 | 860 | ||
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c index 2096468de9b2..e7e215dfa866 100644 --- a/arch/sparc/kernel/ioport.c +++ b/arch/sparc/kernel/ioport.c | |||
@@ -666,10 +666,9 @@ EXPORT_SYMBOL(dma_ops); | |||
666 | */ | 666 | */ |
667 | int dma_supported(struct device *dev, u64 mask) | 667 | int dma_supported(struct device *dev, u64 mask) |
668 | { | 668 | { |
669 | #ifdef CONFIG_PCI | 669 | if (dev_is_pci(dev)) |
670 | if (dev->bus == &pci_bus_type) | ||
671 | return 1; | 670 | return 1; |
672 | #endif | 671 | |
673 | return 0; | 672 | return 0; |
674 | } | 673 | } |
675 | EXPORT_SYMBOL(dma_supported); | 674 | EXPORT_SYMBOL(dma_supported); |
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 6c0b43bd024b..d359d0fffa50 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
@@ -1034,9 +1034,7 @@ static int mp_config_acpi_gsi(struct device *dev, u32 gsi, int trigger, | |||
1034 | 1034 | ||
1035 | if (!acpi_ioapic) | 1035 | if (!acpi_ioapic) |
1036 | return 0; | 1036 | return 0; |
1037 | if (!dev) | 1037 | if (!dev || !dev_is_pci(dev)) |
1038 | return 0; | ||
1039 | if (dev->bus != &pci_bus_type) | ||
1040 | return 0; | 1038 | return 0; |
1041 | 1039 | ||
1042 | pdev = to_pci_dev(dev); | 1040 | pdev = to_pci_dev(dev); |