We can remove HAVE_ARCH_PCI_SET_DMA_MASK too.
Signed-off-by: FUJITA Tomonori <fujita....@lab.ntt.co.jp>
Cc: Jesse Barnes <jba...@virtuousgeek.org>
---
drivers/pci/pci.c | 28 ----------------------------
include/asm-generic/pci-dma-compat.h | 13 ++++++++++---
include/linux/pci.h | 2 --
3 files changed, 10 insertions(+), 33 deletions(-)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index aacb86f..57af999 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -2114,32 +2114,6 @@ void pci_msi_off(struct pci_dev *dev)
}
}
-#ifndef HAVE_ARCH_PCI_SET_DMA_MASK
-/*
- * These can be overridden by arch-specific implementations
- */
-int
-pci_set_dma_mask(struct pci_dev *dev, u64 mask)
-{
- int ret = dma_set_mask(&dev->dev, mask);
- if (ret)
- return ret;
- dev_dbg(&dev->dev, "using %dbit DMA mask\n", fls64(mask));
- return 0;
-}
-
-int
-pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask)
-{
- int ret = dma_set_coherent_mask(&dev->dev, mask);
- if (ret)
- return ret;
-
- dev_dbg(&dev->dev, "using %dbit consistent DMA mask\n", fls64(mask));
- return 0;
-}
-#endif
-
#ifndef HAVE_ARCH_PCI_SET_DMA_MAX_SEGMENT_SIZE
int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size)
{
@@ -2857,8 +2831,6 @@ EXPORT_SYMBOL(pci_set_mwi);
EXPORT_SYMBOL(pci_try_set_mwi);
EXPORT_SYMBOL(pci_clear_mwi);
EXPORT_SYMBOL_GPL(pci_intx);
-EXPORT_SYMBOL(pci_set_dma_mask);
-EXPORT_SYMBOL(pci_set_consistent_dma_mask);
EXPORT_SYMBOL(pci_assign_resource);
EXPORT_SYMBOL(pci_find_parent_resource);
EXPORT_SYMBOL(pci_select_bars);
diff --git a/include/asm-generic/pci-dma-compat.h b/include/asm-generic/pci-dma-compat.h
index 37b3706..ddfa9c5 100644
--- a/include/asm-generic/pci-dma-compat.h
+++ b/include/asm-generic/pci-dma-compat.h
@@ -6,9 +6,6 @@
#include <linux/dma-mapping.h>
-/* note pci_set_dma_mask isn't here, since it's a public function
- * exported from drivers/pci, use dma_supported instead */
-
static inline int
pci_dma_supported(struct pci_dev *hwdev, u64 mask)
{
@@ -104,4 +101,14 @@ pci_dma_mapping_error(struct pci_dev *pdev, dma_addr_t dma_addr)
return dma_mapping_error(&pdev->dev, dma_addr);
}
+static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask)
+{
+ return dma_set_mask(&dev->dev, mask);
+}
+
+static inline int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask)
+{
+ return dma_set_coherent_mask(&dev->dev, mask);
+}
+
#endif
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 032f42c..12b8aff 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -720,8 +720,6 @@ int pci_try_set_mwi(struct pci_dev *dev);
void pci_clear_mwi(struct pci_dev *dev);
void pci_intx(struct pci_dev *dev, int enable);
void pci_msi_off(struct pci_dev *dev);
-int pci_set_dma_mask(struct pci_dev *dev, u64 mask);
-int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask);
int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size);
int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask);
int pcix_get_max_mmrbc(struct pci_dev *dev);
--
1.5.6.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
The generic pci_set_dma_mask does what powerpc's pci_set_dma_mask
does.
Unlike powerpc's pci_set_consistent_dma_mask, the gneric
pci_set_consistent_dma_mask sets only coherent_dma_mask. It doesn't
work for powerpc? pci_set_consistent_dma_mask API should set only
coherent_dma_mask?
Signed-off-by: FUJITA Tomonori <fujita....@lab.ntt.co.jp>
Cc: Benjamin Herrenschmidt <be...@kernel.crashing.org>
---
arch/powerpc/include/asm/dma-mapping.h | 3 ---
arch/powerpc/kernel/pci-common.c | 15 ---------------
2 files changed, 0 insertions(+), 18 deletions(-)
diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h
index 80a973b..c85ef23 100644
--- a/arch/powerpc/include/asm/dma-mapping.h
+++ b/arch/powerpc/include/asm/dma-mapping.h
@@ -127,9 +127,6 @@ static inline int dma_supported(struct device *dev, u64 mask)
return dma_ops->dma_supported(dev, mask);
}
-/* We have our own implementation of pci_set_dma_mask() */
-#define HAVE_ARCH_PCI_SET_DMA_MASK
-
static inline int dma_set_mask(struct device *dev, u64 dma_mask)
{
struct dma_map_ops *dma_ops = get_dma_ops(dev);
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index cadbed6..a8bc6f2 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -63,21 +63,6 @@ struct dma_map_ops *get_pci_dma_ops(void)
}
EXPORT_SYMBOL(get_pci_dma_ops);
-int pci_set_dma_mask(struct pci_dev *dev, u64 mask)
-{
- return dma_set_mask(&dev->dev, mask);
-}
-
-int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask)
-{
- int rc;
-
- rc = dma_set_mask(&dev->dev, mask);
- dev->dev.coherent_dma_mask = dev->dma_mask;
-
- return rc;
-}
-
struct pci_controller *pcibios_alloc_controller(struct device_node *dev)
{
struct pci_controller *phb;
I don't know why we do it that way, your patch looks correct to me, if
we have a driver bug assuming it does both masks at once, then we'll
fix it.
Do you need me to merge that via powerpc.git or are you happy to carry
it with the rest of your PCI DMA changes ?
> Signed-off-by: FUJITA Tomonori <fujita....@lab.ntt.co.jp>
Acked-by: Benjamin Herrenschmidt <be...@kernel.crashing.org>
--
> On Fri, 2010-02-12 at 18:33 +0900, FUJITA Tomonori wrote:
> > This converts powerpc to use the generic pci_set_dma_mask and
> > pci_set_consistent_dma_mask (drivers/pci/pci.c).
> >
> > The generic pci_set_dma_mask does what powerpc's pci_set_dma_mask
> > does.
> >
> > Unlike powerpc's pci_set_consistent_dma_mask, the gneric
> > pci_set_consistent_dma_mask sets only coherent_dma_mask. It doesn't
> > work for powerpc? pci_set_consistent_dma_mask API should set only
> > coherent_dma_mask?
>
> I don't know why we do it that way, your patch looks correct to me, if
> we have a driver bug assuming it does both masks at once, then we'll
> fix it.
>
> Do you need me to merge that via powerpc.git or are you happy to carry
> it with the rest of your PCI DMA changes ?
I guess it's easier if Andrew carries all the patches since some of
the patches in this patchset depend on my other patches in -mm.
> > Signed-off-by: FUJITA Tomonori <fujita....@lab.ntt.co.jp>
>
> Acked-by: Benjamin Herrenschmidt <be...@kernel.crashing.org>
Thanks!
Fine with me.
Cheers,
Ben.
> We can use pci-dma-compat.h to implement pci_set_dma_mask and
> pci_set_consistent_dma_mask as we do with the other PCI DMA API.
>
> We can remove HAVE_ARCH_PCI_SET_DMA_MASK too.
i386 allnoconfig:
include/asm-generic/pci-dma-compat.h:105: error: redefinition of 'pci_set_dma_mask'
include/linux/pci.h:1092: error: previous definition of 'pci_set_dma_mask' was here
include/asm-generic/pci-dma-compat.h:110: error: redefinition of 'pci_set_consistent_dma_mask'
include/linux/pci.h:1097: error: previous definition of 'pci_set_consistent_dma_mask' was here
In fact the whole of include/asm-generic/pci-dma-compat.h seems a bit
fishy when CONFIG_PCI=n. Shouldn't all those functions be
EIO-returning stubs?
> On Fri, 12 Feb 2010 18:33:32 +0900 FUJITA Tomonori <fujita....@lab.ntt.co.jp> wrote:
>
> > We can use pci-dma-compat.h to implement pci_set_dma_mask and
> > pci_set_consistent_dma_mask as we do with the other PCI DMA API.
> >
> > We can remove HAVE_ARCH_PCI_SET_DMA_MASK too.
>
> i386 allnoconfig:
Sorry about that.
> include/asm-generic/pci-dma-compat.h:105: error: redefinition of 'pci_set_dma_mask'
> include/linux/pci.h:1092: error: previous definition of 'pci_set_dma_mask' was here
> include/asm-generic/pci-dma-compat.h:110: error: redefinition of 'pci_set_consistent_dma_mask'
> include/linux/pci.h:1097: error: previous definition of 'pci_set_consistent_dma_mask' was here
>
> In fact the whole of include/asm-generic/pci-dma-compat.h seems a bit
> fishy when CONFIG_PCI=n. Shouldn't all those functions be
> EIO-returning stubs?
Might be (and it should work). However, when CONFIG_PCI=n, we has
silently converted the PCI DMA API to the generic DMA API.
In the long term, we remove the pci_dma_* API.
Can you fold this into the above patch?
diff --git a/include/asm-generic/pci-dma-compat.h b/include/asm-generic/pci-dma-compat.h
index ddfa9c5..1437b7d 100644
--- a/include/asm-generic/pci-dma-compat.h
+++ b/include/asm-generic/pci-dma-compat.h
@@ -101,6 +101,7 @@ pci_dma_mapping_error(struct pci_dev *pdev, dma_addr_t dma_addr)
return dma_mapping_error(&pdev->dev, dma_addr);
}
+#ifdef CONFIG_PCI
static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask)
{
return dma_set_mask(&dev->dev, mask);
@@ -110,5 +111,6 @@ static inline int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask)
{
return dma_set_coherent_mask(&dev->dev, mask);
}
+#endif
#endif
Oops, I missed these in my last round of applications because they
weren't in PCI patchwork; can you cc linu...@vger.kernel.org in the
future so the patchwork bot picks them up?
Thanks,
--
Jesse Barnes, Intel Open Source Technology Center