diff options
36 files changed, 48 insertions, 70 deletions
diff --git a/arch/arm/include/asm/device.h b/arch/arm/include/asm/device.h index d8a572f9c187..220ba207be91 100644 --- a/arch/arm/include/asm/device.h +++ b/arch/arm/include/asm/device.h | |||
@@ -7,7 +7,6 @@ | |||
7 | #define ASMARM_DEVICE_H | 7 | #define ASMARM_DEVICE_H |
8 | 8 | ||
9 | struct dev_archdata { | 9 | struct dev_archdata { |
10 | const struct dma_map_ops *dma_ops; | ||
11 | #ifdef CONFIG_DMABOUNCE | 10 | #ifdef CONFIG_DMABOUNCE |
12 | struct dmabounce_device_info *dmabounce; | 11 | struct dmabounce_device_info *dmabounce; |
13 | #endif | 12 | #endif |
diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h index 1aabd781306f..312f4d0564d6 100644 --- a/arch/arm/include/asm/dma-mapping.h +++ b/arch/arm/include/asm/dma-mapping.h | |||
@@ -18,8 +18,8 @@ extern const struct dma_map_ops arm_coherent_dma_ops; | |||
18 | 18 | ||
19 | static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev) | 19 | static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev) |
20 | { | 20 | { |
21 | if (dev && dev->archdata.dma_ops) | 21 | if (dev && dev->dma_ops) |
22 | return dev->archdata.dma_ops; | 22 | return dev->dma_ops; |
23 | return &arm_dma_ops; | 23 | return &arm_dma_ops; |
24 | } | 24 | } |
25 | 25 | ||
@@ -34,7 +34,7 @@ static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | |||
34 | static inline void set_dma_ops(struct device *dev, const struct dma_map_ops *ops) | 34 | static inline void set_dma_ops(struct device *dev, const struct dma_map_ops *ops) |
35 | { | 35 | { |
36 | BUG_ON(!dev); | 36 | BUG_ON(!dev); |
37 | dev->archdata.dma_ops = ops; | 37 | dev->dma_ops = ops; |
38 | } | 38 | } |
39 | 39 | ||
40 | #define HAVE_ARCH_DMA_SUPPORTED 1 | 40 | #define HAVE_ARCH_DMA_SUPPORTED 1 |
diff --git a/arch/arm64/include/asm/device.h b/arch/arm64/include/asm/device.h index 00c678cc31e1..73d5bab015eb 100644 --- a/arch/arm64/include/asm/device.h +++ b/arch/arm64/include/asm/device.h | |||
@@ -17,7 +17,6 @@ | |||
17 | #define __ASM_DEVICE_H | 17 | #define __ASM_DEVICE_H |
18 | 18 | ||
19 | struct dev_archdata { | 19 | struct dev_archdata { |
20 | const struct dma_map_ops *dma_ops; | ||
21 | #ifdef CONFIG_IOMMU_API | 20 | #ifdef CONFIG_IOMMU_API |
22 | void *iommu; /* private IOMMU data */ | 21 | void *iommu; /* private IOMMU data */ |
23 | #endif | 22 | #endif |
diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h index 1fedb43be712..58ae36cc3b60 100644 --- a/arch/arm64/include/asm/dma-mapping.h +++ b/arch/arm64/include/asm/dma-mapping.h | |||
@@ -29,8 +29,8 @@ extern const struct dma_map_ops dummy_dma_ops; | |||
29 | 29 | ||
30 | static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev) | 30 | static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev) |
31 | { | 31 | { |
32 | if (dev && dev->archdata.dma_ops) | 32 | if (dev && dev->dma_ops) |
33 | return dev->archdata.dma_ops; | 33 | return dev->dma_ops; |
34 | 34 | ||
35 | /* | 35 | /* |
36 | * We expect no ISA devices, and all other DMA masters are expected to | 36 | * We expect no ISA devices, and all other DMA masters are expected to |
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c index bcef6368d48f..dbab4c6c084b 100644 --- a/arch/arm64/mm/dma-mapping.c +++ b/arch/arm64/mm/dma-mapping.c | |||
@@ -837,7 +837,7 @@ static bool do_iommu_attach(struct device *dev, const struct iommu_ops *ops, | |||
837 | return false; | 837 | return false; |
838 | } | 838 | } |
839 | 839 | ||
840 | dev->archdata.dma_ops = &iommu_dma_ops; | 840 | dev->dma_ops = &iommu_dma_ops; |
841 | return true; | 841 | return true; |
842 | } | 842 | } |
843 | 843 | ||
@@ -941,7 +941,7 @@ static void __iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, | |||
941 | 941 | ||
942 | void arch_teardown_dma_ops(struct device *dev) | 942 | void arch_teardown_dma_ops(struct device *dev) |
943 | { | 943 | { |
944 | dev->archdata.dma_ops = NULL; | 944 | dev->dma_ops = NULL; |
945 | } | 945 | } |
946 | 946 | ||
947 | #else | 947 | #else |
@@ -955,8 +955,8 @@ static void __iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, | |||
955 | void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, | 955 | void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, |
956 | const struct iommu_ops *iommu, bool coherent) | 956 | const struct iommu_ops *iommu, bool coherent) |
957 | { | 957 | { |
958 | if (!dev->archdata.dma_ops) | 958 | if (!dev->dma_ops) |
959 | dev->archdata.dma_ops = &swiotlb_dma_ops; | 959 | dev->dma_ops = &swiotlb_dma_ops; |
960 | 960 | ||
961 | dev->archdata.dma_coherent = coherent; | 961 | dev->archdata.dma_coherent = coherent; |
962 | __iommu_setup_dma_ops(dev, dma_base, size, iommu); | 962 | __iommu_setup_dma_ops(dev, dma_base, size, iommu); |
diff --git a/arch/m32r/include/asm/device.h b/arch/m32r/include/asm/device.h index 7955a9799466..5203fc87f080 100644 --- a/arch/m32r/include/asm/device.h +++ b/arch/m32r/include/asm/device.h | |||
@@ -4,7 +4,6 @@ | |||
4 | * This file is released under the GPLv2 | 4 | * This file is released under the GPLv2 |
5 | */ | 5 | */ |
6 | struct dev_archdata { | 6 | struct dev_archdata { |
7 | const struct dma_map_ops *dma_ops; | ||
8 | }; | 7 | }; |
9 | 8 | ||
10 | struct pdev_archdata { | 9 | struct pdev_archdata { |
diff --git a/arch/m32r/include/asm/dma-mapping.h b/arch/m32r/include/asm/dma-mapping.h index 99c43d2f05dc..27b1597ac563 100644 --- a/arch/m32r/include/asm/dma-mapping.h +++ b/arch/m32r/include/asm/dma-mapping.h | |||
@@ -12,8 +12,8 @@ | |||
12 | 12 | ||
13 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 13 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) |
14 | { | 14 | { |
15 | if (dev && dev->archdata.dma_ops) | 15 | if (dev && dev->dma_ops) |
16 | return dev->archdata.dma_ops; | 16 | return dev->dma_ops; |
17 | return &dma_noop_ops; | 17 | return &dma_noop_ops; |
18 | } | 18 | } |
19 | 19 | ||
diff --git a/arch/mips/include/asm/device.h b/arch/mips/include/asm/device.h index ebc5c1265473..6aa796f1081a 100644 --- a/arch/mips/include/asm/device.h +++ b/arch/mips/include/asm/device.h | |||
@@ -6,12 +6,7 @@ | |||
6 | #ifndef _ASM_MIPS_DEVICE_H | 6 | #ifndef _ASM_MIPS_DEVICE_H |
7 | #define _ASM_MIPS_DEVICE_H | 7 | #define _ASM_MIPS_DEVICE_H |
8 | 8 | ||
9 | struct dma_map_ops; | ||
10 | |||
11 | struct dev_archdata { | 9 | struct dev_archdata { |
12 | /* DMA operations on that device */ | ||
13 | const struct dma_map_ops *dma_ops; | ||
14 | |||
15 | #ifdef CONFIG_DMA_PERDEV_COHERENT | 10 | #ifdef CONFIG_DMA_PERDEV_COHERENT |
16 | /* Non-zero if DMA is coherent with CPU caches */ | 11 | /* Non-zero if DMA is coherent with CPU caches */ |
17 | bool dma_coherent; | 12 | bool dma_coherent; |
diff --git a/arch/mips/include/asm/dma-mapping.h b/arch/mips/include/asm/dma-mapping.h index b59b084a7569..dad3b09fe993 100644 --- a/arch/mips/include/asm/dma-mapping.h +++ b/arch/mips/include/asm/dma-mapping.h | |||
@@ -13,8 +13,8 @@ extern const struct dma_map_ops *mips_dma_map_ops; | |||
13 | 13 | ||
14 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 14 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) |
15 | { | 15 | { |
16 | if (dev && dev->archdata.dma_ops) | 16 | if (dev && dev->dma_ops) |
17 | return dev->archdata.dma_ops; | 17 | return dev->dma_ops; |
18 | else | 18 | else |
19 | return mips_dma_map_ops; | 19 | return mips_dma_map_ops; |
20 | } | 20 | } |
diff --git a/arch/mips/pci/pci-octeon.c b/arch/mips/pci/pci-octeon.c index 308d051fc45c..9ee01936862e 100644 --- a/arch/mips/pci/pci-octeon.c +++ b/arch/mips/pci/pci-octeon.c | |||
@@ -167,7 +167,7 @@ int pcibios_plat_dev_init(struct pci_dev *dev) | |||
167 | pci_write_config_dword(dev, pos + PCI_ERR_ROOT_STATUS, dconfig); | 167 | pci_write_config_dword(dev, pos + PCI_ERR_ROOT_STATUS, dconfig); |
168 | } | 168 | } |
169 | 169 | ||
170 | dev->dev.archdata.dma_ops = octeon_pci_dma_map_ops; | 170 | dev->dev.dma_ops = octeon_pci_dma_map_ops; |
171 | 171 | ||
172 | return 0; | 172 | return 0; |
173 | } | 173 | } |
diff --git a/arch/powerpc/include/asm/device.h b/arch/powerpc/include/asm/device.h index 49cbb0fca233..0245bfcaac32 100644 --- a/arch/powerpc/include/asm/device.h +++ b/arch/powerpc/include/asm/device.h | |||
@@ -6,7 +6,6 @@ | |||
6 | #ifndef _ASM_POWERPC_DEVICE_H | 6 | #ifndef _ASM_POWERPC_DEVICE_H |
7 | #define _ASM_POWERPC_DEVICE_H | 7 | #define _ASM_POWERPC_DEVICE_H |
8 | 8 | ||
9 | struct dma_map_ops; | ||
10 | struct device_node; | 9 | struct device_node; |
11 | #ifdef CONFIG_PPC64 | 10 | #ifdef CONFIG_PPC64 |
12 | struct pci_dn; | 11 | struct pci_dn; |
@@ -20,9 +19,6 @@ struct iommu_table; | |||
20 | * drivers/macintosh/macio_asic.c | 19 | * drivers/macintosh/macio_asic.c |
21 | */ | 20 | */ |
22 | struct dev_archdata { | 21 | struct dev_archdata { |
23 | /* DMA operations on that device */ | ||
24 | const struct dma_map_ops *dma_ops; | ||
25 | |||
26 | /* | 22 | /* |
27 | * These two used to be a union. However, with the hybrid ops we need | 23 | * These two used to be a union. However, with the hybrid ops we need |
28 | * both so here we store both a DMA offset for direct mappings and | 24 | * both so here we store both a DMA offset for direct mappings and |
diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h index 2ec3eadf336f..59fbd4abcbf8 100644 --- a/arch/powerpc/include/asm/dma-mapping.h +++ b/arch/powerpc/include/asm/dma-mapping.h | |||
@@ -88,12 +88,12 @@ static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | |||
88 | if (unlikely(dev == NULL)) | 88 | if (unlikely(dev == NULL)) |
89 | return NULL; | 89 | return NULL; |
90 | 90 | ||
91 | return dev->archdata.dma_ops; | 91 | return dev->dma_ops; |
92 | } | 92 | } |
93 | 93 | ||
94 | static inline void set_dma_ops(struct device *dev, const struct dma_map_ops *ops) | 94 | static inline void set_dma_ops(struct device *dev, const struct dma_map_ops *ops) |
95 | { | 95 | { |
96 | dev->archdata.dma_ops = ops; | 96 | dev->dma_ops = ops; |
97 | } | 97 | } |
98 | 98 | ||
99 | /* | 99 | /* |
diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c index 03b98f1f98ec..41c749586bd2 100644 --- a/arch/powerpc/kernel/dma.c +++ b/arch/powerpc/kernel/dma.c | |||
@@ -33,7 +33,7 @@ static u64 __maybe_unused get_pfn_limit(struct device *dev) | |||
33 | struct dev_archdata __maybe_unused *sd = &dev->archdata; | 33 | struct dev_archdata __maybe_unused *sd = &dev->archdata; |
34 | 34 | ||
35 | #ifdef CONFIG_SWIOTLB | 35 | #ifdef CONFIG_SWIOTLB |
36 | if (sd->max_direct_dma_addr && sd->dma_ops == &swiotlb_dma_ops) | 36 | if (sd->max_direct_dma_addr && dev->dma_ops == &swiotlb_dma_ops) |
37 | pfn = min_t(u64, pfn, sd->max_direct_dma_addr >> PAGE_SHIFT); | 37 | pfn = min_t(u64, pfn, sd->max_direct_dma_addr >> PAGE_SHIFT); |
38 | #endif | 38 | #endif |
39 | 39 | ||
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c index e1413e69e5fe..71b995bbcae0 100644 --- a/arch/powerpc/platforms/cell/iommu.c +++ b/arch/powerpc/platforms/cell/iommu.c | |||
@@ -692,7 +692,7 @@ static int cell_of_bus_notify(struct notifier_block *nb, unsigned long action, | |||
692 | return 0; | 692 | return 0; |
693 | 693 | ||
694 | /* We use the PCI DMA ops */ | 694 | /* We use the PCI DMA ops */ |
695 | dev->archdata.dma_ops = get_pci_dma_ops(); | 695 | dev->dma_ops = get_pci_dma_ops(); |
696 | 696 | ||
697 | cell_dma_dev_setup(dev); | 697 | cell_dma_dev_setup(dev); |
698 | 698 | ||
diff --git a/arch/powerpc/platforms/pasemi/iommu.c b/arch/powerpc/platforms/pasemi/iommu.c index e74adc4e7fd8..7fec04de27fc 100644 --- a/arch/powerpc/platforms/pasemi/iommu.c +++ b/arch/powerpc/platforms/pasemi/iommu.c | |||
@@ -186,7 +186,7 @@ static void pci_dma_dev_setup_pasemi(struct pci_dev *dev) | |||
186 | */ | 186 | */ |
187 | if (dev->vendor == 0x1959 && dev->device == 0xa007 && | 187 | if (dev->vendor == 0x1959 && dev->device == 0xa007 && |
188 | !firmware_has_feature(FW_FEATURE_LPAR)) { | 188 | !firmware_has_feature(FW_FEATURE_LPAR)) { |
189 | dev->dev.archdata.dma_ops = &dma_direct_ops; | 189 | dev->dev.dma_ops = &dma_direct_ops; |
190 | /* | 190 | /* |
191 | * Set the coherent DMA mask to prevent the iommu | 191 | * Set the coherent DMA mask to prevent the iommu |
192 | * being used unnecessarily | 192 | * being used unnecessarily |
diff --git a/arch/powerpc/platforms/pasemi/setup.c b/arch/powerpc/platforms/pasemi/setup.c index 3182400cf48f..c4a3e93dc324 100644 --- a/arch/powerpc/platforms/pasemi/setup.c +++ b/arch/powerpc/platforms/pasemi/setup.c | |||
@@ -363,7 +363,7 @@ static int pcmcia_notify(struct notifier_block *nb, unsigned long action, | |||
363 | return 0; | 363 | return 0; |
364 | 364 | ||
365 | /* We use the direct ops for localbus */ | 365 | /* We use the direct ops for localbus */ |
366 | dev->archdata.dma_ops = &dma_direct_ops; | 366 | dev->dma_ops = &dma_direct_ops; |
367 | 367 | ||
368 | return 0; | 368 | return 0; |
369 | } | 369 | } |
diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c index c81450d98794..2d2e5f80a3d3 100644 --- a/arch/powerpc/platforms/ps3/system-bus.c +++ b/arch/powerpc/platforms/ps3/system-bus.c | |||
@@ -756,11 +756,11 @@ int ps3_system_bus_device_register(struct ps3_system_bus_device *dev) | |||
756 | 756 | ||
757 | switch (dev->dev_type) { | 757 | switch (dev->dev_type) { |
758 | case PS3_DEVICE_TYPE_IOC0: | 758 | case PS3_DEVICE_TYPE_IOC0: |
759 | dev->core.archdata.dma_ops = &ps3_ioc0_dma_ops; | 759 | dev->core.dma_ops = &ps3_ioc0_dma_ops; |
760 | dev_set_name(&dev->core, "ioc0_%02x", ++dev_ioc0_count); | 760 | dev_set_name(&dev->core, "ioc0_%02x", ++dev_ioc0_count); |
761 | break; | 761 | break; |
762 | case PS3_DEVICE_TYPE_SB: | 762 | case PS3_DEVICE_TYPE_SB: |
763 | dev->core.archdata.dma_ops = &ps3_sb_dma_ops; | 763 | dev->core.dma_ops = &ps3_sb_dma_ops; |
764 | dev_set_name(&dev->core, "sb_%02x", ++dev_sb_count); | 764 | dev_set_name(&dev->core, "sb_%02x", ++dev_sb_count); |
765 | 765 | ||
766 | break; | 766 | break; |
diff --git a/arch/powerpc/platforms/pseries/ibmebus.c b/arch/powerpc/platforms/pseries/ibmebus.c index 2e36a0b8944a..99a6bf7f3bcf 100644 --- a/arch/powerpc/platforms/pseries/ibmebus.c +++ b/arch/powerpc/platforms/pseries/ibmebus.c | |||
@@ -169,7 +169,7 @@ static int ibmebus_create_device(struct device_node *dn) | |||
169 | return -ENOMEM; | 169 | return -ENOMEM; |
170 | 170 | ||
171 | dev->dev.bus = &ibmebus_bus_type; | 171 | dev->dev.bus = &ibmebus_bus_type; |
172 | dev->dev.archdata.dma_ops = &ibmebus_dma_ops; | 172 | dev->dev.dma_ops = &ibmebus_dma_ops; |
173 | 173 | ||
174 | ret = of_device_add(dev); | 174 | ret = of_device_add(dev); |
175 | if (ret) | 175 | if (ret) |
diff --git a/arch/s390/include/asm/device.h b/arch/s390/include/asm/device.h index 7955a9799466..5203fc87f080 100644 --- a/arch/s390/include/asm/device.h +++ b/arch/s390/include/asm/device.h | |||
@@ -4,7 +4,6 @@ | |||
4 | * This file is released under the GPLv2 | 4 | * This file is released under the GPLv2 |
5 | */ | 5 | */ |
6 | struct dev_archdata { | 6 | struct dev_archdata { |
7 | const struct dma_map_ops *dma_ops; | ||
8 | }; | 7 | }; |
9 | 8 | ||
10 | struct pdev_archdata { | 9 | struct pdev_archdata { |
diff --git a/arch/s390/include/asm/dma-mapping.h b/arch/s390/include/asm/dma-mapping.h index 2776d205b1ff..a872027d0c1b 100644 --- a/arch/s390/include/asm/dma-mapping.h +++ b/arch/s390/include/asm/dma-mapping.h | |||
@@ -14,8 +14,8 @@ extern const struct dma_map_ops s390_pci_dma_ops; | |||
14 | 14 | ||
15 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 15 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) |
16 | { | 16 | { |
17 | if (dev && dev->archdata.dma_ops) | 17 | if (dev && dev->dma_ops) |
18 | return dev->archdata.dma_ops; | 18 | return dev->dma_ops; |
19 | return &dma_noop_ops; | 19 | return &dma_noop_ops; |
20 | } | 20 | } |
21 | 21 | ||
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c index 38e17d4d9884..82abef8b8574 100644 --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c | |||
@@ -641,7 +641,7 @@ int pcibios_add_device(struct pci_dev *pdev) | |||
641 | int i; | 641 | int i; |
642 | 642 | ||
643 | pdev->dev.groups = zpci_attr_groups; | 643 | pdev->dev.groups = zpci_attr_groups; |
644 | pdev->dev.archdata.dma_ops = &s390_pci_dma_ops; | 644 | pdev->dev.dma_ops = &s390_pci_dma_ops; |
645 | zpci_map_resources(pdev); | 645 | zpci_map_resources(pdev); |
646 | 646 | ||
647 | for (i = 0; i < PCI_BAR_COUNT; i++) { | 647 | for (i = 0; i < PCI_BAR_COUNT; i++) { |
diff --git a/arch/tile/include/asm/device.h b/arch/tile/include/asm/device.h index 25f23ac7d361..1cf45422a0df 100644 --- a/arch/tile/include/asm/device.h +++ b/arch/tile/include/asm/device.h | |||
@@ -17,9 +17,6 @@ | |||
17 | #define _ASM_TILE_DEVICE_H | 17 | #define _ASM_TILE_DEVICE_H |
18 | 18 | ||
19 | struct dev_archdata { | 19 | struct dev_archdata { |
20 | /* DMA operations on that device */ | ||
21 | const struct dma_map_ops *dma_ops; | ||
22 | |||
23 | /* Offset of the DMA address from the PA. */ | 20 | /* Offset of the DMA address from the PA. */ |
24 | dma_addr_t dma_offset; | 21 | dma_addr_t dma_offset; |
25 | 22 | ||
diff --git a/arch/tile/include/asm/dma-mapping.h b/arch/tile/include/asm/dma-mapping.h index 4a06cc75b856..c0620697eaad 100644 --- a/arch/tile/include/asm/dma-mapping.h +++ b/arch/tile/include/asm/dma-mapping.h | |||
@@ -31,8 +31,8 @@ extern const struct dma_map_ops *gx_hybrid_pci_dma_map_ops; | |||
31 | 31 | ||
32 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 32 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) |
33 | { | 33 | { |
34 | if (dev && dev->archdata.dma_ops) | 34 | if (dev && dev->dma_ops) |
35 | return dev->archdata.dma_ops; | 35 | return dev->dma_ops; |
36 | else | 36 | else |
37 | return tile_dma_map_ops; | 37 | return tile_dma_map_ops; |
38 | } | 38 | } |
@@ -61,7 +61,7 @@ static inline void dma_mark_clean(void *addr, size_t size) {} | |||
61 | 61 | ||
62 | static inline void set_dma_ops(struct device *dev, const struct dma_map_ops *ops) | 62 | static inline void set_dma_ops(struct device *dev, const struct dma_map_ops *ops) |
63 | { | 63 | { |
64 | dev->archdata.dma_ops = ops; | 64 | dev->dma_ops = ops; |
65 | } | 65 | } |
66 | 66 | ||
67 | static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) | 67 | static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) |
diff --git a/arch/x86/include/asm/device.h b/arch/x86/include/asm/device.h index b2d0b4ced7e3..1b3ef26e77df 100644 --- a/arch/x86/include/asm/device.h +++ b/arch/x86/include/asm/device.h | |||
@@ -2,9 +2,6 @@ | |||
2 | #define _ASM_X86_DEVICE_H | 2 | #define _ASM_X86_DEVICE_H |
3 | 3 | ||
4 | struct dev_archdata { | 4 | struct dev_archdata { |
5 | #ifdef CONFIG_X86_DEV_DMA_OPS | ||
6 | const struct dma_map_ops *dma_ops; | ||
7 | #endif | ||
8 | #if defined(CONFIG_INTEL_IOMMU) || defined(CONFIG_AMD_IOMMU) | 5 | #if defined(CONFIG_INTEL_IOMMU) || defined(CONFIG_AMD_IOMMU) |
9 | void *iommu; /* hook for IOMMU specific extension */ | 6 | void *iommu; /* hook for IOMMU specific extension */ |
10 | #endif | 7 | #endif |
diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h index 5e4772886a1e..94b5b96966cb 100644 --- a/arch/x86/include/asm/dma-mapping.h +++ b/arch/x86/include/asm/dma-mapping.h | |||
@@ -32,10 +32,10 @@ static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | |||
32 | #ifndef CONFIG_X86_DEV_DMA_OPS | 32 | #ifndef CONFIG_X86_DEV_DMA_OPS |
33 | return dma_ops; | 33 | return dma_ops; |
34 | #else | 34 | #else |
35 | if (unlikely(!dev) || !dev->archdata.dma_ops) | 35 | if (unlikely(!dev) || !dev->dma_ops) |
36 | return dma_ops; | 36 | return dma_ops; |
37 | else | 37 | else |
38 | return dev->archdata.dma_ops; | 38 | return dev->dma_ops; |
39 | #endif | 39 | #endif |
40 | } | 40 | } |
41 | 41 | ||
diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c index 17f180148c80..5070320780c6 100644 --- a/arch/x86/kernel/pci-calgary_64.c +++ b/arch/x86/kernel/pci-calgary_64.c | |||
@@ -1177,7 +1177,7 @@ static int __init calgary_init(void) | |||
1177 | tbl = find_iommu_table(&dev->dev); | 1177 | tbl = find_iommu_table(&dev->dev); |
1178 | 1178 | ||
1179 | if (translation_enabled(tbl)) | 1179 | if (translation_enabled(tbl)) |
1180 | dev->dev.archdata.dma_ops = &calgary_dma_ops; | 1180 | dev->dev.dma_ops = &calgary_dma_ops; |
1181 | } | 1181 | } |
1182 | 1182 | ||
1183 | return ret; | 1183 | return ret; |
@@ -1201,7 +1201,7 @@ error: | |||
1201 | calgary_disable_translation(dev); | 1201 | calgary_disable_translation(dev); |
1202 | calgary_free_bus(dev); | 1202 | calgary_free_bus(dev); |
1203 | pci_dev_put(dev); /* Undo calgary_init_one()'s pci_dev_get() */ | 1203 | pci_dev_put(dev); /* Undo calgary_init_one()'s pci_dev_get() */ |
1204 | dev->dev.archdata.dma_ops = NULL; | 1204 | dev->dev.dma_ops = NULL; |
1205 | } while (1); | 1205 | } while (1); |
1206 | 1206 | ||
1207 | return ret; | 1207 | return ret; |
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c index a4fdfa7dcc1b..0cb52ae0a8f0 100644 --- a/arch/x86/pci/common.c +++ b/arch/x86/pci/common.c | |||
@@ -667,7 +667,7 @@ static void set_dma_domain_ops(struct pci_dev *pdev) | |||
667 | spin_lock(&dma_domain_list_lock); | 667 | spin_lock(&dma_domain_list_lock); |
668 | list_for_each_entry(domain, &dma_domain_list, node) { | 668 | list_for_each_entry(domain, &dma_domain_list, node) { |
669 | if (pci_domain_nr(pdev->bus) == domain->domain_nr) { | 669 | if (pci_domain_nr(pdev->bus) == domain->domain_nr) { |
670 | pdev->dev.archdata.dma_ops = domain->dma_ops; | 670 | pdev->dev.dma_ops = domain->dma_ops; |
671 | break; | 671 | break; |
672 | } | 672 | } |
673 | } | 673 | } |
diff --git a/arch/x86/pci/sta2x11-fixup.c b/arch/x86/pci/sta2x11-fixup.c index aa3828823170..ec008e800b45 100644 --- a/arch/x86/pci/sta2x11-fixup.c +++ b/arch/x86/pci/sta2x11-fixup.c | |||
@@ -203,7 +203,7 @@ static void sta2x11_setup_pdev(struct pci_dev *pdev) | |||
203 | return; | 203 | return; |
204 | pci_set_consistent_dma_mask(pdev, STA2X11_AMBA_SIZE - 1); | 204 | pci_set_consistent_dma_mask(pdev, STA2X11_AMBA_SIZE - 1); |
205 | pci_set_dma_mask(pdev, STA2X11_AMBA_SIZE - 1); | 205 | pci_set_dma_mask(pdev, STA2X11_AMBA_SIZE - 1); |
206 | pdev->dev.archdata.dma_ops = &sta2x11_dma_ops; | 206 | pdev->dev.dma_ops = &sta2x11_dma_ops; |
207 | 207 | ||
208 | /* We must enable all devices as master, for audio DMA to work */ | 208 | /* We must enable all devices as master, for audio DMA to work */ |
209 | pci_set_master(pdev); | 209 | pci_set_master(pdev); |
@@ -223,7 +223,7 @@ bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) | |||
223 | { | 223 | { |
224 | struct sta2x11_mapping *map; | 224 | struct sta2x11_mapping *map; |
225 | 225 | ||
226 | if (dev->archdata.dma_ops != &sta2x11_dma_ops) { | 226 | if (dev->dma_ops != &sta2x11_dma_ops) { |
227 | if (!dev->dma_mask) | 227 | if (!dev->dma_mask) |
228 | return false; | 228 | return false; |
229 | return addr + size - 1 <= *dev->dma_mask; | 229 | return addr + size - 1 <= *dev->dma_mask; |
@@ -247,7 +247,7 @@ bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) | |||
247 | */ | 247 | */ |
248 | dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr) | 248 | dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr) |
249 | { | 249 | { |
250 | if (dev->archdata.dma_ops != &sta2x11_dma_ops) | 250 | if (dev->dma_ops != &sta2x11_dma_ops) |
251 | return paddr; | 251 | return paddr; |
252 | return p2a(paddr, to_pci_dev(dev)); | 252 | return p2a(paddr, to_pci_dev(dev)); |
253 | } | 253 | } |
@@ -259,7 +259,7 @@ dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr) | |||
259 | */ | 259 | */ |
260 | phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr) | 260 | phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr) |
261 | { | 261 | { |
262 | if (dev->archdata.dma_ops != &sta2x11_dma_ops) | 262 | if (dev->dma_ops != &sta2x11_dma_ops) |
263 | return daddr; | 263 | return daddr; |
264 | return a2p(daddr, to_pci_dev(dev)); | 264 | return a2p(daddr, to_pci_dev(dev)); |
265 | } | 265 | } |
diff --git a/arch/xtensa/include/asm/device.h b/arch/xtensa/include/asm/device.h index a77d45d39f35..1deeb8ebbb1b 100644 --- a/arch/xtensa/include/asm/device.h +++ b/arch/xtensa/include/asm/device.h | |||
@@ -6,11 +6,7 @@ | |||
6 | #ifndef _ASM_XTENSA_DEVICE_H | 6 | #ifndef _ASM_XTENSA_DEVICE_H |
7 | #define _ASM_XTENSA_DEVICE_H | 7 | #define _ASM_XTENSA_DEVICE_H |
8 | 8 | ||
9 | struct dma_map_ops; | ||
10 | |||
11 | struct dev_archdata { | 9 | struct dev_archdata { |
12 | /* DMA operations on that device */ | ||
13 | const struct dma_map_ops *dma_ops; | ||
14 | }; | 10 | }; |
15 | 11 | ||
16 | struct pdev_archdata { | 12 | struct pdev_archdata { |
diff --git a/arch/xtensa/include/asm/dma-mapping.h b/arch/xtensa/include/asm/dma-mapping.h index 50d23106cce0..9eecfc3c5dc4 100644 --- a/arch/xtensa/include/asm/dma-mapping.h +++ b/arch/xtensa/include/asm/dma-mapping.h | |||
@@ -22,8 +22,8 @@ extern const struct dma_map_ops xtensa_dma_map_ops; | |||
22 | 22 | ||
23 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 23 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) |
24 | { | 24 | { |
25 | if (dev && dev->archdata.dma_ops) | 25 | if (dev && dev->dma_ops) |
26 | return dev->archdata.dma_ops; | 26 | return dev->dma_ops; |
27 | else | 27 | else |
28 | return &xtensa_dma_map_ops; | 28 | return &xtensa_dma_map_ops; |
29 | } | 29 | } |
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index d21ba9d857c3..dfc24f19178b 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c | |||
@@ -2465,7 +2465,7 @@ static void srpt_add_one(struct ib_device *device) | |||
2465 | int i; | 2465 | int i; |
2466 | 2466 | ||
2467 | pr_debug("device = %p, device->dma_ops = %p\n", device, | 2467 | pr_debug("device = %p, device->dma_ops = %p\n", device, |
2468 | device->dma_ops); | 2468 | device->dma_device->dma_ops); |
2469 | 2469 | ||
2470 | sdev = kzalloc(sizeof(*sdev), GFP_KERNEL); | 2470 | sdev = kzalloc(sizeof(*sdev), GFP_KERNEL); |
2471 | if (!sdev) | 2471 | if (!sdev) |
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 3703fb9db419..f7b86679bafe 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c | |||
@@ -515,7 +515,7 @@ static void iommu_uninit_device(struct device *dev) | |||
515 | iommu_group_remove_device(dev); | 515 | iommu_group_remove_device(dev); |
516 | 516 | ||
517 | /* Remove dma-ops */ | 517 | /* Remove dma-ops */ |
518 | dev->archdata.dma_ops = NULL; | 518 | dev->dma_ops = NULL; |
519 | 519 | ||
520 | /* | 520 | /* |
521 | * We keep dev_data around for unplugged devices and reuse it when the | 521 | * We keep dev_data around for unplugged devices and reuse it when the |
@@ -2164,7 +2164,7 @@ static int amd_iommu_add_device(struct device *dev) | |||
2164 | dev_name(dev)); | 2164 | dev_name(dev)); |
2165 | 2165 | ||
2166 | iommu_ignore_device(dev); | 2166 | iommu_ignore_device(dev); |
2167 | dev->archdata.dma_ops = &nommu_dma_ops; | 2167 | dev->dma_ops = &nommu_dma_ops; |
2168 | goto out; | 2168 | goto out; |
2169 | } | 2169 | } |
2170 | init_iommu_group(dev); | 2170 | init_iommu_group(dev); |
@@ -2181,7 +2181,7 @@ static int amd_iommu_add_device(struct device *dev) | |||
2181 | if (domain->type == IOMMU_DOMAIN_IDENTITY) | 2181 | if (domain->type == IOMMU_DOMAIN_IDENTITY) |
2182 | dev_data->passthrough = true; | 2182 | dev_data->passthrough = true; |
2183 | else | 2183 | else |
2184 | dev->archdata.dma_ops = &amd_iommu_dma_ops; | 2184 | dev->dma_ops = &amd_iommu_dma_ops; |
2185 | 2185 | ||
2186 | out: | 2186 | out: |
2187 | iommu_completion_wait(iommu); | 2187 | iommu_completion_wait(iommu); |
diff --git a/drivers/misc/mic/bus/mic_bus.c b/drivers/misc/mic/bus/mic_bus.c index c4b27a25662a..77b16ca66846 100644 --- a/drivers/misc/mic/bus/mic_bus.c +++ b/drivers/misc/mic/bus/mic_bus.c | |||
@@ -158,7 +158,7 @@ mbus_register_device(struct device *pdev, int id, const struct dma_map_ops *dma_ | |||
158 | mbdev->dev.parent = pdev; | 158 | mbdev->dev.parent = pdev; |
159 | mbdev->id.device = id; | 159 | mbdev->id.device = id; |
160 | mbdev->id.vendor = MBUS_DEV_ANY_ID; | 160 | mbdev->id.vendor = MBUS_DEV_ANY_ID; |
161 | mbdev->dev.archdata.dma_ops = dma_ops; | 161 | mbdev->dev.dma_ops = dma_ops; |
162 | mbdev->dev.dma_mask = &mbdev->dev.coherent_dma_mask; | 162 | mbdev->dev.dma_mask = &mbdev->dev.coherent_dma_mask; |
163 | dma_set_mask(&mbdev->dev, DMA_BIT_MASK(64)); | 163 | dma_set_mask(&mbdev->dev, DMA_BIT_MASK(64)); |
164 | mbdev->dev.release = mbus_release_dev; | 164 | mbdev->dev.release = mbus_release_dev; |
diff --git a/drivers/misc/mic/bus/scif_bus.c b/drivers/misc/mic/bus/scif_bus.c index e5d377e97c86..a444db5f61fe 100644 --- a/drivers/misc/mic/bus/scif_bus.c +++ b/drivers/misc/mic/bus/scif_bus.c | |||
@@ -154,7 +154,7 @@ scif_register_device(struct device *pdev, int id, const struct dma_map_ops *dma_ | |||
154 | sdev->dev.parent = pdev; | 154 | sdev->dev.parent = pdev; |
155 | sdev->id.device = id; | 155 | sdev->id.device = id; |
156 | sdev->id.vendor = SCIF_DEV_ANY_ID; | 156 | sdev->id.vendor = SCIF_DEV_ANY_ID; |
157 | sdev->dev.archdata.dma_ops = dma_ops; | 157 | sdev->dev.dma_ops = dma_ops; |
158 | sdev->dev.release = scif_release_dev; | 158 | sdev->dev.release = scif_release_dev; |
159 | sdev->hw_ops = hw_ops; | 159 | sdev->hw_ops = hw_ops; |
160 | sdev->dnode = dnode; | 160 | sdev->dnode = dnode; |
diff --git a/drivers/misc/mic/bus/vop_bus.c b/drivers/misc/mic/bus/vop_bus.c index e3caa6c53922..fd7f2a6049f8 100644 --- a/drivers/misc/mic/bus/vop_bus.c +++ b/drivers/misc/mic/bus/vop_bus.c | |||
@@ -154,7 +154,7 @@ vop_register_device(struct device *pdev, int id, | |||
154 | vdev->dev.parent = pdev; | 154 | vdev->dev.parent = pdev; |
155 | vdev->id.device = id; | 155 | vdev->id.device = id; |
156 | vdev->id.vendor = VOP_DEV_ANY_ID; | 156 | vdev->id.vendor = VOP_DEV_ANY_ID; |
157 | vdev->dev.archdata.dma_ops = dma_ops; | 157 | vdev->dev.dma_ops = dma_ops; |
158 | vdev->dev.dma_mask = &vdev->dev.coherent_dma_mask; | 158 | vdev->dev.dma_mask = &vdev->dev.coherent_dma_mask; |
159 | dma_set_mask(&vdev->dev, DMA_BIT_MASK(64)); | 159 | dma_set_mask(&vdev->dev, DMA_BIT_MASK(64)); |
160 | vdev->dev.release = vop_release_dev; | 160 | vdev->dev.release = vop_release_dev; |
diff --git a/include/linux/device.h b/include/linux/device.h index 491b4c0ca633..46a567261ccc 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -921,6 +921,7 @@ struct device { | |||
921 | #ifdef CONFIG_NUMA | 921 | #ifdef CONFIG_NUMA |
922 | int numa_node; /* NUMA node this device is close to */ | 922 | int numa_node; /* NUMA node this device is close to */ |
923 | #endif | 923 | #endif |
924 | const struct dma_map_ops *dma_ops; | ||
924 | u64 *dma_mask; /* dma mask (if dma'able device) */ | 925 | u64 *dma_mask; /* dma mask (if dma'able device) */ |
925 | u64 coherent_dma_mask;/* Like dma_mask, but for | 926 | u64 coherent_dma_mask;/* Like dma_mask, but for |
926 | alloc_coherent mappings as | 927 | alloc_coherent mappings as |