mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-08 15:33:47 +00:00
tracing: Use this_cpu_ptr per-cpu helper
typeof(&buffer) is a pointer to array of 1024 char, or char (*)[1024]. But, typeof(&buffer[0]) is a pointer to char which match the return type of get_trace_buf(). As well-known, the value of &buffer is equal to &buffer[0]. so return this_cpu_ptr(&percpu_buffer->buffer[0]) can avoid type cast. Link: http://lkml.kernel.org/r/50A1A800.3020102@gmail.com Reviewed-by: Christoph Lameter <cl@linux.com> Signed-off-by: Shan Wei <davidshan@tencent.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
This commit is contained in:
parent
771e03842a
commit
d8a0349c0c
2 changed files with 2 additions and 5 deletions
|
@ -147,7 +147,7 @@ void __trace_note_message(struct blk_trace *bt, const char *fmt, ...)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
local_irq_save(flags);
|
local_irq_save(flags);
|
||||||
buf = per_cpu_ptr(bt->msg_data, smp_processor_id());
|
buf = this_cpu_ptr(bt->msg_data);
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
n = vscnprintf(buf, BLK_TN_MAX_MSG, fmt, args);
|
n = vscnprintf(buf, BLK_TN_MAX_MSG, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
|
@ -1517,7 +1517,6 @@ static struct trace_buffer_struct *trace_percpu_nmi_buffer;
|
||||||
static char *get_trace_buf(void)
|
static char *get_trace_buf(void)
|
||||||
{
|
{
|
||||||
struct trace_buffer_struct *percpu_buffer;
|
struct trace_buffer_struct *percpu_buffer;
|
||||||
struct trace_buffer_struct *buffer;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we have allocated per cpu buffers, then we do not
|
* If we have allocated per cpu buffers, then we do not
|
||||||
|
@ -1535,9 +1534,7 @@ static char *get_trace_buf(void)
|
||||||
if (!percpu_buffer)
|
if (!percpu_buffer)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
buffer = per_cpu_ptr(percpu_buffer, smp_processor_id());
|
return this_cpu_ptr(&percpu_buffer->buffer[0]);
|
||||||
|
|
||||||
return buffer->buffer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int alloc_percpu_trace_buffer(void)
|
static int alloc_percpu_trace_buffer(void)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue