On Wed, Oct 30, 2019 at 12:15:30PM -0700, Joe Perches wrote: > On Wed, 2019-10-30 at 21:46 +0300, Dan Carpenter wrote: > > Hm... I imagined the checkpatch code a little different in my head but > > this would also work to make it stricter. I doubt it miss very many > > real life style problems. > > Well, doubts vs reality... > > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > [] > > @@ -3607,7 +3607,7 @@ sub process { > > > > # if/while/etc brace do not go on next line, unless defining a do while loop, > > # or if that brace on the next line is for something else > > - if ($line =~ /(.*)\b((?:if|while|for|switch|(?:[a-z_]+|)for_each[a-z_]+)\s*\(|do\b|else\b)/ && $line !~ /^.\s*\#/) { > > + if ($line =~ /(.*)\b((?:if|while|for|switch|(?:list|hlist)_for_each[a-z_]+)\s*\(|do\b|else\b)/ && $line !~ /^.\s*\#/) { > > my $pre_ctx = "$1$2"; > > > > my ($level, @ctx) = ctx_statement_level($linenr, $realcnt, 0); > > So - nak > What I mean is that only the people doing list_for_each and hlist_for_each don't know how to do it right. I just tested this over night and my assumptions were correct. Here are all the lines that generate a warning: + hlist_for_each_entry_safe(tmp_fil, n, head, fnode) +static void list_test_list_for_each_prev(struct kunit *test) +static void list_test_list_for_each_safe(struct kunit *test) +static void list_test_list_for_each_prev_safe(struct kunit *test) +static void list_test_list_for_each_entry(struct kunit *test) +static void list_test_list_for_each_entry_reverse(struct kunit *test) + hlist_for_each_entry_safe(x6spi, n, + list_for_each_entry(w, &card->widgets, list) Only the first and last warnings are real style problems and my patch catches both. regards, dan carpenter