aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2009-06-08 09:19:29 -0400
committerJoerg Roedel <joerg.roedel@amd.com>2009-06-08 09:19:29 -0400
commitc17e2cf7376a2010b8b114fdeebd4e340a5e9cb2 (patch)
treeaec38d5643d518afa12889c6a72003b5cfa13b23
parent312325094785566a0e42a88c1bf6e7eb54c5d70e (diff)
dma-debug: code style fixes
This patch changes the recent updates to dma-debug to conform with coding style guidelines of Linux and the -tip tree. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
-rw-r--r--lib/dma-debug.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index b8a61ff08544..9561825c14a4 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -501,8 +501,8 @@ out_err:
501static ssize_t filter_read(struct file *file, char __user *user_buf, 501static ssize_t filter_read(struct file *file, char __user *user_buf,
502 size_t count, loff_t *ppos) 502 size_t count, loff_t *ppos)
503{ 503{
504 unsigned long flags;
505 char buf[NAME_MAX_LEN + 1]; 504 char buf[NAME_MAX_LEN + 1];
505 unsigned long flags;
506 int len; 506 int len;
507 507
508 if (!current_driver_name[0]) 508 if (!current_driver_name[0])
@@ -523,9 +523,9 @@ static ssize_t filter_read(struct file *file, char __user *user_buf,
523static ssize_t filter_write(struct file *file, const char __user *userbuf, 523static ssize_t filter_write(struct file *file, const char __user *userbuf,
524 size_t count, loff_t *ppos) 524 size_t count, loff_t *ppos)
525{ 525{
526 unsigned long flags;
527 char buf[NAME_MAX_LEN]; 526 char buf[NAME_MAX_LEN];
528 size_t len = NAME_MAX_LEN - 1; 527 unsigned long flags;
528 size_t len;
529 int i; 529 int i;
530 530
531 /* 531 /*
@@ -534,7 +534,7 @@ static ssize_t filter_write(struct file *file, const char __user *userbuf,
534 * disabled. Since copy_from_user can fault and may sleep we 534 * disabled. Since copy_from_user can fault and may sleep we
535 * need to copy to temporary buffer first 535 * need to copy to temporary buffer first
536 */ 536 */
537 len = min(count, len); 537 len = min(count, NAME_MAX_LEN - 1);
538 if (copy_from_user(buf, userbuf, len)) 538 if (copy_from_user(buf, userbuf, len))
539 return -EFAULT; 539 return -EFAULT;
540 540
@@ -1040,18 +1040,19 @@ EXPORT_SYMBOL(debug_dma_map_sg);
1040 1040
1041static int get_nr_mapped_entries(struct device *dev, struct scatterlist *s) 1041static int get_nr_mapped_entries(struct device *dev, struct scatterlist *s)
1042{ 1042{
1043 struct dma_debug_entry *entry; 1043 struct dma_debug_entry *entry, ref;
1044 struct hash_bucket *bucket; 1044 struct hash_bucket *bucket;
1045 unsigned long flags; 1045 unsigned long flags;
1046 int mapped_ents = 0; 1046 int mapped_ents;
1047 struct dma_debug_entry ref;
1048 1047
1049 ref.dev = dev; 1048 ref.dev = dev;
1050 ref.dev_addr = sg_dma_address(s); 1049 ref.dev_addr = sg_dma_address(s);
1051 ref.size = sg_dma_len(s), 1050 ref.size = sg_dma_len(s),
1051
1052 bucket = get_hash_bucket(&ref, &flags);
1053 entry = hash_bucket_find(bucket, &ref);
1054 mapped_ents = 0;
1052 1055
1053 bucket = get_hash_bucket(&ref, &flags);
1054 entry = hash_bucket_find(bucket, &ref);
1055 if (entry) 1056 if (entry)
1056 mapped_ents = entry->sg_mapped_ents; 1057 mapped_ents = entry->sg_mapped_ents;
1057 put_hash_bucket(bucket, &flags); 1058 put_hash_bucket(bucket, &flags);