Skip to contentSkip to conversation

make kernel-doc understand TRACE_EVENT() macro

PATCH In review Jason Baron 3 participants 5 messages Apr 29, 2009 – Apr 30, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 make kernel-doc understand TRACE_EVENT() macro

Add support to kernel-doc for tracepoint comments above TRACE_EVENT() macro definitions. Paves the way for tracepoint docbook.

---
 scripts/kernel-doc |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
scripts/kernel-doc +21 -0
index 0f11870..9d9ab4b 100755
@@ -1827,6 +1827,24 @@ sub reset_state {
     $state = 0;
 }
 
+sub tracepoint_munge() {
+	my $tracepointname = 0;
+	my $tracepointargs = 0;
+
+	if($prototype =~ m/TRACE_EVENT\((.*?),/) {
+		$tracepointname = $1;
+	}
+	if($prototype =~ m/TP_PROTO\((.*?)\)/) {
+		$tracepointargs = $1;
+	}
+	if (($tracepointname eq 0) || ($tracepointargs eq 0)) {
+		print STDERR "Warning: Unrecognized tracepoint format: \n" .
+			     "$prototype\n"
+	} else {
+		$prototype = "static inline void trace_$tracepointname($tracepointargs)";
+	}
+}
+
 sub syscall_munge() {
 	my $void = 0;
 
@@ -1881,6 +1899,9 @@ sub process_state3_function($$) {
 	if ($prototype =~ /SYSCALL_DEFINE/) {
 		syscall_munge();
 	}
+	if ($prototype =~ /TRACE_EVENT/) {
+		tracepoint_munge();
+	}
 	dump_function($prototype, $file);
 	reset_state();
     }
Signature · 1 line
1.5.4.5
#1 lore raw
Quoted 21 lines · Jason Baron

Add support to kernel-doc for tracepoint comments above TRACE_EVENT() macro definitions. Paves the way for tracepoint docbook.

---
 scripts/kernel-doc |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
scripts/kernel-doc +3 -0
index 0f11870..9d9ab4b 100755
@@ -1827,6 +1827,24 @@ sub reset_state {
     $state = 0;
 }
 
+sub tracepoint_munge() {
+	my $tracepointname = 0;
+	my $tracepointargs = 0;

scripts/kernel-doc sub reset_state { · line 1842

Quoted 10 lines
scripts/kernel-doc +10 -0
+
+	if($prototype =~ m/TRACE_EVENT\((.*?),/) {
+		$tracepointname = $1;
+	}
+	if($prototype =~ m/TP_PROTO\((.*?)\)/) {
+		$tracepointargs = $1;
+	}
+	if (($tracepointname eq 0) || ($tracepointargs eq 0)) {
+		print STDERR "Warning: Unrecognized tracepoint format: \n" .
+			     "$prototype\n"

I'd prefer for this warning to use the usual kernel-doc warning format, with file:line information:

		print STDERR "Warning(${file}:$.): Unrecognized ....

Otherwise, looks good. Thanks.

Quoted 18 lines
scripts/kernel-doc +8 -0
+	} else {
+		$prototype = "static inline void trace_$tracepointname($tracepointargs)";
+	}
+}
+
 sub syscall_munge() {
 	my $void = 0;
 
@@ -1881,6 +1899,9 @@ sub process_state3_function($$) {
 	if ($prototype =~ /SYSCALL_DEFINE/) {
 		syscall_munge();
 	}
+	if ($prototype =~ /TRACE_EVENT/) {
+		tracepoint_munge();
+	}
 	dump_function($prototype, $file);
 	reset_state();
     }
Signature · 1 line
~Randy
#2 lore raw
Quoted 36 lines · Randy Dunlap
Quoted 21 lines · Jason Baron

Add support to kernel-doc for tracepoint comments above TRACE_EVENT() macro definitions. Paves the way for tracepoint docbook.

---
 scripts/kernel-doc |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
scripts/kernel-doc +3 -0
index 0f11870..9d9ab4b 100755
@@ -1827,6 +1827,24 @@ sub reset_state {
     $state = 0;
 }
 
+sub tracepoint_munge() {
+	my $tracepointname = 0;
+	my $tracepointargs = 0;

scripts/kernel-doc sub reset_state { · line 1842

Quoted 10 lines
scripts/kernel-doc +10 -0
+
+	if($prototype =~ m/TRACE_EVENT\((.*?),/) {
+		$tracepointname = $1;
+	}
+	if($prototype =~ m/TP_PROTO\((.*?)\)/) {
+		$tracepointargs = $1;
+	}
+	if (($tracepointname eq 0) || ($tracepointargs eq 0)) {
+		print STDERR "Warning: Unrecognized tracepoint format: \n" .
+			     "$prototype\n"

I'd prefer for this warning to use the usual kernel-doc warning format, with file:line information:

Quoted 1 line
		print STDERR "Warning(${file}:$.): Unrecognized ....

Good point - i'll wait for v2. Or would you like to carry them in your kernel-doc tree?

This bit:

 include/trace/events/irq.h            |   46 ++++++++++++++++++++++++++++++---

Has changed in the tracing tree so it's probably better to carry it there - once your review feedback has been addressed and once your Acked-by is propagated into the patches.

Thanks,

Ingo

#3 lore raw
Quoted 42 lines · Ingo Molnar
Quoted 35 lines · Randy Dunlap
Quoted 21 lines · Jason Baron

Add support to kernel-doc for tracepoint comments above TRACE_EVENT() macro definitions. Paves the way for tracepoint docbook.

---
 scripts/kernel-doc |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
scripts/kernel-doc +3 -0
index 0f11870..9d9ab4b 100755
@@ -1827,6 +1827,24 @@ sub reset_state {
     $state = 0;
 }
 
+sub tracepoint_munge() {
+	my $tracepointname = 0;
+	my $tracepointargs = 0;

scripts/kernel-doc sub reset_state { · line 1842

Quoted 10 lines
scripts/kernel-doc +10 -0
+
+	if($prototype =~ m/TRACE_EVENT\((.*?),/) {
+		$tracepointname = $1;
+	}
+	if($prototype =~ m/TP_PROTO\((.*?)\)/) {
+		$tracepointargs = $1;
+	}
+	if (($tracepointname eq 0) || ($tracepointargs eq 0)) {
+		print STDERR "Warning: Unrecognized tracepoint format: \n" .
+			     "$prototype\n"

I'd prefer for this warning to use the usual kernel-doc warning format, with file:line information:

Quoted 1 line
		print STDERR "Warning(${file}:$.): Unrecognized ....

Good point - i'll wait for v2. Or would you like to carry them in your kernel-doc tree?

Quoted 7 lines

This bit:

 include/trace/events/irq.h            |   46 ++++++++++++++++++++++++++++++---

Has changed in the tracing tree so it's probably better to carry it there - once your review feedback has been addressed and once your Acked-by is propagated into the patches.

Yes, that's fine with me. Thanks.

Signature · 1 line
~Randy
#4 lore raw
In reply to Randy Dunlap
Quoted 8 lines · Randy Dunlap

I'd prefer for this warning to use the usual kernel-doc warning format, with file:line information:

		print STDERR "Warning(${file}:$.): Unrecognized ....

Otherwise, looks good. Thanks.

ok, updated patch:

Add support to kernel-doc script for tracepoint comments above TRACE_EVENT() macro definitions. Paves the way for tracepoint docbook.

---

 scripts/kernel-doc |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
scripts/kernel-doc +22 -0
index 0f11870..2b53a55 100755
@@ -1827,6 +1827,25 @@ sub reset_state {
     $state = 0;
 }
 
+sub tracepoint_munge($) {
+	my $file = shift;
+	my $tracepointname = 0;
+	my $tracepointargs = 0;
+
+	if($prototype =~ m/TRACE_EVENT\((.*?),/) {
+		$tracepointname = $1;
+	}
+	if($prototype =~ m/TP_PROTO\((.*?)\)/) {
+		$tracepointargs = $1;
+	}
+	if (($tracepointname eq 0) || ($tracepointargs eq 0)) {
+		print STDERR "Warning(${file}:$.): Unrecognized tracepoint format: \n".
+			     "$prototype\n";
+	} else {
+		$prototype = "static inline void trace_$tracepointname($tracepointargs)";
+	}
+}
+
 sub syscall_munge() {
 	my $void = 0;
 
@@ -1881,6 +1900,9 @@ sub process_state3_function($$) {
 	if ($prototype =~ /SYSCALL_DEFINE/) {
 		syscall_munge();
 	}
+	if ($prototype =~ /TRACE_EVENT/) {
+		tracepoint_munge($file);
+	}
 	dump_function($prototype, $file);
 	reset_state();
     }