aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dma-debug.c
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2009-06-08 09:39:24 -0400
committerJoerg Roedel <joerg.roedel@amd.com>2009-06-08 09:39:24 -0400
commite7ed70eedccc78e79ce6da2155e9caf90aff4003 (patch)
tree30e6327ae71a076d6c3187e217d2642b2ee1a560 /lib/dma-debug.c
parentc17e2cf7376a2010b8b114fdeebd4e340a5e9cb2 (diff)
dma-debug: use pr_* instead of printk(KERN_* ...)
The pr_* macros are shorter than the old printk(KERN_ ...) variant. Change the dma-debug code to use the new macros and save a few unnecessary line breaks. If lines don't break the source code can also be grepped more easily. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'lib/dma-debug.c')
-rw-r--r--lib/dma-debug.c36
1 files changed, 15 insertions, 21 deletions
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index 9561825c14a4..24c4a2c5d61c 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -139,7 +139,7 @@ static inline void dump_entry_trace(struct dma_debug_entry *entry)
139{ 139{
140#ifdef CONFIG_STACKTRACE 140#ifdef CONFIG_STACKTRACE
141 if (entry) { 141 if (entry) {
142 printk(KERN_WARNING "Mapped at:\n"); 142 pr_warning("Mapped at:\n");
143 print_stack_trace(&entry->stacktrace, 0); 143 print_stack_trace(&entry->stacktrace, 0);
144 } 144 }
145#endif 145#endif
@@ -377,8 +377,7 @@ static struct dma_debug_entry *dma_entry_alloc(void)
377 spin_lock_irqsave(&free_entries_lock, flags); 377 spin_lock_irqsave(&free_entries_lock, flags);
378 378
379 if (list_empty(&free_entries)) { 379 if (list_empty(&free_entries)) {
380 printk(KERN_ERR "DMA-API: debugging out of memory " 380 pr_err("DMA-API: debugging out of memory - disabling\n");
381 "- disabling\n");
382 global_disable = true; 381 global_disable = true;
383 goto out; 382 goto out;
384 } 383 }
@@ -483,8 +482,7 @@ static int prealloc_memory(u32 num_entries)
483 num_free_entries = num_entries; 482 num_free_entries = num_entries;
484 min_free_entries = num_entries; 483 min_free_entries = num_entries;
485 484
486 printk(KERN_INFO "DMA-API: preallocated %d debug entries\n", 485 pr_info("DMA-API: preallocated %d debug entries\n", num_entries);
487 num_entries);
488 486
489 return 0; 487 return 0;
490 488
@@ -534,7 +532,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 532 * disabled. Since copy_from_user can fault and may sleep we
535 * need to copy to temporary buffer first 533 * need to copy to temporary buffer first
536 */ 534 */
537 len = min(count, NAME_MAX_LEN - 1); 535 len = min(count, (size_t)(NAME_MAX_LEN - 1));
538 if (copy_from_user(buf, userbuf, len)) 536 if (copy_from_user(buf, userbuf, len))
539 return -EFAULT; 537 return -EFAULT;
540 538
@@ -557,8 +555,7 @@ static ssize_t filter_write(struct file *file, const char __user *userbuf,
557 * switched off. 555 * switched off.
558 */ 556 */
559 if (current_driver_name[0]) 557 if (current_driver_name[0])
560 printk(KERN_INFO "DMA-API: switching off dma-debug " 558 pr_info("DMA-API: switching off dma-debug driver filter\n");
561 "driver filter\n");
562 current_driver_name[0] = 0; 559 current_driver_name[0] = 0;
563 current_driver = NULL; 560 current_driver = NULL;
564 goto out_unlock; 561 goto out_unlock;
@@ -576,8 +573,8 @@ static ssize_t filter_write(struct file *file, const char __user *userbuf,
576 current_driver_name[i] = 0; 573 current_driver_name[i] = 0;
577 current_driver = NULL; 574 current_driver = NULL;
578 575
579 printk(KERN_INFO "DMA-API: enable driver filter for driver [%s]\n", 576 pr_info("DMA-API: enable driver filter for driver [%s]\n",
580 current_driver_name); 577 current_driver_name);
581 578
582out_unlock: 579out_unlock:
583 write_unlock_irqrestore(&driver_name_lock, flags); 580 write_unlock_irqrestore(&driver_name_lock, flags);
@@ -594,7 +591,7 @@ static int dma_debug_fs_init(void)
594{ 591{
595 dma_debug_dent = debugfs_create_dir("dma-api", NULL); 592 dma_debug_dent = debugfs_create_dir("dma-api", NULL);
596 if (!dma_debug_dent) { 593 if (!dma_debug_dent) {
597 printk(KERN_ERR "DMA-API: can not create debugfs directory\n"); 594 pr_err("DMA-API: can not create debugfs directory\n");
598 return -ENOMEM; 595 return -ENOMEM;
599 } 596 }
600 597
@@ -693,7 +690,7 @@ void dma_debug_add_bus(struct bus_type *bus)
693 690
694 nb = kzalloc(sizeof(struct notifier_block), GFP_KERNEL); 691 nb = kzalloc(sizeof(struct notifier_block), GFP_KERNEL);
695 if (nb == NULL) { 692 if (nb == NULL) {
696 printk(KERN_ERR "dma_debug_add_bus: out of memory\n"); 693 pr_err("dma_debug_add_bus: out of memory\n");
697 return; 694 return;
698 } 695 }
699 696
@@ -718,8 +715,7 @@ void dma_debug_init(u32 num_entries)
718 } 715 }
719 716
720 if (dma_debug_fs_init() != 0) { 717 if (dma_debug_fs_init() != 0) {
721 printk(KERN_ERR "DMA-API: error creating debugfs entries " 718 pr_err("DMA-API: error creating debugfs entries - disabling\n");
722 "- disabling\n");
723 global_disable = true; 719 global_disable = true;
724 720
725 return; 721 return;
@@ -729,8 +725,7 @@ void dma_debug_init(u32 num_entries)
729 num_entries = req_entries; 725 num_entries = req_entries;
730 726
731 if (prealloc_memory(num_entries) != 0) { 727 if (prealloc_memory(num_entries) != 0) {
732 printk(KERN_ERR "DMA-API: debugging out of memory error " 728 pr_err("DMA-API: debugging out of memory error - disabled\n");
733 "- disabled\n");
734 global_disable = true; 729 global_disable = true;
735 730
736 return; 731 return;
@@ -738,7 +733,7 @@ void dma_debug_init(u32 num_entries)
738 733
739 nr_total_entries = num_free_entries; 734 nr_total_entries = num_free_entries;
740 735
741 printk(KERN_INFO "DMA-API: debugging enabled by kernel config\n"); 736 pr_info("DMA-API: debugging enabled by kernel config\n");
742} 737}
743 738
744static __init int dma_debug_cmdline(char *str) 739static __init int dma_debug_cmdline(char *str)
@@ -747,8 +742,7 @@ static __init int dma_debug_cmdline(char *str)
747 return -EINVAL; 742 return -EINVAL;
748 743
749 if (strncmp(str, "off", 3) == 0) { 744 if (strncmp(str, "off", 3) == 0) {
750 printk(KERN_INFO "DMA-API: debugging disabled on kernel " 745 pr_info("DMA-API: debugging disabled on kernel command line\n");
751 "command line\n");
752 global_disable = true; 746 global_disable = true;
753 } 747 }
754 748
@@ -1239,8 +1233,8 @@ static int __init dma_debug_driver_setup(char *str)
1239 } 1233 }
1240 1234
1241 if (current_driver_name[0]) 1235 if (current_driver_name[0])
1242 printk(KERN_INFO "DMA-API: enable driver filter for " 1236 pr_info("DMA-API: enable driver filter for driver [%s]\n",
1243 "driver [%s]\n", current_driver_name); 1237 current_driver_name);
1244 1238
1245 1239
1246 return 1; 1240 return 1;