lkml.org 
[lkml]   [2012]   [Nov]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 7/9] trace: use this_cpu_ptr per-cpu helper
Christoph Lameter said, at 2012/11/10 4:15:
> On Fri, 9 Nov 2012, Shan Wei wrote:
>
>> - return buffer->buffer;
>> + return (char *)this_cpu_ptr(&percpu_buffer->buffer);
>> }
>
> Add a comment to explain the cast?

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 this cast.

I will submit v4 version patch which improve it.

Thanks~


\
 
 \ /
  Last update: 2012-11-12 03:21    [W:0.045 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site