From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Chunyan Zhang <zhang.chunyan@linaro.org>,
Felipe Balbi <felipe.balbi@linux.intel.com>
Subject: [for-next][PATCH 6/7] tracing: Pass export pointer as argument to ->write()
Date: Wed, 13 Dec 2017 15:47:02 -0500 [thread overview]
Message-ID: <20171213204738.018173078@goodmis.org> (raw)
In-Reply-To: 20171213204656.366789624@goodmis.org
[-- Attachment #1: 0006-tracing-Pass-export-pointer-as-argument-to-write.patch --]
[-- Type: text/plain, Size: 2255 bytes --]
From: Felipe Balbi <felipe.balbi@linux.intel.com>
By passing an export descriptor to the write function, users don't need to
keep a global static pointer and can rely on container_of() to fetch their
own structure.
Link: http://lkml.kernel.org/r/20170602102025.5140-1-felipe.balbi@linux.intel.com
Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Reviewed-by: Chunyan Zhang <zhang.chunyan@linaro.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
drivers/hwtracing/stm/ftrace.c | 6 ++++--
include/linux/trace.h | 2 +-
kernel/trace/trace.c | 2 +-
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/hwtracing/stm/ftrace.c b/drivers/hwtracing/stm/ftrace.c
index bd126a7c6da2..7da75644c750 100644
--- a/drivers/hwtracing/stm/ftrace.c
+++ b/drivers/hwtracing/stm/ftrace.c
@@ -42,9 +42,11 @@ static struct stm_ftrace {
* @len: length of the data packet
*/
static void notrace
-stm_ftrace_write(const void *buf, unsigned int len)
+stm_ftrace_write(struct trace_export *export, const void *buf, unsigned int len)
{
- stm_source_write(&stm_ftrace.data, STM_FTRACE_CHAN, buf, len);
+ struct stm_ftrace *stm = container_of(export, struct stm_ftrace, ftrace);
+
+ stm_source_write(&stm->data, STM_FTRACE_CHAN, buf, len);
}
static int stm_ftrace_link(struct stm_source_data *data)
diff --git a/include/linux/trace.h b/include/linux/trace.h
index d24991c1fef3..b95ffb2188ab 100644
--- a/include/linux/trace.h
+++ b/include/linux/trace.h
@@ -18,7 +18,7 @@
*/
struct trace_export {
struct trace_export __rcu *next;
- void (*write)(const void *, unsigned int);
+ void (*write)(struct trace_export *, const void *, unsigned int);
};
int register_ftrace_export(struct trace_export *export);
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 9f3f043ba3b7..59518b8126d0 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2415,7 +2415,7 @@ trace_process_export(struct trace_export *export,
entry = ring_buffer_event_data(event);
size = ring_buffer_event_length(event);
- export->write(entry, size);
+ export->write(export, entry, size);
}
static DEFINE_MUTEX(ftrace_export_lock);
--
2.13.2
next prev parent reply other threads:[~2017-12-13 20:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-13 20:46 [for-next][PATCH 0/7] tracing: Fixes for 4.15 Steven Rostedt
2017-12-13 20:46 ` [for-next][PATCH 1/7] tracing: Fix code comments in trace.c Steven Rostedt
2017-12-13 20:46 ` [for-next][PATCH 2/7] tracing: always define trace_{irq,preempt}_{enable_disable} Steven Rostedt
2017-12-13 20:46 ` [for-next][PATCH 3/7] tracing: Allocate mask_str buffer dynamically Steven Rostedt
2017-12-13 20:47 ` [for-next][PATCH 4/7] tracing: make PREEMPTIRQ_EVENTS depend on TRACING Steven Rostedt
2017-12-13 20:47 ` [for-next][PATCH 5/7] ring-buffer: Remove unused function __rb_data_page_index() Steven Rostedt
2017-12-13 20:47 ` Steven Rostedt [this message]
2017-12-13 20:47 ` [for-next][PATCH 7/7] tracing: Have stack trace not record if RCU is not watching Steven Rostedt
2017-12-14 4:34 ` Paul E. McKenney
2017-12-15 1:47 ` Steven Rostedt
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=20171213204738.018173078@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=felipe.balbi@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=zhang.chunyan@linaro.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.