Re: [PATCH v3] tracepoint: add new `tcp:tcp_ca_event` trace event

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2023/8/16 23:02, Steven Rostedt wrote:
> On Wed, 16 Aug 2023 14:09:06 +0800
> Manjusaka <me@xxxxxxxxxxxx> wrote:
> 
>>> +# trace include files use a completely different grammar
>>> +		next if ($realfile =~ m{(?:include/trace/events/|/trace\.h$/)});
>>> +
>>>  # check multi-line statement indentation matches previous line
>>>  		if ($perl_version_ok &&
>>>  		    $prevline =~ /^\+([ \t]*)((?:$c90_Keywords(?:\s+if)\s*)|(?:$Declare\s*)?(?:$Ident|\(\s*\*\s*$Ident\s*\))\s*|(?:\*\s*)*$Lval\s*=\s*$Ident\s*)\(.*(\&\&|\|\||,)\s*$/) {
>>>
>>>
>>>   
>>
>> Actually, I'm not sure this is the checkpatch style issue or my code style issue.
>>
>> Seems wired.
> 
> The TRACE_EVENT() macro has its own style. I need to document it, and
> perhaps one day get checkpatch to understand it as well.
> 
> The TRACE_EVENT() typically looks like:
> 
> 
> TRACE_EVENT(name,
> 
> 	TP_PROTO(int arg1, struct foo *arg2, struct bar *arg3),
> 
> 	TP_ARGS(arg1, arg2, arg3),
> 
> 	TP_STRUCT__entry(
> 		__field(	int,		field1				)
> 		__array(	char,		mystring,	MYSTRLEN	)
> 		__string(	filename,	arg3->name			)
> 	),
> 
> 	TP_fast_assign(
> 		__entry->field1 = arg1;
> 		memcpy(__entry->mystring, arg2->string);
> 		__assign_str(filename, arg3->name);
> 	),
> 
> 	TP_printk("field1=%d mystring=%s filename=%s",
> 		__entry->field1, __entry->mystring, __get_str(filename))
> );
> 
> The TP_STRUCT__entry() should be considered more of a "struct" layout than
> a macro layout, and that's where checkpatch gets confused. The spacing
> makes it much easier to see the fields and their types.
> 
> -- Steve

Thanks for the explain!

So could I keep the current code without any code style change?

I think it would be a good idea to fix the checkpatch.pl script in another patch




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux