Commit e7ed70eedccc78e79ce6da2155e9caf90aff4003

Authored by Joerg Roedel
1 parent c17e2cf737

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>

Showing 1 changed file with 15 additions and 21 deletions Side-by-side Diff

... ... @@ -139,7 +139,7 @@
139 139 {
140 140 #ifdef CONFIG_STACKTRACE
141 141 if (entry) {
142   - printk(KERN_WARNING "Mapped at:\n");
  142 + pr_warning("Mapped at:\n");
143 143 print_stack_trace(&entry->stacktrace, 0);
144 144 }
145 145 #endif
... ... @@ -377,8 +377,7 @@
377 377 spin_lock_irqsave(&free_entries_lock, flags);
378 378  
379 379 if (list_empty(&free_entries)) {
380   - printk(KERN_ERR "DMA-API: debugging out of memory "
381   - "- disabling\n");
  380 + pr_err("DMA-API: debugging out of memory - disabling\n");
382 381 global_disable = true;
383 382 goto out;
384 383 }
... ... @@ -483,8 +482,7 @@
483 482 num_free_entries = num_entries;
484 483 min_free_entries = num_entries;
485 484  
486   - printk(KERN_INFO "DMA-API: preallocated %d debug entries\n",
487   - num_entries);
  485 + pr_info("DMA-API: preallocated %d debug entries\n", num_entries);
488 486  
489 487 return 0;
490 488  
... ... @@ -534,7 +532,7 @@
534 532 * disabled. Since copy_from_user can fault and may sleep we
535 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 536 if (copy_from_user(buf, userbuf, len))
539 537 return -EFAULT;
540 538  
... ... @@ -557,8 +555,7 @@
557 555 * switched off.
558 556 */
559 557 if (current_driver_name[0])
560   - printk(KERN_INFO "DMA-API: switching off dma-debug "
561   - "driver filter\n");
  558 + pr_info("DMA-API: switching off dma-debug driver filter\n");
562 559 current_driver_name[0] = 0;
563 560 current_driver = NULL;
564 561 goto out_unlock;
... ... @@ -576,8 +573,8 @@
576 573 current_driver_name[i] = 0;
577 574 current_driver = NULL;
578 575  
579   - printk(KERN_INFO "DMA-API: enable driver filter for driver [%s]\n",
580   - current_driver_name);
  576 + pr_info("DMA-API: enable driver filter for driver [%s]\n",
  577 + current_driver_name);
581 578  
582 579 out_unlock:
583 580 write_unlock_irqrestore(&driver_name_lock, flags);
... ... @@ -594,7 +591,7 @@
594 591 {
595 592 dma_debug_dent = debugfs_create_dir("dma-api", NULL);
596 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 595 return -ENOMEM;
599 596 }
600 597  
... ... @@ -693,7 +690,7 @@
693 690  
694 691 nb = kzalloc(sizeof(struct notifier_block), GFP_KERNEL);
695 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 694 return;
698 695 }
699 696  
... ... @@ -718,8 +715,7 @@
718 715 }
719 716  
720 717 if (dma_debug_fs_init() != 0) {
721   - printk(KERN_ERR "DMA-API: error creating debugfs entries "
722   - "- disabling\n");
  718 + pr_err("DMA-API: error creating debugfs entries - disabling\n");
723 719 global_disable = true;
724 720  
725 721 return;
... ... @@ -729,8 +725,7 @@
729 725 num_entries = req_entries;
730 726  
731 727 if (prealloc_memory(num_entries) != 0) {
732   - printk(KERN_ERR "DMA-API: debugging out of memory error "
733   - "- disabled\n");
  728 + pr_err("DMA-API: debugging out of memory error - disabled\n");
734 729 global_disable = true;
735 730  
736 731 return;
... ... @@ -738,7 +733,7 @@
738 733  
739 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  
744 739 static __init int dma_debug_cmdline(char *str)
... ... @@ -747,8 +742,7 @@
747 742 return -EINVAL;
748 743  
749 744 if (strncmp(str, "off", 3) == 0) {
750   - printk(KERN_INFO "DMA-API: debugging disabled on kernel "
751   - "command line\n");
  745 + pr_info("DMA-API: debugging disabled on kernel command line\n");
752 746 global_disable = true;
753 747 }
754 748  
... ... @@ -1239,8 +1233,8 @@
1239 1233 }
1240 1234  
1241 1235 if (current_driver_name[0])
1242   - printk(KERN_INFO "DMA-API: enable driver filter for "
1243   - "driver [%s]\n", current_driver_name);
  1236 + pr_info("DMA-API: enable driver filter for driver [%s]\n",
  1237 + current_driver_name);
1244 1238  
1245 1239  
1246 1240 return 1;