* [PATCH] reformat_with_checkpatch: Add automation to checkpatch @ 2014-07-12 1:21 Joe Perches 2014-07-12 1:34 ` Greg KH ` (4 more replies) 0 siblings, 5 replies; 27+ messages in thread From: Joe Perches @ 2014-07-12 1:21 UTC (permalink / raw) To: devel, kernel-janitors, kernelnewbies Cc: LKML, Dan Carpenter, Greg KH, Andrew Morton A simple script to run checkpatch --fix for various types of of cleanups. This script is useful primarily for staging. This reformats code to a more CodingStyle conforming style, compiles it, verifies that the object code hasn't changed, and git commits it too. You must have the necessary development tools, git, and a recent git tree. Ideally use Greg KH's staging-next, which can be retrieved via these commands: git clone git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git git checkout staging-next To use this script try a sequence of commands like: cd <linux_repository> git checkout -b <your_branch> make allyesconfig mkdir patches ./scripts/reformat_with_checkpatch.sh drivers/staging/<dir>/*.[ch] git format-patch --cover-letter -o patches/<your_branch> staging-next git send-email patches/<your_branch> Signed-off-by: Joe Perches <joe@perches.com> --- scripts/reformat_with_checkpatch.sh | 141 ++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100755 scripts/reformat_with_checkpatch.sh diff --git a/scripts/reformat_with_checkpatch.sh b/scripts/reformat_with_checkpatch.sh new file mode 100755 index 0000000..5415a8e --- /dev/null +++ b/scripts/reformat_with_checkpatch.sh @@ -0,0 +1,141 @@ +#!/bin/bash +# (c) 2014, Joe Perches <joe@perches.com> +# +# Automate checkpatch modifications and git commits to +# neaten code that doesn't conform to CodingStyle. +# Useful primarily for files in drivers/staging +# +# Licensed under the terms of the GNU GPL License version 2 + +declare -ar whitespace_types=( \ + 'whitespace_neatening:spacing,space_before_tab,pointer_location,trailing_whitespace,bracket_space' \ + 'remove_spaces_before_tabs:space_before_tab' \ + 'fix_label_positions:indented_label' \ + 'align_arguments_to_parenthesis:parenthesis_alignment' \ +) + +declare -ar changecode_types=( \ + 'fix_brace_positions:open_brace,braces,else_after_brace,while_after_brace' \ + 'fix_blank_lines:line_spacing' \ + 'use_standard_attributes:prefer_packed,prefer_aligned' \ + 'remove_unnecessary_externs:avoid_externs' \ + 'update_c90_comment_style:c99_comments' \ +) + +checkpatch_update () +{ + file=$1 + + desc=$(echo $2 | cut -f1 -d: | sed 's/_/ /g') + types=$(echo $2 | cut -f2- -d:) + + echo "file: <$file> description: <$desc> types:<$types>" + + ./scripts/checkpatch.pl --file --fix-inplace --strict --types="$types" $file + + checkpatch_fixes=$file.diff + git diff --stat -p --exit-code $file > $checkpatch_fixes + if [ $? == 0 ] ; then + rm -f $checkpatch_fixes + return + fi + + basename=$(basename $file) + if [ "${basename##*.}" == "c" ] ; then + + git checkout $file + obj="$(echo $file | sed 's/\.c$/\.o/')" + if [ -e $obj ] ; then + rm -f $obj + fi + + echo "Compiling original version..." + + ${CROSS_COMPILE}make $obj + + ${CROSS_COMPILE}objdump -D $obj | \ + sed "s/^[[:space:]]\+[0-9a-f]\+//" > $obj.old + + patch -p1 < $checkpatch_fixes + + echo "Compiling modified version..." + + ${CROSS_COMPILE}make $obj + + ${CROSS_COMPILE}objdump -D $obj | \ + sed "s/^[[:space:]]\+[0-9a-f]\+//" > $obj.new + + echo "Comparing objects..." + diff -Nurd $obj.new $obj.old + if [ $? -ne 0 ] ; then + echo "Object differences exist! - Verify changes before commit!" + read -s -p "Press the 'enter' key to continue: " + else + echo "No object differences found" + fi + rm -f $obj.old + rm -f $obj.new + fi + + echo "running checkpatch on possible checkpatch fixes..." + + ./scripts/checkpatch.pl --no-summary --no-signoff $checkpatch_fixes + rm -f $checkpatch_fixes + + echo "Verify checkpatch output and make any necessary changes" + echo "Edit '$file' if appropriate" + read -s -p "Press the 'enter' key to continue: " + + commit_log_file=$(mktemp git_commit.XXXXXX) + + if [ -e $commit_log_file ] ; then + rm -f $commit_log_file + fi + + if [[ $file =~ ^drivers/staging/ ]] ; then + echo -n "staging: " >> $commit_log_file + fi + echo "$(basename $(dirname $file)): checkpatch cleanup: $desc" >> $commit_log_file + echo "" >> $commit_log_file + git diff --exit-code -w $file > /dev/null + if [ $? == 0 ] ; then + echo "whitespace changes only - git diff -w shows no difference" >> $commit_log_file + fi + + git diff $file | cat + + echo "Ready to commit - First verify all diffs and make any necessary changes" + echo "" + read -r -p "Would you like to commit these changes <y>: " response + response=${response,,} + if [[ $response =~ ^(yes|y|)$ ]] ; then + git commit -s -F $commit_log_file -e $file + else + git checkout $file + fi + + rm -f $commit_log_file +} + +which git > /dev/null +if [ $? -ne 0 ] || [ ! -e .git ] ; then + echo "git or git directory not found - run this from the top of the source tree" + exit 1 +fi + +for file in "$@" ; do + + if [ ! -f $file ] ; then + echo "Argument '$file' is not a file" + continue + fi + + for type in "${whitespace_types[@]}" ; do + checkpatch_update $file $type + done + + for type in "${changecode_types[@]}" ; do + checkpatch_update $file $type + done + +done -- 1.8.1.2.459.gbcd45b4.dirty ^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH] reformat_with_checkpatch: Add automation to checkpatch 2014-07-12 1:21 [PATCH] reformat_with_checkpatch: Add automation to checkpatch Joe Perches @ 2014-07-12 1:34 ` Greg KH 2014-07-12 1:40 ` Joe Perches 2014-07-12 1:39 ` Greg KH ` (3 subsequent siblings) 4 siblings, 1 reply; 27+ messages in thread From: Greg KH @ 2014-07-12 1:34 UTC (permalink / raw) To: Joe Perches Cc: devel, kernel-janitors, kernelnewbies, LKML, Dan Carpenter, Andrew Morton On Fri, Jul 11, 2014 at 06:21:27PM -0700, Joe Perches wrote: > A simple script to run checkpatch --fix for various types of > of cleanups. > > This script is useful primarily for staging. > > This reformats code to a more CodingStyle conforming style, > compiles it, verifies that the object code hasn't changed, > and git commits it too. And 'git commits' it? Heh, I should just run this myself to clean up staging and beat everyone else to it... I know some people already have private versions of these things, might as well make it public for all to abuse :) thanks, greg k-h ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] reformat_with_checkpatch: Add automation to checkpatch 2014-07-12 1:34 ` Greg KH @ 2014-07-12 1:40 ` Joe Perches 2014-07-12 2:34 ` Greg KH 2014-07-12 9:30 ` Dan Carpenter 0 siblings, 2 replies; 27+ messages in thread From: Joe Perches @ 2014-07-12 1:40 UTC (permalink / raw) To: Greg KH Cc: devel, kernel-janitors, kernelnewbies, LKML, Dan Carpenter, Andrew Morton On Fri, 2014-07-11 at 18:34 -0700, Greg KH wrote: > On Fri, Jul 11, 2014 at 06:21:27PM -0700, Joe Perches wrote: > > A simple script to run checkpatch --fix for various types of > > of cleanups. > > > > This script is useful primarily for staging. > > > > This reformats code to a more CodingStyle conforming style, > > compiles it, verifies that the object code hasn't changed, > > and git commits it too. > > And 'git commits' it? The thought I had was to made it easier to submit "my first kernel patch" correctly. like that tuxradar article you wrote a few years ago. http://www.tuxradar.com/content/newbies-guide-hacking-linux-kernel > Heh, I should just run this myself to clean up > staging and beat everyone else to it... At least for the whitespace noise, you could but I hope it'll encourage a few more people to try kernel patching instead. > I know some people already have private versions of these things, might > as well make it public for all to abuse :) And I hope they can improve it too as it's just a brainless little script. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] reformat_with_checkpatch: Add automation to checkpatch 2014-07-12 1:40 ` Joe Perches @ 2014-07-12 2:34 ` Greg KH 2014-07-12 9:30 ` Dan Carpenter 1 sibling, 0 replies; 27+ messages in thread From: Greg KH @ 2014-07-12 2:34 UTC (permalink / raw) To: Joe Perches Cc: devel, kernel-janitors, kernelnewbies, LKML, Dan Carpenter, Andrew Morton On Fri, Jul 11, 2014 at 06:40:16PM -0700, Joe Perches wrote: > On Fri, 2014-07-11 at 18:34 -0700, Greg KH wrote: > > On Fri, Jul 11, 2014 at 06:21:27PM -0700, Joe Perches wrote: > > > A simple script to run checkpatch --fix for various types of > > > of cleanups. > > > > > > This script is useful primarily for staging. > > > > > > This reformats code to a more CodingStyle conforming style, > > > compiles it, verifies that the object code hasn't changed, > > > and git commits it too. > > > > And 'git commits' it? > > The thought I had was to made it easier to > submit "my first kernel patch" correctly. > like that tuxradar article you wrote a few > years ago. > > http://www.tuxradar.com/content/newbies-guide-hacking-linux-kernel Yeah, but it's good for people to actually understand the change they are making, and edit it themselves. Or at least I think so, but I know others don't, so I don't mind this script. thanks, greg k-h ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] reformat_with_checkpatch: Add automation to checkpatch 2014-07-12 1:40 ` Joe Perches 2014-07-12 2:34 ` Greg KH @ 2014-07-12 9:30 ` Dan Carpenter 2014-07-12 17:55 ` Greg KH 1 sibling, 1 reply; 27+ messages in thread From: Dan Carpenter @ 2014-07-12 9:30 UTC (permalink / raw) To: Joe Perches Cc: Greg KH, devel, kernel-janitors, kernelnewbies, LKML, Andrew Morton On Fri, Jul 11, 2014 at 06:40:16PM -0700, Joe Perches wrote: > On Fri, 2014-07-11 at 18:34 -0700, Greg KH wrote: > > On Fri, Jul 11, 2014 at 06:21:27PM -0700, Joe Perches wrote: > > > A simple script to run checkpatch --fix for various types of > > > of cleanups. > > > > > > This script is useful primarily for staging. > > > > > > This reformats code to a more CodingStyle conforming style, > > > compiles it, verifies that the object code hasn't changed, > > > and git commits it too. > > > > And 'git commits' it? > > The thought I had was to made it easier to > submit "my first kernel patch" correctly. > like that tuxradar article you wrote a few > years ago. > > http://www.tuxradar.com/content/newbies-guide-hacking-linux-kernel > > > Heh, I should just run this myself to clean up > > staging and beat everyone else to it... > > At least for the whitespace noise, you could > but I hope it'll encourage a few more people > to try kernel patching instead. I have always hate the idea of automated patches from random people because I don't trust them to not be malicious so I have to review them manually. There is a story that back in the day the US government paid someone to send tons of checkpatch style patches to BSD. The guy thought he was "cleaning up the code" but actually he was part of a larger scheme to flood the maintainers with patches so another person could slip in some malicious code. It's better if someone just ran this on all new staging code before adding it to the tree. regards, dan carpenter ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] reformat_with_checkpatch: Add automation to checkpatch 2014-07-12 9:30 ` Dan Carpenter @ 2014-07-12 17:55 ` Greg KH 2014-07-12 18:29 ` Joe Perches 0 siblings, 1 reply; 27+ messages in thread From: Greg KH @ 2014-07-12 17:55 UTC (permalink / raw) To: Dan Carpenter Cc: Joe Perches, devel, kernel-janitors, kernelnewbies, LKML, Andrew Morton On Sat, Jul 12, 2014 at 12:30:43PM +0300, Dan Carpenter wrote: > On Fri, Jul 11, 2014 at 06:40:16PM -0700, Joe Perches wrote: > > On Fri, 2014-07-11 at 18:34 -0700, Greg KH wrote: > > > On Fri, Jul 11, 2014 at 06:21:27PM -0700, Joe Perches wrote: > > > > A simple script to run checkpatch --fix for various types of > > > > of cleanups. > > > > > > > > This script is useful primarily for staging. > > > > > > > > This reformats code to a more CodingStyle conforming style, > > > > compiles it, verifies that the object code hasn't changed, > > > > and git commits it too. > > > > > > And 'git commits' it? > > > > The thought I had was to made it easier to > > submit "my first kernel patch" correctly. > > like that tuxradar article you wrote a few > > years ago. > > > > http://www.tuxradar.com/content/newbies-guide-hacking-linux-kernel > > > > > Heh, I should just run this myself to clean up > > > staging and beat everyone else to it... > > > > At least for the whitespace noise, you could > > but I hope it'll encourage a few more people > > to try kernel patching instead. > > I have always hate the idea of automated patches from random people > because I don't trust them to not be malicious so I have to review them > manually. There is a story that back in the day the US government paid > someone to send tons of checkpatch style patches to BSD. The guy > thought he was "cleaning up the code" but actually he was part of a > larger scheme to flood the maintainers with patches so another person > could slip in some malicious code. Based on some of the patches that I get sent, I wouldn't be surprised if that's already happening :( > It's better if someone just ran this on all new staging code before > adding it to the tree. I spent some time messing with this script today, and while it is "fun" to run, I don't think it's all that useful. One example, before running the script: ~/linux/work/staging $ ./scripts/checkpatch.pl --terse --file drivers/staging/android/binder.c | tail -n 1 total: 0 errors, 103 warnings, 3670 lines checked After running it: ~/linux/work/staging $ ./scripts/checkpatch.pl --terse --file drivers/staging/android/binder.c | tail -n 1 total: 0 errors, 125 warnings, 3670 lines checked And that was after the script created two patches, with the resulting diffstat of: drivers/staging/android/binder.c | 124 +++++++++++++++++++-------------------- 1 file changed, 62 insertions(+), 62 deletions(-) So 2 patches, 60+ lines to review, and 22 more warnings from checkpatch as the end result? Yes, the warnings are all due to line-length, but Joe, you shouldn't add a patch that causes more checkpatch warnings than before :) I know people have scripts like this of their own, and while it might be nice to "standardize" them, I am really reluctant to put this script in the kernel tree itself. There's a barrier of entry to write your own type of script here that honestly, I like. We already have the example of someone who obviously does not know the C language at all, running through the kernel tree at the moment, creating horrible patches that are flat-out wrong and annoying maintainers with their result. I've had to kill-file them for now, as it was just too annoying and maintainer time is what we have the least of. While I always want to see more developers get involved with kernel development, there should be a minimum barrier to entry. And that barrier is the knowledge of the C language, and knowledge of how to edit a text file, and use git. This script takes that barrier away, for whitespace cleanups, with not much real use overall. So, I'll keep my local copy of this script now, just to have fun with at times when I'm bored. But I don't think it should be merged, as-is. thanks, greg k-h ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] reformat_with_checkpatch: Add automation to checkpatch 2014-07-12 17:55 ` Greg KH @ 2014-07-12 18:29 ` Joe Perches 2014-07-12 19:28 ` Greg KH 0 siblings, 1 reply; 27+ messages in thread From: Joe Perches @ 2014-07-12 18:29 UTC (permalink / raw) To: Greg KH Cc: Dan Carpenter, devel, kernel-janitors, kernelnewbies, LKML, Andrew Morton On Sat, 2014-07-12 at 10:55 -0700, Greg KH wrote: > Yes, the warnings are all due to line-length, but Joe, you shouldn't add > a patch that causes more checkpatch warnings than before :) Yeah, that was intentional though. This script does a series of relatively discrete changes. Lindent would more or less work, but it's _horrible_ at wrapping overlong lines and merges all types of changes together. For now, people are probably better at line wrapping in an acceptable way. > While I always want to see more developers get involved with kernel > development, there should be a minimum barrier to entry. And that > barrier is the knowledge of the C language, and knowledge of how to edit > a text file, and use git. This script takes that barrier away, for > whitespace cleanups, with not much real use overall. > > So, I'll keep my local copy of this script now, just to have fun with at > times when I'm bored. But I don't think it should be merged, as-is. Dunno, I still think it's useful. Maybe when you get new code, you might run it through a script like this before committing it. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] reformat_with_checkpatch: Add automation to checkpatch 2014-07-12 18:29 ` Joe Perches @ 2014-07-12 19:28 ` Greg KH 2014-07-13 3:06 ` Joe Perches 0 siblings, 1 reply; 27+ messages in thread From: Greg KH @ 2014-07-12 19:28 UTC (permalink / raw) To: Joe Perches Cc: devel, kernelnewbies, kernel-janitors, LKML, Andrew Morton, Dan Carpenter On Sat, Jul 12, 2014 at 11:29:37AM -0700, Joe Perches wrote: > On Sat, 2014-07-12 at 10:55 -0700, Greg KH wrote: > > Yes, the warnings are all due to line-length, but Joe, you shouldn't add > > a patch that causes more checkpatch warnings than before :) > > Yeah, that was intentional though. > > This script does a series of relatively discrete changes. > > Lindent would more or less work, but it's _horrible_ at > wrapping overlong lines and merges all types of changes > together. Oh I agree, I don't want to see Lindent, but maybe, if the patch adds checkpatch warnings, it should be at least "flagged" as maybe a problem? > > While I always want to see more developers get involved with kernel > > development, there should be a minimum barrier to entry. And that > > barrier is the knowledge of the C language, and knowledge of how to edit > > a text file, and use git. This script takes that barrier away, for > > whitespace cleanups, with not much real use overall. > > > > So, I'll keep my local copy of this script now, just to have fun with at > > times when I'm bored. But I don't think it should be merged, as-is. > > Dunno, I still think it's useful. For you, and me, but the world? Would you want to be on the receiving end of this patch script? I don't, and I'm willing to take almost any patch cleanup for staging code. I think that says something :) > Maybe when you get new code, you might run it through a > script like this before committing it. I will keep it for me, like I said. thanks, greg k-h ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] reformat_with_checkpatch: Add automation to checkpatch 2014-07-12 19:28 ` Greg KH @ 2014-07-13 3:06 ` Joe Perches 0 siblings, 0 replies; 27+ messages in thread From: Joe Perches @ 2014-07-13 3:06 UTC (permalink / raw) To: Greg KH Cc: devel, kernelnewbies, kernel-janitors, LKML, Andrew Morton, Dan Carpenter On Sat, 2014-07-12 at 12:28 -0700, Greg KH wrote: > On Sat, Jul 12, 2014 at 11:29:37AM -0700, Joe Perches wrote: > > On Sat, 2014-07-12 at 10:55 -0700, Greg KH wrote: > > > Yes, the warnings are all due to line-length, but Joe, you shouldn't add > > > a patch that causes more checkpatch warnings than before :) > > > > Yeah, that was intentional though. > > > > This script does a series of relatively discrete changes. > > > > Lindent would more or less work, but it's _horrible_ at > > wrapping overlong lines and merges all types of changes > > together. > > Oh I agree, I don't want to see Lindent, but maybe, if the patch adds > checkpatch warnings, it should be at least "flagged" as maybe a problem? The script I submitted does run checkpatch before any commit is done. > Would you want to be on the receiving end of this patch script? You might have noticed I don't have a kernel.org account. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] reformat_with_checkpatch: Add automation to checkpatch 2014-07-12 1:21 [PATCH] reformat_with_checkpatch: Add automation to checkpatch Joe Perches 2014-07-12 1:34 ` Greg KH @ 2014-07-12 1:39 ` Greg KH 2014-07-12 1:46 ` Joe Perches 2014-07-12 1:43 ` [PATCH] reformat_with_checkpatch: Add automation to checkpatch Greg KH ` (2 subsequent siblings) 4 siblings, 1 reply; 27+ messages in thread From: Greg KH @ 2014-07-12 1:39 UTC (permalink / raw) To: Joe Perches Cc: devel, kernel-janitors, kernelnewbies, LKML, Dan Carpenter, Andrew Morton On Fri, Jul 11, 2014 at 06:21:27PM -0700, Joe Perches wrote: > A simple script to run checkpatch --fix for various types of > of cleanups. > > This script is useful primarily for staging. > > This reformats code to a more CodingStyle conforming style, > compiles it, verifies that the object code hasn't changed, > and git commits it too. > > You must have the necessary development tools, git, and a > recent git tree. Ideally use Greg KH's staging-next, which > can be retrieved via these commands: > > git clone git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git > git checkout staging-next > > To use this script try a sequence of commands like: > > cd <linux_repository> > git checkout -b <your_branch> > make allyesconfig > mkdir patches > ./scripts/reformat_with_checkpatch.sh drivers/staging/<dir>/*.[ch] > git format-patch --cover-letter -o patches/<your_branch> staging-next > git send-email patches/<your_branch> > > Signed-off-by: Joe Perches <joe@perches.com> > --- > scripts/reformat_with_checkpatch.sh | 141 ++++++++++++++++++++++++++++++++++++ > 1 file changed, 141 insertions(+) > create mode 100755 scripts/reformat_with_checkpatch.sh No --help option? How do I run this thing? I ran it on a file that had no problems and got a mess, all I think due to something odd in checkpatch itself right now: $ ./scripts/checkpatch.pl --file drivers/staging/lustre/include/linux/lnet/api.h Useless use of greediness modifier '+' in regex; marked by <-- HERE in m/(^\+.*) {8,8}+ <-- HERE \t/ at ./scripts/checkpatch.pl line 2217. total: 0 errors, 0 warnings, 220 lines checked What's with that 'Useless use..." error? perl 5.20 in use, is that the issue? Anyway, running this script on the file gave me this: $ ./reformat_with_checkpatch drivers/staging/lustre/include/linux/lnet/api.h file: <drivers/staging/lustre/include/linux/lnet/api.h> description: <whitespace neatening> types:<spacing,space_before_tab,pointer_location,trailing_whitespace,bracket_space> Useless use of greediness modifier '+' in regex; marked by <-- HERE in m/(^\+.*) {8,8}+ <-- HERE \t/ at ./scripts/checkpatch.pl line 2217. total: 0 errors, 0 warnings, 0 checks, 220 lines checked NOTE: Used message types: BRACKET_SPACE POINTER_LOCATION SPACE_BEFORE_TAB SPACING TRAILING_WHITESPACE drivers/staging/lustre/include/linux/lnet/api.h has no obvious style problems and is ready for submission. file: <drivers/staging/lustre/include/linux/lnet/api.h> description: <remove spaces before tabs> types:<space_before_tab> Useless use of greediness modifier '+' in regex; marked by <-- HERE in m/(^\+.*) {8,8}+ <-- HERE \t/ at ./scripts/checkpatch.pl line 2217. total: 0 errors, 0 warnings, 0 checks, 220 lines checked NOTE: Used message types: SPACE_BEFORE_TAB drivers/staging/lustre/include/linux/lnet/api.h has no obvious style problems and is ready for submission. file: <drivers/staging/lustre/include/linux/lnet/api.h> description: <fix label positions> types:<indented_label> Useless use of greediness modifier '+' in regex; marked by <-- HERE in m/(^\+.*) {8,8}+ <-- HERE \t/ at ./scripts/checkpatch.pl line 2217. total: 0 errors, 0 warnings, 0 checks, 220 lines checked NOTE: Used message types: INDENTED_LABEL drivers/staging/lustre/include/linux/lnet/api.h has no obvious style problems and is ready for submission. file: <drivers/staging/lustre/include/linux/lnet/api.h> description: <align arguments to parenthesis> types:<parenthesis_alignment> Useless use of greediness modifier '+' in regex; marked by <-- HERE in m/(^\+.*) {8,8}+ <-- HERE \t/ at ./scripts/checkpatch.pl line 2217. total: 0 errors, 0 warnings, 0 checks, 220 lines checked NOTE: Used message types: PARENTHESIS_ALIGNMENT drivers/staging/lustre/include/linux/lnet/api.h has no obvious style problems and is ready for submission. file: <drivers/staging/lustre/include/linux/lnet/api.h> description: <fix brace positions> types:<open_brace,braces,else_after_brace,while_after_brace> Useless use of greediness modifier '+' in regex; marked by <-- HERE in m/(^\+.*) {8,8}+ <-- HERE \t/ at ./scripts/checkpatch.pl line 2217. total: 0 errors, 0 warnings, 0 checks, 220 lines checked NOTE: Used message types: BRACES ELSE_AFTER_BRACE OPEN_BRACE WHILE_AFTER_BRACE drivers/staging/lustre/include/linux/lnet/api.h has no obvious style problems and is ready for submission. file: <drivers/staging/lustre/include/linux/lnet/api.h> description: <fix blank lines> types:<line_spacing> Useless use of greediness modifier '+' in regex; marked by <-- HERE in m/(^\+.*) {8,8}+ <-- HERE \t/ at ./scripts/checkpatch.pl line 2217. total: 0 errors, 0 warnings, 0 checks, 220 lines checked NOTE: Used message types: LINE_SPACING drivers/staging/lustre/include/linux/lnet/api.h has no obvious style problems and is ready for submission. file: <drivers/staging/lustre/include/linux/lnet/api.h> description: <use standard attributes> types:<prefer_packed,prefer_aligned> Useless use of greediness modifier '+' in regex; marked by <-- HERE in m/(^\+.*) {8,8}+ <-- HERE \t/ at ./scripts/checkpatch.pl line 2217. total: 0 errors, 0 warnings, 0 checks, 220 lines checked NOTE: Used message types: PREFER_ALIGNED PREFER_PACKED drivers/staging/lustre/include/linux/lnet/api.h has no obvious style problems and is ready for submission. file: <drivers/staging/lustre/include/linux/lnet/api.h> description: <remove unnecessary externs> types:<avoid_externs> Useless use of greediness modifier '+' in regex; marked by <-- HERE in m/(^\+.*) {8,8}+ <-- HERE \t/ at ./scripts/checkpatch.pl line 2217. total: 0 errors, 0 warnings, 0 checks, 220 lines checked NOTE: Used message types: AVOID_EXTERNS drivers/staging/lustre/include/linux/lnet/api.h has no obvious style problems and is ready for submission. file: <drivers/staging/lustre/include/linux/lnet/api.h> description: <update c90 comment style> types:<c99_comments> Useless use of greediness modifier '+' in regex; marked by <-- HERE in m/(^\+.*) {8,8}+ <-- HERE \t/ at ./scripts/checkpatch.pl line 2217. total: 0 errors, 0 warnings, 0 checks, 220 lines checked NOTE: Used message types: C99_COMMENTS drivers/staging/lustre/include/linux/lnet/api.h has no obvious style problems and is ready for submission. Is that expected? thanks, greg k-h ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] reformat_with_checkpatch: Add automation to checkpatch 2014-07-12 1:39 ` Greg KH @ 2014-07-12 1:46 ` Joe Perches 2014-07-12 2:01 ` Greg KH 0 siblings, 1 reply; 27+ messages in thread From: Joe Perches @ 2014-07-12 1:46 UTC (permalink / raw) To: Greg KH Cc: devel, kernel-janitors, kernelnewbies, LKML, Dan Carpenter, Andrew Morton On Fri, 2014-07-11 at 18:39 -0700, Greg KH wrote: > On Fri, Jul 11, 2014 at 06:21:27PM -0700, Joe Perches wrote: > > A simple script to run checkpatch --fix for various types of > > of cleanups. ] > drivers/staging/lustre/include/linux/lnet/api.h has no obvious style problems and is ready for submission. > file: <drivers/staging/lustre/include/linux/lnet/api.h> description: <update c90 comment style> types:<c99_comments> > Useless use of greediness modifier '+' in regex; marked by <-- HERE in m/(^\+.*) {8,8}+ <-- HERE \t/ at ./scripts/checkpatch.pl line 2217. [] > drivers/staging/lustre/include/linux/lnet/api.h has no obvious style problems and is ready for submission. [] > Is that expected? No, I haven't seen that. Can you tell me what git tree you're working on? Also, can you use the scripts/checkpatch from -next tag next-20140711 My system has: $ perl --version This is perl 5, version 18, subversion 2 (v5.18.2) built for i686-linux-gnu-thread-multi-64int (with 41 registered patches, see perl -V for more detail) Copyright 1987-2013, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page. and using that: $ ./scripts/checkpatch.pl -f --strict drivers/staging/lustre/include/linux/lnet/api.h --types=c99_comments total: 0 errors, 0 warnings, 0 checks, 220 lines checked NOTE: Used message types: C99_COMMENTS drivers/staging/lustre/include/linux/lnet/api.h has no obvious style problems and is ready for submission. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] reformat_with_checkpatch: Add automation to checkpatch 2014-07-12 1:46 ` Joe Perches @ 2014-07-12 2:01 ` Greg KH 2014-07-12 2:05 ` Greg KH 0 siblings, 1 reply; 27+ messages in thread From: Greg KH @ 2014-07-12 2:01 UTC (permalink / raw) To: Joe Perches Cc: devel, kernel-janitors, kernelnewbies, LKML, Dan Carpenter, Andrew Morton On Fri, Jul 11, 2014 at 06:46:52PM -0700, Joe Perches wrote: > On Fri, 2014-07-11 at 18:39 -0700, Greg KH wrote: > > On Fri, Jul 11, 2014 at 06:21:27PM -0700, Joe Perches wrote: > > > A simple script to run checkpatch --fix for various types of > > > of cleanups. > ] > > drivers/staging/lustre/include/linux/lnet/api.h has no obvious style problems and is ready for submission. > > file: <drivers/staging/lustre/include/linux/lnet/api.h> description: <update c90 comment style> types:<c99_comments> > > Useless use of greediness modifier '+' in regex; marked by <-- HERE in m/(^\+.*) {8,8}+ <-- HERE \t/ at ./scripts/checkpatch.pl line 2217. > [] > > drivers/staging/lustre/include/linux/lnet/api.h has no obvious style problems and is ready for submission. > [] > > Is that expected? > > No, I haven't seen that. > > Can you tell me what git tree you're working on? My staging-next branch of staging.git on git.kernel.org > Also, can you use the scripts/checkpatch from -next > tag next-20140711 that will take a bit to checkout, I'll do that afterward. > My system has: > > $ perl --version > > This is perl 5, version 18, subversion 2 (v5.18.2) built for i686-linux-gnu-thread-multi-64int > (with 41 registered patches, see perl -V for more detail) I think this started showing up for me for perl 5.20. Let me go checkout linux-next and see if that fixes anything or not... thanks, greg k-h ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] reformat_with_checkpatch: Add automation to checkpatch 2014-07-12 2:01 ` Greg KH @ 2014-07-12 2:05 ` Greg KH 2014-07-12 2:09 ` [PATCH] checkpatch: Remove unnecessary + after {8,8} Joe Perches 2014-09-01 16:55 ` [PATCH - resend] " Joe Perches 0 siblings, 2 replies; 27+ messages in thread From: Greg KH @ 2014-07-12 2:05 UTC (permalink / raw) To: Joe Perches Cc: devel, kernel-janitors, kernelnewbies, LKML, Dan Carpenter, Andrew Morton On Fri, Jul 11, 2014 at 07:01:14PM -0700, Greg KH wrote: > On Fri, Jul 11, 2014 at 06:46:52PM -0700, Joe Perches wrote: > > On Fri, 2014-07-11 at 18:39 -0700, Greg KH wrote: > > > On Fri, Jul 11, 2014 at 06:21:27PM -0700, Joe Perches wrote: > > > > A simple script to run checkpatch --fix for various types of > > > > of cleanups. > > ] > > > drivers/staging/lustre/include/linux/lnet/api.h has no obvious style problems and is ready for submission. > > > file: <drivers/staging/lustre/include/linux/lnet/api.h> description: <update c90 comment style> types:<c99_comments> > > > Useless use of greediness modifier '+' in regex; marked by <-- HERE in m/(^\+.*) {8,8}+ <-- HERE \t/ at ./scripts/checkpatch.pl line 2217. > > [] > > > drivers/staging/lustre/include/linux/lnet/api.h has no obvious style problems and is ready for submission. > > [] > > > Is that expected? > > > > No, I haven't seen that. > > > > Can you tell me what git tree you're working on? > > My staging-next branch of staging.git on git.kernel.org > > > Also, can you use the scripts/checkpatch from -next > > tag next-20140711 > > that will take a bit to checkout, I'll do that afterward. > > > My system has: > > > > $ perl --version > > > > This is perl 5, version 18, subversion 2 (v5.18.2) built for i686-linux-gnu-thread-multi-64int > > (with 41 registered patches, see perl -V for more detail) > > I think this started showing up for me for perl 5.20. Let me go > checkout linux-next and see if that fixes anything or not... Ok, with linux-next I get the same thing: ~/linux/tmp/linux-next $ ./scripts/checkpatch.pl -f --strict drivers/staging/lustre/include/linux/lnet/api.h --types=c99_comments Useless use of greediness modifier '+' in regex; marked by <-- HERE in m/(^\+.*) {8,8}+ <-- HERE \t/ at ./scripts/checkpatch.pl line 2358. total: 0 errors, 0 warnings, 0 checks, 220 lines checked NOTE: Used message types: C99_COMMENTS drivers/staging/lustre/include/linux/lnet/api.h has no obvious style problems and is ready for submission. ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH] checkpatch: Remove unnecessary + after {8,8} 2014-07-12 2:05 ` Greg KH @ 2014-07-12 2:09 ` Joe Perches 2014-07-12 2:23 ` Greg KH 2014-08-31 20:58 ` Sören Brinkmann 2014-09-01 16:55 ` [PATCH - resend] " Joe Perches 1 sibling, 2 replies; 27+ messages in thread From: Joe Perches @ 2014-07-12 2:09 UTC (permalink / raw) To: Greg KH, Andrew Morton Cc: devel, kernel-janitors, kernelnewbies, LKML, Dan Carpenter There's a useless "+" use that needs to be removed as perl 5.20 emits a "Useless use of greediness modifier '+'" message each time it's hit. Reported-by: Greg KH <gregkh@linuxfoundation.org> Signed-off-by: Joe Perches <joe@perches.com> --- On Fri, 2014-07-11 at 19:05 -0700, Greg KH wrote: > Ok, with linux-next I get the same thing: Thanks Greg. scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index d5ac001..370a974 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2376,7 +2376,7 @@ sub process { "please, no space before tabs\n" . $herevet) && $fix) { while ($fixed[$fixlinenr] =~ - s/(^\+.*) {8,8}+\t/$1\t\t/) {} + s/(^\+.*) {8,8}\t/$1\t\t/) {} while ($fixed[$fixlinenr] =~ s/(^\+.*) +\t/$1\t/) {} } ^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH] checkpatch: Remove unnecessary + after {8,8} 2014-07-12 2:09 ` [PATCH] checkpatch: Remove unnecessary + after {8,8} Joe Perches @ 2014-07-12 2:23 ` Greg KH 2014-08-31 20:58 ` Sören Brinkmann 1 sibling, 0 replies; 27+ messages in thread From: Greg KH @ 2014-07-12 2:23 UTC (permalink / raw) To: Joe Perches Cc: Andrew Morton, devel, kernel-janitors, kernelnewbies, LKML, Dan Carpenter On Fri, Jul 11, 2014 at 07:09:30PM -0700, Joe Perches wrote: > There's a useless "+" use that needs to be removed as perl 5.20 > emits a "Useless use of greediness modifier '+'" message each > time it's hit. > > Reported-by: Greg KH <gregkh@linuxfoundation.org> > Signed-off-by: Joe Perches <joe@perches.com> > --- > On Fri, 2014-07-11 at 19:05 -0700, Greg KH wrote: > > Ok, with linux-next I get the same thing: > > Thanks Greg. Very nice, thanks for this: Tested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] checkpatch: Remove unnecessary + after {8,8} 2014-07-12 2:09 ` [PATCH] checkpatch: Remove unnecessary + after {8,8} Joe Perches 2014-07-12 2:23 ` Greg KH @ 2014-08-31 20:58 ` Sören Brinkmann 1 sibling, 0 replies; 27+ messages in thread From: Sören Brinkmann @ 2014-08-31 20:58 UTC (permalink / raw) To: Joe Perches Cc: Greg KH, Andrew Morton, devel, kernel-janitors, kernelnewbies, LKML, Dan Carpenter Hi Joe, On Fri, 2014-07-11 at 07:09PM -0700, Joe Perches wrote: > There's a useless "+" use that needs to be removed as perl 5.20 > emits a "Useless use of greediness modifier '+'" message each > time it's hit. I saw this Perl warning today as well and wondered whether this patch is coming or not. Apparently it's not in linux-next (yet). Thanks, Sören ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH - resend] checkpatch: Remove unnecessary + after {8,8} 2014-07-12 2:05 ` Greg KH 2014-07-12 2:09 ` [PATCH] checkpatch: Remove unnecessary + after {8,8} Joe Perches @ 2014-09-01 16:55 ` Joe Perches 2014-10-30 11:12 ` Borislav Petkov 1 sibling, 1 reply; 27+ messages in thread From: Joe Perches @ 2014-09-01 16:55 UTC (permalink / raw) To: Greg KH, Andrew Morton Cc: devel, kernel-janitors, kernelnewbies, LKML, Dan Carpenter, Sören Brinkmann There's a useless "+" use that needs to be removed as perl 5.20 emits a "Useless use of greediness modifier '+'" message each time it's hit. Reported-by: Greg KH <gregkh@linuxfoundation.org> Signed-off-by: Joe Perches <joe@perches.com> --- Resending, maybe Andrew's all-seeing eye blinked... On Fri, 2014-07-11 at 19:05 -0700, Greg KH wrote: > Ok, with linux-next I get the same thing: Thanks Greg. scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index d5ac001..370a974 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2376,7 +2376,7 @@ sub process { "please, no space before tabs\n" . $herevet) && $fix) { while ($fixed[$fixlinenr] =~ - s/(^\+.*) {8,8}+\t/$1\t\t/) {} + s/(^\+.*) {8,8}\t/$1\t\t/) {} while ($fixed[$fixlinenr] =~ s/(^\+.*) +\t/$1\t/) {} } ^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH - resend] checkpatch: Remove unnecessary + after {8,8} 2014-09-01 16:55 ` [PATCH - resend] " Joe Perches @ 2014-10-30 11:12 ` Borislav Petkov 2014-10-30 11:15 ` Borislav Petkov 0 siblings, 1 reply; 27+ messages in thread From: Borislav Petkov @ 2014-10-30 11:12 UTC (permalink / raw) To: Andrew Morton Cc: Joe Perches, Greg KH, devel, kernel-janitors, kernelnewbies, LKML, Dan Carpenter, Sören Brinkmann Hey Andrew, can we get this one applied already - I'm seeing this warning at least since before my summer vacation started! :-P Thanks. On Mon, Sep 01, 2014 at 09:55:06AM -0700, Joe Perches wrote: > There's a useless "+" use that needs to be removed as perl 5.20 > emits a "Useless use of greediness modifier '+'" message each > time it's hit. > > Reported-by: Greg KH <gregkh@linuxfoundation.org> > Signed-off-by: Joe Perches <joe@perches.com> > --- > > Resending, maybe Andrew's all-seeing eye blinked... > > On Fri, 2014-07-11 at 19:05 -0700, Greg KH wrote: > > Ok, with linux-next I get the same thing: > > Thanks Greg. > > scripts/checkpatch.pl | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index d5ac001..370a974 100755 > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -2376,7 +2376,7 @@ sub process { > "please, no space before tabs\n" . $herevet) && > $fix) { > while ($fixed[$fixlinenr] =~ > - s/(^\+.*) {8,8}+\t/$1\t\t/) {} > + s/(^\+.*) {8,8}\t/$1\t\t/) {} > while ($fixed[$fixlinenr] =~ > s/(^\+.*) +\t/$1\t/) {} > } > > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ > -- Regards/Gruss, Boris. Sent from a fat crate under my desk. Formatting is fine. -- ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH - resend] checkpatch: Remove unnecessary + after {8,8} 2014-10-30 11:12 ` Borislav Petkov @ 2014-10-30 11:15 ` Borislav Petkov 0 siblings, 0 replies; 27+ messages in thread From: Borislav Petkov @ 2014-10-30 11:15 UTC (permalink / raw) To: Andrew Morton Cc: Joe Perches, Greg KH, devel, kernel-janitors, kernelnewbies, LKML, Dan Carpenter, Sören Brinkmann On Thu, Oct 30, 2014 at 12:12:04PM +0100, Borislav Petkov wrote: > Hey Andrew, > > can we get this one applied already - I'm seeing this warning at least > since before my summer vacation started! :-P Oh ok, so it did go in after 3.17 but when using checkpatch on a 3.17 tree, it fires of course. Maybe the first checkpatch fix to tag for stable? :-) -- Regards/Gruss, Boris. Sent from a fat crate under my desk. Formatting is fine. -- ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] reformat_with_checkpatch: Add automation to checkpatch 2014-07-12 1:21 [PATCH] reformat_with_checkpatch: Add automation to checkpatch Joe Perches 2014-07-12 1:34 ` Greg KH 2014-07-12 1:39 ` Greg KH @ 2014-07-12 1:43 ` Greg KH 2014-07-12 1:50 ` Joe Perches 2014-07-12 1:53 ` Greg KH 2014-07-12 8:18 ` Greg KH 4 siblings, 1 reply; 27+ messages in thread From: Greg KH @ 2014-07-12 1:43 UTC (permalink / raw) To: Joe Perches Cc: devel, kernel-janitors, kernelnewbies, LKML, Dan Carpenter, Andrew Morton On Fri, Jul 11, 2014 at 06:21:27PM -0700, Joe Perches wrote: > A simple script to run checkpatch --fix for various types of > of cleanups. > > This script is useful primarily for staging. > > This reformats code to a more CodingStyle conforming style, > compiles it, verifies that the object code hasn't changed, > and git commits it too. > > You must have the necessary development tools, git, and a > recent git tree. Ideally use Greg KH's staging-next, which > can be retrieved via these commands: > > git clone git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git > git checkout staging-next > > To use this script try a sequence of commands like: > > cd <linux_repository> > git checkout -b <your_branch> > make allyesconfig > mkdir patches > ./scripts/reformat_with_checkpatch.sh drivers/staging/<dir>/*.[ch] > git format-patch --cover-letter -o patches/<your_branch> staging-next > git send-email patches/<your_branch> > > Signed-off-by: Joe Perches <joe@perches.com> > --- > scripts/reformat_with_checkpatch.sh | 141 ++++++++++++++++++++++++++++++++++++ > 1 file changed, 141 insertions(+) > create mode 100755 scripts/reformat_with_checkpatch.sh > > diff --git a/scripts/reformat_with_checkpatch.sh b/scripts/reformat_with_checkpatch.sh > new file mode 100755 > index 0000000..5415a8e > --- /dev/null > +++ b/scripts/reformat_with_checkpatch.sh > @@ -0,0 +1,141 @@ > +#!/bin/bash > +# (c) 2014, Joe Perches <joe@perches.com> > +# > +# Automate checkpatch modifications and git commits to > +# neaten code that doesn't conform to CodingStyle. > +# Useful primarily for files in drivers/staging > +# > +# Licensed under the terms of the GNU GPL License version 2 > + > +declare -ar whitespace_types=( \ > + 'whitespace_neatening:spacing,space_before_tab,pointer_location,trailing_whitespace,bracket_space' \ > + 'remove_spaces_before_tabs:space_before_tab' \ > + 'fix_label_positions:indented_label' \ > + 'align_arguments_to_parenthesis:parenthesis_alignment' \ > +) > + > +declare -ar changecode_types=( \ > + 'fix_brace_positions:open_brace,braces,else_after_brace,while_after_brace' \ > + 'fix_blank_lines:line_spacing' \ > + 'use_standard_attributes:prefer_packed,prefer_aligned' \ > + 'remove_unnecessary_externs:avoid_externs' \ > + 'update_c90_comment_style:c99_comments' \ > +) > + > +checkpatch_update () > +{ > + file=$1 > + > + desc=$(echo $2 | cut -f1 -d: | sed 's/_/ /g') > + types=$(echo $2 | cut -f2- -d:) > + > + echo "file: <$file> description: <$desc> types:<$types>" > + > + ./scripts/checkpatch.pl --file --fix-inplace --strict --types="$types" $file > + > + checkpatch_fixes=$file.diff > + git diff --stat -p --exit-code $file > $checkpatch_fixes > + if [ $? == 0 ] ; then > + rm -f $checkpatch_fixes > + return > + fi > + > + basename=$(basename $file) > + if [ "${basename##*.}" == "c" ] ; then > + > + git checkout $file > + obj="$(echo $file | sed 's/\.c$/\.o/')" > + if [ -e $obj ] ; then > + rm -f $obj > + fi > + > + echo "Compiling original version..." > + > + ${CROSS_COMPILE}make $obj > + > + ${CROSS_COMPILE}objdump -D $obj | \ > + sed "s/^[[:space:]]\+[0-9a-f]\+//" > $obj.old > + > + patch -p1 < $checkpatch_fixes > + > + echo "Compiling modified version..." > + > + ${CROSS_COMPILE}make $obj > + > + ${CROSS_COMPILE}objdump -D $obj | \ > + sed "s/^[[:space:]]\+[0-9a-f]\+//" > $obj.new > + > + echo "Comparing objects..." > + diff -Nurd $obj.new $obj.old > + if [ $? -ne 0 ] ; then > + echo "Object differences exist! - Verify changes before commit!" > + read -s -p "Press the 'enter' key to continue: " > + else > + echo "No object differences found" > + fi > + rm -f $obj.old > + rm -f $obj.new > + fi > + > + echo "running checkpatch on possible checkpatch fixes..." > + > + ./scripts/checkpatch.pl --no-summary --no-signoff $checkpatch_fixes > + rm -f $checkpatch_fixes > + > + echo "Verify checkpatch output and make any necessary changes" > + echo "Edit '$file' if appropriate" > + read -s -p "Press the 'enter' key to continue: " > + > + commit_log_file=$(mktemp git_commit.XXXXXX) > + > + if [ -e $commit_log_file ] ; then > + rm -f $commit_log_file > + fi > + > + if [[ $file =~ ^drivers/staging/ ]] ; then > + echo -n "staging: " >> $commit_log_file > + fi > + echo "$(basename $(dirname $file)): checkpatch cleanup: $desc" >> $commit_log_file If I pick drivers/staging/lustre/include/linux/lnet/types.h, then I get: staging: lnet: checkpatch cleanup: whitespace neatening and no 'types.h' here, is that intentional? If so, why? And this is fun, I'm going to let this rip on the lustre code... thanks, greg k-h ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] reformat_with_checkpatch: Add automation to checkpatch 2014-07-12 1:43 ` [PATCH] reformat_with_checkpatch: Add automation to checkpatch Greg KH @ 2014-07-12 1:50 ` Joe Perches 0 siblings, 0 replies; 27+ messages in thread From: Joe Perches @ 2014-07-12 1:50 UTC (permalink / raw) To: Greg KH Cc: devel, kernel-janitors, kernelnewbies, LKML, Dan Carpenter, Andrew Morton On Fri, 2014-07-11 at 18:43 -0700, Greg KH wrote: > On Fri, Jul 11, 2014 at 06:21:27PM -0700, Joe Perches wrote: > > A simple script to run checkpatch --fix for various types of > > of cleanups. [] > If I pick drivers/staging/lustre/include/linux/lnet/types.h, then I get: > > staging: lnet: checkpatch cleanup: whitespace neatening > > and no 'types.h' here, is that intentional? If so, why? Yes, it's how it's written. It uses just the directory name, not any basename($file) It can be changed if that's what's desired. > And this is fun, I'm going to let this rip on the lustre code... It doesn't autocommit, it does show the various changes it makes and asks you to accept them. I suppose that could be automated with something better than "yes", but I didn't want it to be completely automatic. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] reformat_with_checkpatch: Add automation to checkpatch 2014-07-12 1:21 [PATCH] reformat_with_checkpatch: Add automation to checkpatch Joe Perches ` (2 preceding siblings ...) 2014-07-12 1:43 ` [PATCH] reformat_with_checkpatch: Add automation to checkpatch Greg KH @ 2014-07-12 1:53 ` Greg KH 2014-07-12 1:57 ` Joe Perches 2014-07-12 8:18 ` Greg KH 4 siblings, 1 reply; 27+ messages in thread From: Greg KH @ 2014-07-12 1:53 UTC (permalink / raw) To: Joe Perches Cc: devel, kernel-janitors, kernelnewbies, LKML, Dan Carpenter, Andrew Morton On Fri, Jul 11, 2014 at 06:21:27PM -0700, Joe Perches wrote: > A simple script to run checkpatch --fix for various types of > of cleanups. > > This script is useful primarily for staging. > > This reformats code to a more CodingStyle conforming style, > compiles it, verifies that the object code hasn't changed, > and git commits it too. > > You must have the necessary development tools, git, and a > recent git tree. Ideally use Greg KH's staging-next, which > can be retrieved via these commands: > > git clone git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git > git checkout staging-next > > To use this script try a sequence of commands like: > > cd <linux_repository> > git checkout -b <your_branch> > make allyesconfig > mkdir patches > ./scripts/reformat_with_checkpatch.sh drivers/staging/<dir>/*.[ch] > git format-patch --cover-letter -o patches/<your_branch> staging-next > git send-email patches/<your_branch> > > Signed-off-by: Joe Perches <joe@perches.com> > --- > scripts/reformat_with_checkpatch.sh | 141 ++++++++++++++++++++++++++++++++++++ > 1 file changed, 141 insertions(+) > create mode 100755 scripts/reformat_with_checkpatch.sh > > diff --git a/scripts/reformat_with_checkpatch.sh b/scripts/reformat_with_checkpatch.sh > new file mode 100755 > index 0000000..5415a8e > --- /dev/null > +++ b/scripts/reformat_with_checkpatch.sh > @@ -0,0 +1,141 @@ > +#!/bin/bash > +# (c) 2014, Joe Perches <joe@perches.com> > +# > +# Automate checkpatch modifications and git commits to > +# neaten code that doesn't conform to CodingStyle. > +# Useful primarily for files in drivers/staging > +# > +# Licensed under the terms of the GNU GPL License version 2 > + > +declare -ar whitespace_types=( \ > + 'whitespace_neatening:spacing,space_before_tab,pointer_location,trailing_whitespace,bracket_space' \ > + 'remove_spaces_before_tabs:space_before_tab' \ > + 'fix_label_positions:indented_label' \ > + 'align_arguments_to_parenthesis:parenthesis_alignment' \ > +) > + > +declare -ar changecode_types=( \ > + 'fix_brace_positions:open_brace,braces,else_after_brace,while_after_brace' \ > + 'fix_blank_lines:line_spacing' \ > + 'use_standard_attributes:prefer_packed,prefer_aligned' \ > + 'remove_unnecessary_externs:avoid_externs' \ > + 'update_c90_comment_style:c99_comments' \ > +) > + > +checkpatch_update () > +{ > + file=$1 > + > + desc=$(echo $2 | cut -f1 -d: | sed 's/_/ /g') > + types=$(echo $2 | cut -f2- -d:) > + > + echo "file: <$file> description: <$desc> types:<$types>" > + > + ./scripts/checkpatch.pl --file --fix-inplace --strict --types="$types" $file > + > + checkpatch_fixes=$file.diff > + git diff --stat -p --exit-code $file > $checkpatch_fixes > + if [ $? == 0 ] ; then > + rm -f $checkpatch_fixes > + return > + fi > + > + basename=$(basename $file) > + if [ "${basename##*.}" == "c" ] ; then > + > + git checkout $file > + obj="$(echo $file | sed 's/\.c$/\.o/')" > + if [ -e $obj ] ; then > + rm -f $obj > + fi > + > + echo "Compiling original version..." > + > + ${CROSS_COMPILE}make $obj This fails for when a cflags option is set (like an include path). Now, I could argue that having an include path override in a kernel Makefile is a bug, but well, it's staging... Anyway, try running this script on drivers/staging/lustre/lnet/lnet/acceptor.c to see how this build fails. thanks, greg k-h ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] reformat_with_checkpatch: Add automation to checkpatch 2014-07-12 1:53 ` Greg KH @ 2014-07-12 1:57 ` Joe Perches 2014-07-12 2:15 ` Greg KH 2014-07-12 8:08 ` Greg KH 0 siblings, 2 replies; 27+ messages in thread From: Joe Perches @ 2014-07-12 1:57 UTC (permalink / raw) To: Greg KH Cc: devel, kernel-janitors, kernelnewbies, LKML, Dan Carpenter, Andrew Morton On Fri, 2014-07-11 at 18:53 -0700, Greg KH wrote: > On Fri, Jul 11, 2014 at 06:21:27PM -0700, Joe Perches wrote: > > A simple script to run checkpatch --fix for various types of > > of cleanups. [] > Anyway, try running this script on > drivers/staging/lustre/lnet/lnet/acceptor.c to see how this build fails. lustre doesn't use "normal" kernel makefiles. I supposed that the entire staging/lustre/ path could be built for every change, but for most of staging, and nearly all of the rest of the kernel tree, using: make <path>file.o works. I know there can be many enhancements to the reformat script, but I think a minimally acceptable version is a decent start. So, thanks for trying it out. And keep the complaints coming. cheers, Joe ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] reformat_with_checkpatch: Add automation to checkpatch 2014-07-12 1:57 ` Joe Perches @ 2014-07-12 2:15 ` Greg KH 2014-07-12 8:08 ` Greg KH 1 sibling, 0 replies; 27+ messages in thread From: Greg KH @ 2014-07-12 2:15 UTC (permalink / raw) To: Joe Perches Cc: devel, kernel-janitors, kernelnewbies, LKML, Dan Carpenter, Andrew Morton On Fri, Jul 11, 2014 at 06:57:24PM -0700, Joe Perches wrote: > On Fri, 2014-07-11 at 18:53 -0700, Greg KH wrote: > > On Fri, Jul 11, 2014 at 06:21:27PM -0700, Joe Perches wrote: > > > A simple script to run checkpatch --fix for various types of > > > of cleanups. > [] > > Anyway, try running this script on > > drivers/staging/lustre/lnet/lnet/acceptor.c to see how this build fails. > > lustre doesn't use "normal" kernel makefiles. Well, it does, it just has a: subdir-ccflags-y := -I$(src)/include/ line in drivers/staging/lustre/Makefile that messes up making .o files in subdirectories. I'll go fix that include file mess up now to be able to remove that line so the the .o file building will work. thanks, greg k-h ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] reformat_with_checkpatch: Add automation to checkpatch 2014-07-12 1:57 ` Joe Perches 2014-07-12 2:15 ` Greg KH @ 2014-07-12 8:08 ` Greg KH 1 sibling, 0 replies; 27+ messages in thread From: Greg KH @ 2014-07-12 8:08 UTC (permalink / raw) To: Joe Perches Cc: devel, kernelnewbies, kernel-janitors, LKML, Andrew Morton, Dan Carpenter On Fri, Jul 11, 2014 at 06:57:24PM -0700, Joe Perches wrote: > On Fri, 2014-07-11 at 18:53 -0700, Greg KH wrote: > > On Fri, Jul 11, 2014 at 06:21:27PM -0700, Joe Perches wrote: > > > A simple script to run checkpatch --fix for various types of > > > of cleanups. > [] > > Anyway, try running this script on > > drivers/staging/lustre/lnet/lnet/acceptor.c to see how this build fails. > > lustre doesn't use "normal" kernel makefiles. Ok, I've fixed all of the lustre Makefile crud up and checked it into my staging-next branch. In doing so, it exposed just what a horrid mess the lustre include files are, which is good, hopefully people will notice and start fixing it up. And with the fixes, this script now properly can build and test lustre files. thanks, greg k-h ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] reformat_with_checkpatch: Add automation to checkpatch 2014-07-12 1:21 [PATCH] reformat_with_checkpatch: Add automation to checkpatch Joe Perches ` (3 preceding siblings ...) 2014-07-12 1:53 ` Greg KH @ 2014-07-12 8:18 ` Greg KH 2014-07-12 10:13 ` Joe Perches 4 siblings, 1 reply; 27+ messages in thread From: Greg KH @ 2014-07-12 8:18 UTC (permalink / raw) To: Joe Perches Cc: devel, kernel-janitors, kernelnewbies, Andrew Morton, LKML, Dan Carpenter On Fri, Jul 11, 2014 at 06:21:27PM -0700, Joe Perches wrote: > A simple script to run checkpatch --fix for various types of > of cleanups. > > This script is useful primarily for staging. > > This reformats code to a more CodingStyle conforming style, > compiles it, verifies that the object code hasn't changed, > and git commits it too. > > You must have the necessary development tools, git, and a > recent git tree. Ideally use Greg KH's staging-next, which > can be retrieved via these commands: > > git clone git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git > git checkout staging-next > > To use this script try a sequence of commands like: > > cd <linux_repository> > git checkout -b <your_branch> > make allyesconfig > mkdir patches > ./scripts/reformat_with_checkpatch.sh drivers/staging/<dir>/*.[ch] > git format-patch --cover-letter -o patches/<your_branch> staging-next > git send-email patches/<your_branch> When running this on drivers/base/bus.c, it says that the .o files are different, when the diffstat for what makes them different is only whitespace. I did the following: $ scripts/reformat_with_checkpatch.sh drivers/base/bus.c Ignore the first set of things it tries to commit by answering N to the "Would you like to commit these changes". Then the second thing it tries to change in the file says that there is a .o file difference. Yet the diff is below, I don't see how this happens. Is this due to there being some old temp file around because I did not accept the first set of changes? thanks, greg k-h ------------- diff: drivers/base/bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 83e910a57563..3546d02b46f0 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -32,7 +32,6 @@ static struct kset *system_kset; #define to_drv_attr(_attr) container_of(_attr, struct driver_attribute, attr) - static int __must_check bus_rescan_devices_helper(struct device *dev, void *data); @@ -128,6 +127,7 @@ static const struct sysfs_ops bus_sysfs_ops = { int bus_create_file(struct bus_type *bus, struct bus_attribute *attr) { int error; + if (bus_get(bus)) { error = sysfs_create_file(&bus->p->subsys.kobj, &attr->attr); bus_put(bus); @@ -817,6 +817,7 @@ EXPORT_SYMBOL_GPL(device_reprobe); struct bus_type *find_bus(char *name) { struct kobject *k = kset_find_obj(bus_kset, name); + return k ? to_bus(k) : NULL; } #endif /* 0 */ -------------- What the script complained about: Comparing objects... --- drivers/base/bus.o.new 2014-07-12 01:16:32.984755945 -0700 +++ drivers/base/bus.o.old 2014-07-12 01:16:31.924755967 -0700 @@ -2449,13 +2449,13 @@ 0000000000000000 <descriptor.17493>: ... -: bf 03 00 00 00 mov $0x3,%edi +: be 03 00 00 00 mov $0x3,%esi : 00 00 add %al,(%rax) ... 0000000000000028 <descriptor.17483>: ... -: a2 03 00 00 00 00 00 movabs %al,0x3 +: a1 03 00 00 00 00 00 movabs 0x3,%eax : 00 00 0000000000000050 <descriptor.17406>: @@ -2468,7 +2468,7 @@ 0000000000000078 <descriptor.17073>: ... -: 56 push %rsi +: 57 push %rdi : 00 00 add %al,(%rax) : 00 00 add %al,(%rax) : 00 00 add %al,(%rax) Object differences exist! - Verify changes before commit! ^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH] reformat_with_checkpatch: Add automation to checkpatch 2014-07-12 8:18 ` Greg KH @ 2014-07-12 10:13 ` Joe Perches 0 siblings, 0 replies; 27+ messages in thread From: Joe Perches @ 2014-07-12 10:13 UTC (permalink / raw) To: Greg KH Cc: devel, kernel-janitors, kernelnewbies, Andrew Morton, LKML, Dan Carpenter On Sat, 2014-07-12 at 01:18 -0700, Greg KH wrote: > On Fri, Jul 11, 2014 at 06:21:27PM -0700, Joe Perches wrote: > > A simple script to run checkpatch --fix for various types of > > of cleanups. [] > I did the following: > > $ scripts/reformat_with_checkpatch.sh drivers/base/bus.c > > Ignore the first set of things it tries to commit by answering N to the > "Would you like to commit these changes". > > Then the second thing it tries to change in the file says that there is > a .o file difference. > > Yet the diff is below, I don't see how this happens. Is this due to > there being some old temp file around because I did not accept the first > set of changes? [] > What the script complained about: > > Comparing objects... > --- drivers/base/bus.o.new 2014-07-12 01:16:32.984755945 -0700 > +++ drivers/base/bus.o.old 2014-07-12 01:16:31.924755967 -0700 > @@ -2449,13 +2449,13 @@ > > 0000000000000000 <descriptor.17493>: > ... > -: bf 03 00 00 00 mov $0x3,%edi > +: be 03 00 00 00 mov $0x3,%esi > : 00 00 add %al,(%rax) > ... > > 0000000000000028 <descriptor.17483>: > ... > -: a2 03 00 00 00 00 00 movabs %al,0x3 > +: a1 03 00 00 00 00 00 movabs 0x3,%eax > : 00 00 > > 0000000000000050 <descriptor.17406>: > @@ -2468,7 +2468,7 @@ > > 0000000000000078 <descriptor.17073>: > ... > -: 56 push %rsi > +: 57 push %rdi > : 00 00 add %al,(%rax) > : 00 00 add %al,(%rax) > : 00 00 add %al,(%rax) > Object differences exist! - Verify changes before commit! > > I've no real idea, but this looks more like non-repeatable gcc compilation output to me. Here's my script output from that sequence. $ gcc --version gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ scripts/reformat_with_checkpatch.sh drivers/base/bus.c file: <drivers/base/bus.c> description: <whitespace neatening> types:<spacing,space_before_tab,pointer_location,trailing_whitespace,bracket_space> total: 0 errors, 0 warnings, 0 checks, 1272 lines checked NOTE: Used message types: BRACKET_SPACE POINTER_LOCATION SPACE_BEFORE_TAB SPACING TRAILING_WHITESPACE drivers/base/bus.c has no obvious style problems and is ready for submission. file: <drivers/base/bus.c> description: <remove spaces before tabs> types:<space_before_tab> total: 0 errors, 0 warnings, 0 checks, 1272 lines checked NOTE: Used message types: SPACE_BEFORE_TAB drivers/base/bus.c has no obvious style problems and is ready for submission. file: <drivers/base/bus.c> description: <fix label positions> types:<indented_label> total: 0 errors, 0 warnings, 0 checks, 1272 lines checked NOTE: Used message types: INDENTED_LABEL drivers/base/bus.c has no obvious style problems and is ready for submission. file: <drivers/base/bus.c> description: <align arguments to parenthesis> types:<parenthesis_alignment> CHECK: Alignment should match open parenthesis #37: FILE: drivers/base/bus.c:37: +static int __must_check bus_rescan_devices_helper(struct device *dev, + void *data); CHECK: Alignment should match open parenthesis #518: FILE: drivers/base/bus.c:518: + error = sysfs_create_link(&bus->p->devices_kset->kobj, + &dev->kobj, dev_name(dev)); CHECK: Alignment should match open parenthesis #522: FILE: drivers/base/bus.c:522: + error = sysfs_create_link(&dev->kobj, + &dev->bus->p->subsys.kobj, "subsystem"); CHECK: Alignment should match open parenthesis #701: FILE: drivers/base/bus.c:701: + printk(KERN_ERR "%s: uevent attr (%s) failed\n", + __func__, drv->name); CHECK: Alignment should match open parenthesis #707: FILE: drivers/base/bus.c:707: + printk(KERN_ERR "%s: driver_create_groups(%s) failed\n", + __func__, drv->name); CHECK: Alignment should match open parenthesis #715: FILE: drivers/base/bus.c:715: + printk(KERN_ERR "%s: add_bind_files(%s) failed\n", + __func__, drv->name); CHECK: Alignment should match open parenthesis #1003: FILE: drivers/base/bus.c:1003: + int (*compare)(const struct device *a, + const struct device *b)) total: 0 errors, 0 warnings, 7 checks, 1272 lines checked NOTE: Used message types: PARENTHESIS_ALIGNMENT Wrote EXPERIMENTAL --fix correction(s) to 'drivers/base/bus.c' Do _NOT_ trust the results written to this file. Do _NOT_ submit these changes without inspecting them for correctness. This EXPERIMENTAL file is simply a convenience to help rewrite patches. No warranties, expressed or implied... drivers/base/bus.c has style problems, please review. If any of these errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. Compiling original version... HOSTCC scripts/kconfig/conf.o HOSTCC scripts/kconfig/zconf.tab.o HOSTLD scripts/kconfig/conf scripts/kconfig/conf --silentoldconfig Kconfig CHK include/config/kernel.release make[1]: `all' is up to date. CHK include/generated/uapi/linux/version.h CHK include/generated/utsrelease.h CC arch/x86/kernel/asm-offsets.s GEN include/generated/asm-offsets.h CALL scripts/checksyscalls.sh CC drivers/base/bus.o patching file drivers/base/bus.c Compiling modified version... CHK include/config/kernel.release make[1]: `all' is up to date. CHK include/generated/uapi/linux/version.h CHK include/generated/utsrelease.h CALL scripts/checksyscalls.sh CC drivers/base/bus.o Comparing objects... No object differences found running checkpatch on possible checkpatch fixes... WARNING: line over 80 characters #27: FILE: drivers/base/bus.c:522: + &dev->bus->p->subsys.kobj, "subsystem"); drivers/base/bus.c.diff has style problems, please review. If any of these errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. Verify checkpatch output and make any necessary changes Edit 'drivers/base/bus.c' if appropriate Press the 'enter' key to continue: diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 83e910a..a9d5825 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -34,7 +34,7 @@ static struct kset *system_kset; static int __must_check bus_rescan_devices_helper(struct device *dev, - void *data); + void *data); static struct bus_type *bus_get(struct bus_type *bus) { @@ -515,11 +515,11 @@ int bus_add_device(struct device *dev) if (error) goto out_groups; error = sysfs_create_link(&bus->p->devices_kset->kobj, - &dev->kobj, dev_name(dev)); + &dev->kobj, dev_name(dev)); if (error) goto out_id; error = sysfs_create_link(&dev->kobj, - &dev->bus->p->subsys.kobj, "subsystem"); + &dev->bus->p->subsys.kobj, "subsystem"); if (error) goto out_subsys; klist_add_tail(&dev->p->knode_bus, &bus->p->klist_devices); @@ -698,13 +698,13 @@ int bus_add_driver(struct device_driver *drv) error = driver_create_file(drv, &driver_attr_uevent); if (error) { printk(KERN_ERR "%s: uevent attr (%s) failed\n", - __func__, drv->name); + __func__, drv->name); } error = driver_add_groups(drv, bus->drv_groups); if (error) { /* How the hell do we get out of this pickle? Give up */ printk(KERN_ERR "%s: driver_create_groups(%s) failed\n", - __func__, drv->name); + __func__, drv->name); } if (!drv->suppress_bind_attrs) { @@ -712,7 +712,7 @@ int bus_add_driver(struct device_driver *drv) if (error) { /* Ditto */ printk(KERN_ERR "%s: add_bind_files(%s) failed\n", - __func__, drv->name); + __func__, drv->name); } } @@ -1000,7 +1000,7 @@ EXPORT_SYMBOL_GPL(bus_get_device_klist); */ static void device_insertion_sort_klist(struct device *a, struct list_head *list, int (*compare)(const struct device *a, - const struct device *b)) + const struct device *b)) { struct list_head *pos; struct klist_node *n; Ready to commit - First verify all diffs and make any necessary changes Would you like to commit these changes <y>: n file: <drivers/base/bus.c> description: <fix brace positions> types:<open_brace,braces,else_after_brace,while_after_brace> CHECK: braces {} should be used on all arms of this statement #131: FILE: drivers/base/bus.c:131: + if (bus_get(bus)) { [...] + } else [...] total: 0 errors, 0 warnings, 1 checks, 1272 lines checked NOTE: Used message types: BRACES ELSE_AFTER_BRACE OPEN_BRACE WHILE_AFTER_BRACE drivers/base/bus.c has style problems, please review. If any of these errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. file: <drivers/base/bus.c> description: <fix blank lines> types:<line_spacing> CHECK: Please don't use multiple blank lines #35: FILE: drivers/base/bus.c:35: + + WARNING: Missing a blank line after declarations #131: FILE: drivers/base/bus.c:131: + int error; + if (bus_get(bus)) { WARNING: Missing a blank line after declarations #820: FILE: drivers/base/bus.c:820: + struct kobject *k = kset_find_obj(bus_kset, name); + return k ? to_bus(k) : NULL; total: 0 errors, 2 warnings, 1 checks, 1272 lines checked NOTE: Used message types: LINE_SPACING Wrote EXPERIMENTAL --fix correction(s) to 'drivers/base/bus.c' Do _NOT_ trust the results written to this file. Do _NOT_ submit these changes without inspecting them for correctness. This EXPERIMENTAL file is simply a convenience to help rewrite patches. No warranties, expressed or implied... drivers/base/bus.c has style problems, please review. If any of these errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. Compiling original version... CHK include/config/kernel.release make[1]: `all' is up to date. CHK include/generated/uapi/linux/version.h CHK include/generated/utsrelease.h CALL scripts/checksyscalls.sh CC drivers/base/bus.o patching file drivers/base/bus.c Compiling modified version... CHK include/config/kernel.release make[1]: `all' is up to date. CHK include/generated/uapi/linux/version.h CHK include/generated/utsrelease.h CALL scripts/checksyscalls.sh CC drivers/base/bus.o Comparing objects... No object differences found running checkpatch on possible checkpatch fixes... drivers/base/bus.c.diff has no obvious style problems and is ready for submission. Verify checkpatch output and make any necessary changes Edit 'drivers/base/bus.c' if appropriate Press the 'enter' key to continue: diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 83e910a..3546d02 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -32,7 +32,6 @@ static struct kset *system_kset; #define to_drv_attr(_attr) container_of(_attr, struct driver_attribute, attr) - static int __must_check bus_rescan_devices_helper(struct device *dev, void *data); @@ -128,6 +127,7 @@ static const struct sysfs_ops bus_sysfs_ops = { int bus_create_file(struct bus_type *bus, struct bus_attribute *attr) { int error; + if (bus_get(bus)) { error = sysfs_create_file(&bus->p->subsys.kobj, &attr->attr); bus_put(bus); @@ -817,6 +817,7 @@ EXPORT_SYMBOL_GPL(device_reprobe); struct bus_type *find_bus(char *name) { struct kobject *k = kset_find_obj(bus_kset, name); + return k ? to_bus(k) : NULL; } #endif /* 0 */ Ready to commit - First verify all diffs and make any necessary changes Would you like to commit these changes <y>: ^ permalink raw reply related [flat|nested] 27+ messages in thread
end of thread, other threads:[~2014-10-30 11:15 UTC | newest] Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2014-07-12 1:21 [PATCH] reformat_with_checkpatch: Add automation to checkpatch Joe Perches 2014-07-12 1:34 ` Greg KH 2014-07-12 1:40 ` Joe Perches 2014-07-12 2:34 ` Greg KH 2014-07-12 9:30 ` Dan Carpenter 2014-07-12 17:55 ` Greg KH 2014-07-12 18:29 ` Joe Perches 2014-07-12 19:28 ` Greg KH 2014-07-13 3:06 ` Joe Perches 2014-07-12 1:39 ` Greg KH 2014-07-12 1:46 ` Joe Perches 2014-07-12 2:01 ` Greg KH 2014-07-12 2:05 ` Greg KH 2014-07-12 2:09 ` [PATCH] checkpatch: Remove unnecessary + after {8,8} Joe Perches 2014-07-12 2:23 ` Greg KH 2014-08-31 20:58 ` Sören Brinkmann 2014-09-01 16:55 ` [PATCH - resend] " Joe Perches 2014-10-30 11:12 ` Borislav Petkov 2014-10-30 11:15 ` Borislav Petkov 2014-07-12 1:43 ` [PATCH] reformat_with_checkpatch: Add automation to checkpatch Greg KH 2014-07-12 1:50 ` Joe Perches 2014-07-12 1:53 ` Greg KH 2014-07-12 1:57 ` Joe Perches 2014-07-12 2:15 ` Greg KH 2014-07-12 8:08 ` Greg KH 2014-07-12 8:18 ` Greg KH 2014-07-12 10:13 ` Joe Perches
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).