All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Greg KH <gregkh@suse.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
	devel <devel@driverdev.osuosl.org>,
	Andy Whitcroft <apw@shadowen.org>
Subject: Re: Tuxradar patching article and [PATCH] scripts/cvt_kernel_style.pl
Date: Tue, 09 Mar 2010 16:06:59 -0800	[thread overview]
Message-ID: <1268179619.1545.95.camel@Joe-Laptop.home> (raw)
In-Reply-To: <20100309234152.GA30270@suse.de>

On Tue, 2010-03-09 at 15:41 -0800, Greg KH wrote:
> On Tue, Mar 09, 2010 at 03:32:06PM -0800, Joe Perches wrote:
> > There was an article published recently:
> > http://www.tuxradar.com/content/newbies-guide-hacking-linux-kernel
> > that seems to have prompted several new contributors (welcome)
> > to create style reformatting patches.
> > 
> > The article recommends running checkpatch and fixing the various
> > non-conforming style elements the output produces.
> > 
> > A better solution might be to enhance checkpatch to rewrite the
> > patch or a file with -f, but that's more than I'd like to do.
> 
> I _really_ dislike automatic source conversions by a tool and do not
> recommend doing that at all.

Don't be silly.

You take automatic conversions from tools like coccinelle all
the time.

What I found poorly written about the article was
unfortunately you apparently recommend things like:

        if (error != -ENODEV) {
                foo();
                bar();
        } else {
        	report_error();
        	goto exit;
        }
        
instead of:

        if (error == -ENODEV) {
        	report_error();
        	goto exit;
        }
        foo();
        bar();

and the brace removal example was unfortunate because
it used printk without KERN_<level> without explanation.

I think there wasn't enough emphasis on compiling the new
patched file with something like a .o or .lst comparison
to the unmodified source to make sure it was OK to send
to the list.

> It's better that you look at the code yourself, and make the change that
> looks correct, which is not always the same thing that an automated tool
> would do.

I disagree.

It's better to make changes that _actually are_ correct.
People also neglect to see and convert a lot of things.

Tools can make coverage a bit better which is why a tool
like checkpatch exists in the first place.

> Becides, we have the Lindent script, which does almost exactly what you
> are trying to do here, why reinvent the wheel?

Lindent does a relatively poor job at conversions,
and it's all or nothing.  A tool that could be used
to selectively perform various conversions would be
better and could produce patches that are human
verifiable.

For instance, look at what happened with the old
reiserfs changes.

Lindent badly mucked up comments, did a poor job at
columnarization of variable declarations, didn't
understand c99 very well, was wretched at 80 columns,
etc.

I think the Lindent script should be deprecated and
checkpatch enhanced myself.  And until then, I think
a script like cvt_kernel_style.pl has some use.

cheers, Joe


  reply	other threads:[~2010-03-10  0:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-09 23:32 Tuxradar patching article and [PATCH] scripts/cvt_kernel_style.pl Joe Perches
2010-03-09 23:41 ` Greg KH
2010-03-10  0:06   ` Joe Perches [this message]
2010-03-10  0:16     ` Greg KH
2010-03-10  0:34       ` Joe Perches
2010-03-10 18:35     ` Stefan Richter
2010-03-10 18:38       ` Joe Perches
2010-03-10  1:22 ` Frans Pop
2010-03-10  3:25   ` [PATCH V2] scripts/cvt_kernel_style.pl: partial "kernel style" pretty-printing Joe Perches
2010-03-24 20:01     ` [PATCH] scripts/cvt_kernel_style.pl: kernel style source code reformatter Joe Perches
2010-03-24 22:31       ` Frans Pop
2010-03-10 18:32 ` Tuxradar patching article and [PATCH] scripts/cvt_kernel_style.pl Stefan Richter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1268179619.1545.95.camel@Joe-Laptop.home \
    --to=joe@perches.com \
    --cc=apw@shadowen.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.