diff options
Diffstat (limited to 'lib/dma-debug.c')
| -rw-r--r-- | lib/dma-debug.c | 17 | 
1 files changed, 10 insertions, 7 deletions
| diff --git a/lib/dma-debug.c b/lib/dma-debug.c index ce6b7eabf67..7d2f0b33e5a 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,  		 * times. Without a hardware IOMMU this results in the  		 * same device addresses being put into the dma-debug  		 * hash multiple times too. This can result in false -		 * positives being reported. Therfore we implement a +		 * positives being reported. Therefore we implement a  		 * best-fit algorithm here which returns the entry from  		 * the hash which fits best to the reference value  		 * instead of the first-fit. @@ -670,12 +670,13 @@ static int device_dma_allocations(struct device *dev)  	return count;  } -static int dma_debug_device_change(struct notifier_block *nb, -				    unsigned long action, void *data) +static int dma_debug_device_change(struct notifier_block *nb, unsigned long action, void *data)  {  	struct device *dev = data;  	int count; +	if (global_disable) +		return 0;  	switch (action) {  	case BUS_NOTIFY_UNBOUND_DRIVER: @@ -697,6 +698,9 @@ void dma_debug_add_bus(struct bus_type *bus)  {  	struct notifier_block *nb; +	if (global_disable) +		return; +  	nb = kzalloc(sizeof(struct notifier_block), GFP_KERNEL);  	if (nb == NULL) {  		pr_err("dma_debug_add_bus: out of memory\n"); @@ -909,6 +913,9 @@ static void check_sync(struct device *dev,  				ref->size);  	} +	if (entry->direction == DMA_BIDIRECTIONAL) +		goto out; +  	if (ref->direction != entry->direction) {  		err_printk(dev, entry, "DMA-API: device driver syncs "  				"DMA memory with different direction " @@ -919,9 +926,6 @@ static void check_sync(struct device *dev,  				dir2name[ref->direction]);  	} -	if (entry->direction == DMA_BIDIRECTIONAL) -		goto out; -  	if (to_cpu && !(entry->direction == DMA_FROM_DEVICE) &&  		      !(ref->direction == DMA_TO_DEVICE))  		err_printk(dev, entry, "DMA-API: device driver syncs " @@ -944,7 +948,6 @@ static void check_sync(struct device *dev,  out:  	put_hash_bucket(bucket, &flags); -  }  void debug_dma_map_page(struct device *dev, struct page *page, size_t offset, | 
