diff options
| author | Thomas Gleixner <tglx@linutronix.de> | 2010-02-17 12:27:37 -0500 |
|---|---|---|
| committer | Thomas Gleixner <tglx@linutronix.de> | 2010-02-17 12:28:05 -0500 |
| commit | b7e56edba4b02f2079042c326a8cd72a44635817 (patch) | |
| tree | b5042002e9747cd8fb1278d61f86d8b92a74c018 /lib/dma-debug.c | |
| parent | 13ca0fcaa33f6b1984c4111b6ec5df42689fea6f (diff) | |
| parent | b0483e78e5c4c9871fc5541875b3bc006846d46b (diff) | |
Merge branch 'linus' into x86/mm
x86/mm is on 32-rc4 and missing the spinlock namespace changes which
are needed for further commits into this topic.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'lib/dma-debug.c')
| -rw-r--r-- | lib/dma-debug.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/lib/dma-debug.c b/lib/dma-debug.c index 58a9f9fc609a..ba8b67039d13 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c | |||
| @@ -259,7 +259,7 @@ static struct dma_debug_entry *hash_bucket_find(struct hash_bucket *bucket, | |||
| 259 | * times. Without a hardware IOMMU this results in the | 259 | * times. Without a hardware IOMMU this results in the |
| 260 | * same device addresses being put into the dma-debug | 260 | * same device addresses being put into the dma-debug |
| 261 | * hash multiple times too. This can result in false | 261 | * hash multiple times too. This can result in false |
| 262 | * positives being reported. Therfore we implement a | 262 | * positives being reported. Therefore we implement a |
| 263 | * best-fit algorithm here which returns the entry from | 263 | * best-fit algorithm here which returns the entry from |
| 264 | * the hash which fits best to the reference value | 264 | * the hash which fits best to the reference value |
| 265 | * instead of the first-fit. | 265 | * instead of the first-fit. |
| @@ -587,7 +587,7 @@ out_unlock: | |||
| 587 | return count; | 587 | return count; |
| 588 | } | 588 | } |
| 589 | 589 | ||
| 590 | const struct file_operations filter_fops = { | 590 | static const struct file_operations filter_fops = { |
| 591 | .read = filter_read, | 591 | .read = filter_read, |
| 592 | .write = filter_write, | 592 | .write = filter_write, |
| 593 | }; | 593 | }; |
| @@ -670,12 +670,13 @@ static int device_dma_allocations(struct device *dev) | |||
| 670 | return count; | 670 | return count; |
| 671 | } | 671 | } |
| 672 | 672 | ||
| 673 | static int dma_debug_device_change(struct notifier_block *nb, | 673 | static int dma_debug_device_change(struct notifier_block *nb, unsigned long action, void *data) |
| 674 | unsigned long action, void *data) | ||
| 675 | { | 674 | { |
| 676 | struct device *dev = data; | 675 | struct device *dev = data; |
| 677 | int count; | 676 | int count; |
| 678 | 677 | ||
| 678 | if (global_disable) | ||
| 679 | return 0; | ||
| 679 | 680 | ||
| 680 | switch (action) { | 681 | switch (action) { |
| 681 | case BUS_NOTIFY_UNBOUND_DRIVER: | 682 | case BUS_NOTIFY_UNBOUND_DRIVER: |
| @@ -697,6 +698,9 @@ void dma_debug_add_bus(struct bus_type *bus) | |||
| 697 | { | 698 | { |
| 698 | struct notifier_block *nb; | 699 | struct notifier_block *nb; |
| 699 | 700 | ||
| 701 | if (global_disable) | ||
| 702 | return; | ||
| 703 | |||
| 700 | nb = kzalloc(sizeof(struct notifier_block), GFP_KERNEL); | 704 | nb = kzalloc(sizeof(struct notifier_block), GFP_KERNEL); |
| 701 | if (nb == NULL) { | 705 | if (nb == NULL) { |
| 702 | pr_err("dma_debug_add_bus: out of memory\n"); | 706 | pr_err("dma_debug_add_bus: out of memory\n"); |
| @@ -819,9 +823,11 @@ static void check_unmap(struct dma_debug_entry *ref) | |||
| 819 | err_printk(ref->dev, entry, "DMA-API: device driver frees " | 823 | err_printk(ref->dev, entry, "DMA-API: device driver frees " |
| 820 | "DMA memory with different CPU address " | 824 | "DMA memory with different CPU address " |
| 821 | "[device address=0x%016llx] [size=%llu bytes] " | 825 | "[device address=0x%016llx] [size=%llu bytes] " |
| 822 | "[cpu alloc address=%p] [cpu free address=%p]", | 826 | "[cpu alloc address=0x%016llx] " |
| 827 | "[cpu free address=0x%016llx]", | ||
| 823 | ref->dev_addr, ref->size, | 828 | ref->dev_addr, ref->size, |
| 824 | (void *)entry->paddr, (void *)ref->paddr); | 829 | (unsigned long long)entry->paddr, |
| 830 | (unsigned long long)ref->paddr); | ||
| 825 | } | 831 | } |
| 826 | 832 | ||
| 827 | if (ref->sg_call_ents && ref->type == dma_debug_sg && | 833 | if (ref->sg_call_ents && ref->type == dma_debug_sg && |
| @@ -907,6 +913,9 @@ static void check_sync(struct device *dev, | |||
| 907 | ref->size); | 913 | ref->size); |
| 908 | } | 914 | } |
| 909 | 915 | ||
| 916 | if (entry->direction == DMA_BIDIRECTIONAL) | ||
| 917 | goto out; | ||
| 918 | |||
| 910 | if (ref->direction != entry->direction) { | 919 | if (ref->direction != entry->direction) { |
| 911 | err_printk(dev, entry, "DMA-API: device driver syncs " | 920 | err_printk(dev, entry, "DMA-API: device driver syncs " |
| 912 | "DMA memory with different direction " | 921 | "DMA memory with different direction " |
| @@ -917,9 +926,6 @@ static void check_sync(struct device *dev, | |||
| 917 | dir2name[ref->direction]); | 926 | dir2name[ref->direction]); |
| 918 | } | 927 | } |
| 919 | 928 | ||
| 920 | if (entry->direction == DMA_BIDIRECTIONAL) | ||
| 921 | goto out; | ||
| 922 | |||
| 923 | if (to_cpu && !(entry->direction == DMA_FROM_DEVICE) && | 929 | if (to_cpu && !(entry->direction == DMA_FROM_DEVICE) && |
| 924 | !(ref->direction == DMA_TO_DEVICE)) | 930 | !(ref->direction == DMA_TO_DEVICE)) |
| 925 | err_printk(dev, entry, "DMA-API: device driver syncs " | 931 | err_printk(dev, entry, "DMA-API: device driver syncs " |
| @@ -942,7 +948,6 @@ static void check_sync(struct device *dev, | |||
| 942 | 948 | ||
| 943 | out: | 949 | out: |
| 944 | put_hash_bucket(bucket, &flags); | 950 | put_hash_bucket(bucket, &flags); |
| 945 | |||
| 946 | } | 951 | } |
| 947 | 952 | ||
| 948 | void debug_dma_map_page(struct device *dev, struct page *page, size_t offset, | 953 | void debug_dma_map_page(struct device *dev, struct page *page, size_t offset, |
