kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Peter Senna Tschudin <peter.senna@gmail.com>
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: checkpatch guide for newbies
Date: Mon, 23 Sep 2013 13:29:02 +0000	[thread overview]
Message-ID: <20130923132901.GH6247@mwanda> (raw)
In-Reply-To: <CA+MoWDpwx_2kh9bEARh4D5xzyYhWekAceipf0YN=3a+Q5W4eNQ@mail.gmail.com>

On Mon, Sep 23, 2013 at 02:46:38PM +0200, Peter Senna Tschudin wrote:
> > It's preferred if the operator goes at the end of the first line instead of at
> > the start of the second line:
> > Bad:
> > -       PowerData = (1 << 31) | (0 << 30) | (24 << 24)
> > -                   | BitReverse(w89rf242_txvga_data[i][0], 24);
> > Good:
> > +       PowerData = (1 << 31) | (0 << 30) | (24 << 24) |
> > +                   BitReverse(w89rf242_txvga_data[i][0], 24);
> What is the rule for where to start the second line here?
> 

The if statement alignment has become a rule and people will make you
redo it if it's not aligned.  I haven't seen anyone have to redo a
patch because of alignment on these:

My favorite format is aligned:
	foo = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -
	      yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy;

Also popular:
	foo = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -
		yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy;

Right aligned looks like nonsense:
	foo = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -
					yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy;

Here is a more complex aligned statement:
	foo = bar * (xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -
		     yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy);

regards,
dan carpenter

  reply	other threads:[~2013-09-23 13:29 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-23  9:01 checkpatch guide for newbies Dan Carpenter
2013-09-23 12:46 ` Peter Senna Tschudin
2013-09-23 13:29   ` Dan Carpenter [this message]
2013-09-23 14:04   ` Geert Uytterhoeven
2013-09-23 18:06 ` Joe Perches
2013-09-23 20:17   ` Joe Perches
2013-09-23 18:35 ` bojan prtvar
2013-09-24 16:36 ` Bjorn Helgaas
2013-09-24 17:26   ` Alexander Holler
2013-09-24 17:43     ` Alexander Holler
2013-09-24 18:50       ` Alexander Holler
2013-09-24 19:29     ` Peter Senna Tschudin
2013-09-24 19:59       ` Dan Carpenter
2013-09-24 20:13       ` Bjorn Helgaas
2013-09-24 22:10         ` Alexander Holler
2013-09-26  2:11           ` Al Viro
2013-09-26  2:52             ` Alexander Holler
2013-09-26  2:57               ` Alexander Holler
2013-09-26  3:04                 ` Al Viro
2013-09-26  3:27                   ` Alexander Holler
2013-09-26  3:48                     ` Al Viro
2013-09-26  4:21                       ` Alexander Holler
2013-09-26  5:53                     ` Julia Lawall
2013-09-26  9:55                       ` Alexander Holler

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=20130923132901.GH6247@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peter.senna@gmail.com \
    /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 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).