Skip to contentSkip to conversation

ring-buffer: Wrap open-coded WARN_ONCE

PATCH In review Borislav Petkov 1 participant 2 messages May 2, 2010 – May 4, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ring-buffer: Wrap open-coded WARN_ONCE

Wrap open-coded WARN_ONCE functionality into the equivalent macro.

---
 kernel/trace/ring_buffer.c |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)
kernel/trace/ring_buffer.c +5 -9
index 41ca394..19a7407 100644
@@ -1979,17 +1979,13 @@ rb_add_time_stamp(struct ring_buffer_per_cpu *cpu_buffer,
 		  u64 *ts, u64 *delta)
 {
 	struct ring_buffer_event *event;
-	static int once;
 	int ret;
 
-	if (unlikely(*delta > (1ULL << 59) && !once++)) {
-		printk(KERN_WARNING "Delta way too big! %llu"
-		       " ts=%llu write stamp = %llu\n",
-		       (unsigned long long)*delta,
-		       (unsigned long long)*ts,
-		       (unsigned long long)cpu_buffer->write_stamp);
-		WARN_ON(1);
-	}
+	WARN_ONCE(*delta > (1ULL << 59),
+		  KERN_WARNING "Delta way too big! %llu ts=%llu write stamp = %llu\n",
+		  (unsigned long long)*delta,
+		  (unsigned long long)*ts,
+		  (unsigned long long)cpu_buffer->write_stamp);
 
 	/*
 	 * The delta is too big, we to add a
Signature · 6 lines
1.7.0.3


-- 
Regards/Gruss,
    Boris.
#1 lore raw
Commit-ID:  956097912c40a03bf22603a3be73503fd9ea9e44
Gitweb:     http://git.kernel.org/tip/956097912c40a03bf22603a3be73503fd9ea9e44
Author:     Borislav Petkov <[email protected]>
AuthorDate: Sun, 2 May 2010 08:03:54 +0200
Committer:  Steven Rostedt <[email protected]>
CommitDate: Tue, 4 May 2010 12:23:47 -0400

ring-buffer: Wrap open-coded WARN_ONCE

Wrap open-coded WARN_ONCE functionality into the equivalent macro.

LKML-Reference: <[email protected]>

---
 kernel/trace/ring_buffer.c |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)
kernel/trace/ring_buffer.c +5 -9
index 2a09044..7f6059c 100644
@@ -2000,17 +2000,13 @@ rb_add_time_stamp(struct ring_buffer_per_cpu *cpu_buffer,
 		  u64 *ts, u64 *delta)
 {
 	struct ring_buffer_event *event;
-	static int once;
 	int ret;
 
-	if (unlikely(*delta > (1ULL << 59) && !once++)) {
-		printk(KERN_WARNING "Delta way too big! %llu"
-		       " ts=%llu write stamp = %llu\n",
-		       (unsigned long long)*delta,
-		       (unsigned long long)*ts,
-		       (unsigned long long)cpu_buffer->write_stamp);
-		WARN_ON(1);
-	}
+	WARN_ONCE(*delta > (1ULL << 59),
+		  KERN_WARNING "Delta way too big! %llu ts=%llu write stamp = %llu\n",
+		  (unsigned long long)*delta,
+		  (unsigned long long)*ts,
+		  (unsigned long long)cpu_buffer->write_stamp);
 
 	/*
 	 * The delta is too big, we to add a