aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/DMA-API.txt10
-rw-r--r--drivers/pci/pci.c7
-rw-r--r--include/linux/dma-mapping.h8
3 files changed, 21 insertions, 4 deletions
diff --git a/Documentation/DMA-API.txt b/Documentation/DMA-API.txt
index 29a48fb..0fc5728 100644
--- a/Documentation/DMA-API.txt
+++ b/Documentation/DMA-API.txt
@@ -167,6 +167,16 @@ parameters if it is.
Returns: 0 if successful and a negative error if not.
+int
+dma_set_coherent_mask(struct device *dev, u64 mask)
+int
+pci_set_consistent_dma_mask(struct pci_device *dev, u64 mask)
+
+Checks to see if the mask is possible and updates the device
+parameters if it is.
+
+Returns: 0 if successful and a negative error if not.
+
u64
dma_get_required_mask(struct device *dev)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index b2d23d1..929fd39 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -2315,12 +2315,11 @@ pci_set_dma_mask(struct pci_dev *dev, u64 mask)
int
pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask)
{
- if (!pci_dma_supported(dev, mask))
- return -EIO;
+ int ret = dma_set_coherent_mask(&dev->dev, mask);
+ if (ret)
+ return ret;
- dev->dev.coherent_dma_mask = mask;
dev_dbg(&dev->dev, "using %dbit consistent DMA mask\n", fls64(mask));
-
return 0;
}
#endif
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index c5ac9d4..ca32ed7 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -127,6 +127,14 @@ static inline u64 dma_get_mask(struct device *dev)
return DMA_BIT_MASK(32);
}
+static inline int dma_set_coherent_mask(struct device *dev, u64 mask)
+{
+ if (!dma_supported(dev, mask))
+ return -EIO;
+ dev->coherent_dma_mask = mask;
+ return 0;
+}
+
extern u64 dma_get_required_mask(struct device *dev);
static inline unsigned int dma_get_max_seg_size(struct device *dev)