Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1235168 > unrolled thread
| Started by | Yaowei Bai <bywxiaobai@163.com> |
|---|---|
| First post | 2015-09-29 16:50 +0200 |
| Last post | 2015-09-29 16:50 +0200 |
| Articles | 9 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH 0/8] cleanups for trace Yaowei Bai <bywxiaobai@163.com> - 2015-09-29 16:50 +0200
[PATCH 4/8] kernel/ring_buffer: ring_buffer_empty{cpu} can be boolean Yaowei Bai <bywxiaobai@163.com> - 2015-09-29 16:50 +0200
[PATCH 2/8] kernel/trace: report_latency in trace_irqsoff.c can be boolean Yaowei Bai <bywxiaobai@163.com> - 2015-09-29 16:50 +0200
[PATCH 8/8] kernel/trace: ftrace_event_is_function can be boolean Yaowei Bai <bywxiaobai@163.com> - 2015-09-29 16:50 +0200
[PATCH 1/8] kernel/trace: report_latency in trace_sched_wakeup.c can be boolean Yaowei Bai <bywxiaobai@163.com> - 2015-09-29 16:50 +0200
[PATCH 6/8] kernel/trace: rb_event_is_commit can be boolean Yaowei Bai <bywxiaobai@163.com> - 2015-09-29 16:50 +0200
[PATCH 5/8] kernel/ring_buffer: rb_per_cpu_empty can be boolean Yaowei Bai <bywxiaobai@163.com> - 2015-09-29 16:50 +0200
[PATCH 7/8] kernel/trace: is_legal_op can be boolean Yaowei Bai <bywxiaobai@163.com> - 2015-09-29 16:50 +0200
[PATCH 3/8] kernel/trace: rb_is_reader_page can be boolean Yaowei Bai <bywxiaobai@163.com> - 2015-09-29 16:50 +0200
| From | Yaowei Bai <bywxiaobai@163.com> |
|---|---|
| Date | 2015-09-29 16:50 +0200 |
| Subject | [PATCH 0/8] cleanups for trace |
| Message-ID | <qe4oa-ZN-13@gated-at.bofh.it> |
This patchset just make some functions return bool to improve readability
and/or simplicity.
No functional change.
Yaowei Bai (8):
kernel/trace: report_latency in trace_sched_wakeup.c can be boolean
kernel/trace: report_latency in trace_irqsoff.c can be boolean
kernel/trace: rb_is_reader_page can be boolean
kernel/ring_buffer: ring_buffer_empty{cpu} can be boolean
kernel/ring_buffer: rb_per_cpu_empty can be boolean
kernel/trace: rb_event_is_commit can be boolean
kernel/trace: is_legal_op can be boolean
kernel/trace: ftrace_event_is_function can be boolean
include/linux/ring_buffer.h | 4 ++--
kernel/trace/ring_buffer.c | 20 ++++++++++----------
kernel/trace/trace.h | 2 +-
kernel/trace/trace_events_filter.c | 8 ++++----
kernel/trace/trace_export.c | 2 +-
kernel/trace/trace_irqsoff.c | 8 ++++----
kernel/trace/trace_sched_wakeup.c | 8 ++++----
7 files changed, 26 insertions(+), 26 deletions(-)
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Yaowei Bai <bywxiaobai@163.com> |
|---|---|
| Date | 2015-09-29 16:50 +0200 |
| Subject | [PATCH 4/8] kernel/ring_buffer: ring_buffer_empty{cpu} can be boolean |
| Message-ID | <qe4oa-ZN-19@gated-at.bofh.it> |
| In reply to | #1235168 |
This patch makes ring_buffer_empty and ring_buffer_empty_cpu return
bool to improve readability.
No functional change.
Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
---
include/linux/ring_buffer.h | 4 ++--
kernel/trace/ring_buffer.c | 10 +++++-----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index e2c13cd..4acc552 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -154,8 +154,8 @@ ring_buffer_swap_cpu(struct ring_buffer *buffer_a,
}
#endif
-int ring_buffer_empty(struct ring_buffer *buffer);
-int ring_buffer_empty_cpu(struct ring_buffer *buffer, int cpu);
+bool ring_buffer_empty(struct ring_buffer *buffer);
+bool ring_buffer_empty_cpu(struct ring_buffer *buffer, int cpu);
void ring_buffer_record_disable(struct ring_buffer *buffer);
void ring_buffer_record_enable(struct ring_buffer *buffer);
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 26a948f..fc9ce12 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -4267,7 +4267,7 @@ EXPORT_SYMBOL_GPL(ring_buffer_reset);
* rind_buffer_empty - is the ring buffer empty?
* @buffer: The ring buffer to test
*/
-int ring_buffer_empty(struct ring_buffer *buffer)
+bool ring_buffer_empty(struct ring_buffer *buffer)
{
struct ring_buffer_per_cpu *cpu_buffer;
unsigned long flags;
@@ -4285,10 +4285,10 @@ int ring_buffer_empty(struct ring_buffer *buffer)
local_irq_restore(flags);
if (!ret)
- return 0;
+ return false;
}
- return 1;
+ return true;
}
EXPORT_SYMBOL_GPL(ring_buffer_empty);
@@ -4297,7 +4297,7 @@ EXPORT_SYMBOL_GPL(ring_buffer_empty);
* @buffer: The ring buffer
* @cpu: The CPU buffer to test
*/
-int ring_buffer_empty_cpu(struct ring_buffer *buffer, int cpu)
+bool ring_buffer_empty_cpu(struct ring_buffer *buffer, int cpu)
{
struct ring_buffer_per_cpu *cpu_buffer;
unsigned long flags;
@@ -4305,7 +4305,7 @@ int ring_buffer_empty_cpu(struct ring_buffer *buffer, int cpu)
int ret;
if (!cpumask_test_cpu(cpu, buffer->cpumask))
- return 1;
+ return true;
cpu_buffer = buffer->buffers[cpu];
local_irq_save(flags);
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Yaowei Bai <bywxiaobai@163.com> |
|---|---|
| Date | 2015-09-29 16:50 +0200 |
| Subject | [PATCH 2/8] kernel/trace: report_latency in trace_irqsoff.c can be boolean |
| Message-ID | <qe4oa-ZN-27@gated-at.bofh.it> |
| In reply to | #1235168 |
This patch makes report_latency return bool due to this
particular function only using either one or zero as its
return value.
No functional change.
Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
---
kernel/trace/trace_irqsoff.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c
index 8523ea3..ab161bf 100644
--- a/kernel/trace/trace_irqsoff.c
+++ b/kernel/trace/trace_irqsoff.c
@@ -295,16 +295,16 @@ static void irqsoff_print_header(struct seq_file *s)
/*
* Should this new latency be reported/recorded?
*/
-static int report_latency(struct trace_array *tr, cycle_t delta)
+static bool report_latency(struct trace_array *tr, cycle_t delta)
{
if (tracing_thresh) {
if (delta < tracing_thresh)
- return 0;
+ return false;
} else {
if (delta <= tr->max_latency)
- return 0;
+ return false;
}
- return 1;
+ return true;
}
static void
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Yaowei Bai <bywxiaobai@163.com> |
|---|---|
| Date | 2015-09-29 16:50 +0200 |
| Subject | [PATCH 8/8] kernel/trace: ftrace_event_is_function can be boolean |
| Message-ID | <qe4oa-ZN-31@gated-at.bofh.it> |
| In reply to | #1235168 |
This patch makes ftrace_event_is_function return bool to improve readability
due to this particular function only using either one or zero as its
return value.
No functional change.
Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
---
kernel/trace/trace.h | 2 +-
kernel/trace/trace_export.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 74bde81..b7acc4e 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -859,7 +859,7 @@ void ftrace_destroy_filter_files(struct ftrace_ops *ops);
#define ftrace_destroy_filter_files(ops) do { } while (0)
#endif /* CONFIG_FUNCTION_TRACER && CONFIG_DYNAMIC_FTRACE */
-int ftrace_event_is_function(struct trace_event_call *call);
+bool ftrace_event_is_function(struct trace_event_call *call);
/*
* struct trace_parser - servers for reading the user input separated by spaces
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c
index adabf7d..39aa7aa 100644
--- a/kernel/trace/trace_export.c
+++ b/kernel/trace/trace_export.c
@@ -187,7 +187,7 @@ __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call;
FTRACE_ENTRY_REG(call, struct_name, etype, \
PARAMS(tstruct), PARAMS(print), filter, NULL)
-int ftrace_event_is_function(struct trace_event_call *call)
+bool ftrace_event_is_function(struct trace_event_call *call)
{
return call == &event_function;
}
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Yaowei Bai <bywxiaobai@163.com> |
|---|---|
| Date | 2015-09-29 16:50 +0200 |
| Subject | [PATCH 1/8] kernel/trace: report_latency in trace_sched_wakeup.c can be boolean |
| Message-ID | <qe4oa-ZN-35@gated-at.bofh.it> |
| In reply to | #1235168 |
This patch makes report_latency return bool to improve readability,
indicating whether this new latency should be reported/recorded.
No functional change.
Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
---
kernel/trace/trace_sched_wakeup.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/trace/trace_sched_wakeup.c b/kernel/trace/trace_sched_wakeup.c
index 12cbe77..f099a0a 100644
--- a/kernel/trace/trace_sched_wakeup.c
+++ b/kernel/trace/trace_sched_wakeup.c
@@ -342,16 +342,16 @@ static void wakeup_print_header(struct seq_file *s)
/*
* Should this new latency be reported/recorded?
*/
-static int report_latency(struct trace_array *tr, cycle_t delta)
+static bool report_latency(struct trace_array *tr, cycle_t delta)
{
if (tracing_thresh) {
if (delta < tracing_thresh)
- return 0;
+ return false;
} else {
if (delta <= tr->max_latency)
- return 0;
+ return false;
}
- return 1;
+ return true;
}
static void
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Yaowei Bai <bywxiaobai@163.com> |
|---|---|
| Date | 2015-09-29 16:50 +0200 |
| Subject | [PATCH 6/8] kernel/trace: rb_event_is_commit can be boolean |
| Message-ID | <qe4ob-ZN-53@gated-at.bofh.it> |
| In reply to | #1235168 |
This patch makes rb_event_is_commit return bool to improve readability
due to this particular function only using either one or zero as its
return value.
No functional change.
Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
---
kernel/trace/ring_buffer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index a228789..75f1d05 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -2270,7 +2270,7 @@ rb_add_time_stamp(struct ring_buffer_event *event, u64 delta)
return skip_time_extend(event);
}
-static inline int rb_event_is_commit(struct ring_buffer_per_cpu *cpu_buffer,
+static inline bool rb_event_is_commit(struct ring_buffer_per_cpu *cpu_buffer,
struct ring_buffer_event *event);
/**
@@ -2498,7 +2498,7 @@ static inline void rb_event_discard(struct ring_buffer_event *event)
event->time_delta = 1;
}
-static inline int
+static inline bool
rb_event_is_commit(struct ring_buffer_per_cpu *cpu_buffer,
struct ring_buffer_event *event)
{
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Yaowei Bai <bywxiaobai@163.com> |
|---|---|
| Date | 2015-09-29 16:50 +0200 |
| Subject | [PATCH 5/8] kernel/ring_buffer: rb_per_cpu_empty can be boolean |
| Message-ID | <qe4ob-ZN-61@gated-at.bofh.it> |
| In reply to | #1235168 |
This patch makes rb_per_cpu_empty return bool to improve readability.
No functional change.
Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
---
kernel/trace/ring_buffer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index fc9ce12..a228789 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -3039,7 +3039,7 @@ int ring_buffer_write(struct ring_buffer *buffer,
}
EXPORT_SYMBOL_GPL(ring_buffer_write);
-static int rb_per_cpu_empty(struct ring_buffer_per_cpu *cpu_buffer)
+static bool rb_per_cpu_empty(struct ring_buffer_per_cpu *cpu_buffer)
{
struct buffer_page *reader = cpu_buffer->reader_page;
struct buffer_page *head = rb_set_head_page(cpu_buffer);
@@ -3047,7 +3047,7 @@ static int rb_per_cpu_empty(struct ring_buffer_per_cpu *cpu_buffer)
/* In case of error, head will be NULL */
if (unlikely(!head))
- return 1;
+ return true;
return reader->read == rb_page_commit(reader) &&
(commit == reader ||
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Yaowei Bai <bywxiaobai@163.com> |
|---|---|
| Date | 2015-09-29 16:50 +0200 |
| Subject | [PATCH 7/8] kernel/trace: is_legal_op can be boolean |
| Message-ID | <qe4oc-ZN-69@gated-at.bofh.it> |
| In reply to | #1235168 |
This patch makes is_legal_op return bool to improve readability
due to this particular function only using either one or zero as its
return value.
No functional change.
Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
---
kernel/trace/trace_events_filter.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index bd1bf18..f93a219 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -973,15 +973,15 @@ static bool is_string_field(struct ftrace_event_field *field)
field->filter_type == FILTER_PTR_STRING;
}
-static int is_legal_op(struct ftrace_event_field *field, int op)
+static bool is_legal_op(struct ftrace_event_field *field, int op)
{
if (is_string_field(field) &&
(op != OP_EQ && op != OP_NE && op != OP_GLOB))
- return 0;
+ return false;
if (!is_string_field(field) && op == OP_GLOB)
- return 0;
+ return false;
- return 1;
+ return true;
}
static filter_pred_fn_t select_comparison_fn(int op, int field_size,
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Yaowei Bai <bywxiaobai@163.com> |
|---|---|
| Date | 2015-09-29 16:50 +0200 |
| Subject | [PATCH 3/8] kernel/trace: rb_is_reader_page can be boolean |
| Message-ID | <qe4oc-ZN-75@gated-at.bofh.it> |
| In reply to | #1235168 |
This patch makes rb_is_reader_page return bool to improve readability
due to this particular function only using either one or zero as its
return value.
No functional change.
Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
---
kernel/trace/ring_buffer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index fc347f8..26a948f 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -829,7 +829,7 @@ rb_is_head_page(struct ring_buffer_per_cpu *cpu_buffer,
* writer is ever on it, the previous pointer never points
* back to the reader page.
*/
-static int rb_is_reader_page(struct buffer_page *page)
+static bool rb_is_reader_page(struct buffer_page *page)
{
struct list_head *list = page->list.prev;
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web