From 09d67b54ae613129c4ea83d82b7725bd3cdc5bf4 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Wed, 10 Mar 2010 15:23:39 -0800 Subject: [PATCH] --- yaml --- r: 187291 b: refs/heads/master c: 6a1961f49ee8d7339ea2454443dfc0460e0b2748 h: refs/heads/master i: 187289: 53541ac6ec9cc29ffbd8f66977df2fd496bff42c 187287: 0079f94d339b2967216006d3e43cc30999b871c9 v: v3 --- [refs] | 2 +- trunk/Documentation/DMA-API.txt | 10 ++++++++++ trunk/drivers/pci/pci.c | 7 +++---- trunk/include/linux/dma-mapping.h | 8 ++++++++ 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index 27cd0b93f0a8..00fb7672ea19 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e3c4bccabaf3e5c13f4b307c7737cbe8d0cecd02 +refs/heads/master: 6a1961f49ee8d7339ea2454443dfc0460e0b2748 diff --git a/trunk/Documentation/DMA-API.txt b/trunk/Documentation/DMA-API.txt index 29a48fbae779..0fc5728ed487 100644 --- a/trunk/Documentation/DMA-API.txt +++ b/trunk/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/trunk/drivers/pci/pci.c b/trunk/drivers/pci/pci.c index b2d23d1b0d41..929fd3932032 100644 --- a/trunk/drivers/pci/pci.c +++ b/trunk/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/trunk/include/linux/dma-mapping.h b/trunk/include/linux/dma-mapping.h index c5ac9d49cc06..ca32ed78b057 100644 --- a/trunk/include/linux/dma-mapping.h +++ b/trunk/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)