From: Joerg Roedel <joerg.roedel@amd.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org,
Joerg Roedel <joerg.roedel@amd.com>
Subject: [PATCH 3/5] dma-debug: use pr_* instead of printk(KERN_* ...)
Date: Mon, 8 Jun 2009 16:34:08 +0200 [thread overview]
Message-ID: <1244471650-4632-4-git-send-email-joerg.roedel@amd.com> (raw)
In-Reply-To: <1244471650-4632-1-git-send-email-joerg.roedel@amd.com>
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>
---
lib/dma-debug.c | 36 +++++++++++++++---------------------
1 files changed, 15 insertions(+), 21 deletions(-)
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index 9561825..24c4a2c 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)
{
#ifdef CONFIG_STACKTRACE
if (entry) {
- printk(KERN_WARNING "Mapped at:\n");
+ pr_warning("Mapped at:\n");
print_stack_trace(&entry->stacktrace, 0);
}
#endif
@@ -377,8 +377,7 @@ static struct dma_debug_entry *dma_entry_alloc(void)
spin_lock_irqsave(&free_entries_lock, flags);
if (list_empty(&free_entries)) {
- printk(KERN_ERR "DMA-API: debugging out of memory "
- "- disabling\n");
+ pr_err("DMA-API: debugging out of memory - disabling\n");
global_disable = true;
goto out;
}
@@ -483,8 +482,7 @@ static int prealloc_memory(u32 num_entries)
num_free_entries = num_entries;
min_free_entries = num_entries;
- printk(KERN_INFO "DMA-API: preallocated %d debug entries\n",
- num_entries);
+ pr_info("DMA-API: preallocated %d debug entries\n", num_entries);
return 0;
@@ -534,7 +532,7 @@ static ssize_t filter_write(struct file *file, const char __user *userbuf,
* disabled. Since copy_from_user can fault and may sleep we
* need to copy to temporary buffer first
*/
- len = min(count, NAME_MAX_LEN - 1);
+ len = min(count, (size_t)(NAME_MAX_LEN - 1));
if (copy_from_user(buf, userbuf, len))
return -EFAULT;
@@ -557,8 +555,7 @@ static ssize_t filter_write(struct file *file, const char __user *userbuf,
* switched off.
*/
if (current_driver_name[0])
- printk(KERN_INFO "DMA-API: switching off dma-debug "
- "driver filter\n");
+ pr_info("DMA-API: switching off dma-debug driver filter\n");
current_driver_name[0] = 0;
current_driver = NULL;
goto out_unlock;
@@ -576,8 +573,8 @@ static ssize_t filter_write(struct file *file, const char __user *userbuf,
current_driver_name[i] = 0;
current_driver = NULL;
- printk(KERN_INFO "DMA-API: enable driver filter for driver [%s]\n",
- current_driver_name);
+ pr_info("DMA-API: enable driver filter for driver [%s]\n",
+ current_driver_name);
out_unlock:
write_unlock_irqrestore(&driver_name_lock, flags);
@@ -594,7 +591,7 @@ static int dma_debug_fs_init(void)
{
dma_debug_dent = debugfs_create_dir("dma-api", NULL);
if (!dma_debug_dent) {
- printk(KERN_ERR "DMA-API: can not create debugfs directory\n");
+ pr_err("DMA-API: can not create debugfs directory\n");
return -ENOMEM;
}
@@ -693,7 +690,7 @@ void dma_debug_add_bus(struct bus_type *bus)
nb = kzalloc(sizeof(struct notifier_block), GFP_KERNEL);
if (nb == NULL) {
- printk(KERN_ERR "dma_debug_add_bus: out of memory\n");
+ pr_err("dma_debug_add_bus: out of memory\n");
return;
}
@@ -718,8 +715,7 @@ void dma_debug_init(u32 num_entries)
}
if (dma_debug_fs_init() != 0) {
- printk(KERN_ERR "DMA-API: error creating debugfs entries "
- "- disabling\n");
+ pr_err("DMA-API: error creating debugfs entries - disabling\n");
global_disable = true;
return;
@@ -729,8 +725,7 @@ void dma_debug_init(u32 num_entries)
num_entries = req_entries;
if (prealloc_memory(num_entries) != 0) {
- printk(KERN_ERR "DMA-API: debugging out of memory error "
- "- disabled\n");
+ pr_err("DMA-API: debugging out of memory error - disabled\n");
global_disable = true;
return;
@@ -738,7 +733,7 @@ void dma_debug_init(u32 num_entries)
nr_total_entries = num_free_entries;
- printk(KERN_INFO "DMA-API: debugging enabled by kernel config\n");
+ pr_info("DMA-API: debugging enabled by kernel config\n");
}
static __init int dma_debug_cmdline(char *str)
@@ -747,8 +742,7 @@ static __init int dma_debug_cmdline(char *str)
return -EINVAL;
if (strncmp(str, "off", 3) == 0) {
- printk(KERN_INFO "DMA-API: debugging disabled on kernel "
- "command line\n");
+ pr_info("DMA-API: debugging disabled on kernel command line\n");
global_disable = true;
}
@@ -1239,8 +1233,8 @@ static int __init dma_debug_driver_setup(char *str)
}
if (current_driver_name[0])
- printk(KERN_INFO "DMA-API: enable driver filter for "
- "driver [%s]\n", current_driver_name);
+ pr_info("DMA-API: enable driver filter for driver [%s]\n",
+ current_driver_name);
return 1;
--
1.6.3.1
next prev parent reply other threads:[~2009-06-08 14:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-08 14:34 [git pull][PATCH 0/5] dma-debug minor fixes and cleanups Joerg Roedel
2009-06-08 14:34 ` [PATCH 1/5] dma-debug: comment style fixes Joerg Roedel
2009-06-08 14:34 ` [PATCH 2/5] dma-debug: code " Joerg Roedel
2009-06-08 14:34 ` Joerg Roedel [this message]
2009-06-08 14:34 ` [PATCH 4/5] dma-debug: disable/enable irqs only once in device_dma_allocations Joerg Roedel
2009-07-23 18:43 ` Leon Woestenberg
2009-06-08 14:34 ` [PATCH 5/5] dma-debug: simplify logic in driver_filter() Joerg Roedel
2009-06-08 15:29 ` [git pull][PATCH 0/5] dma-debug minor fixes and cleanups Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1244471650-4632-4-git-send-email-joerg.roedel@amd.com \
--to=joerg.roedel@amd.com \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®