]> nv-tegra.nvidia Code Review - linux-2.6.git/blobdiff - lib/dma-debug.c
Decompressors: remove unused function from lib/decompress_unlzma.c
[linux-2.6.git] / lib / dma-debug.c
index ce6b7eabf674384a326520df7174661a5169228e..4bfb0471f10684f230e4351db489a1292b83f414 100644 (file)
@@ -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.
@@ -570,7 +570,7 @@ static ssize_t filter_write(struct file *file, const char __user *userbuf,
         * Now parse out the first token and use it as the name for the
         * driver to filter for.
         */
-       for (i = 0; i < NAME_MAX_LEN; ++i) {
+       for (i = 0; i < NAME_MAX_LEN - 1; ++i) {
                current_driver_name[i] = buf[i];
                if (isspace(buf[i]) || buf[i] == ' ' || buf[i] == 0)
                        break;
@@ -587,9 +587,10 @@ out_unlock:
        return count;
 }
 
-const struct file_operations filter_fops = {
+static const struct file_operations filter_fops = {
        .read  = filter_read,
        .write = filter_write,
+       .llseek = default_llseek,
 };
 
 static int dma_debug_fs_init(void)
@@ -670,12 +671,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 +699,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 +914,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 +927,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 +949,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,