All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] Question about Coding-Style
Date: Tue, 04 Feb 2014 16:02:56 +0100	[thread overview]
Message-ID: <52F10120.9040700@denx.de> (raw)
In-Reply-To: <29703.213.33.116.113.1391525447.squirrel@petermaier.org>

Hi Hannes,

On 04/02/2014 15:50, Hannes Petermaier wrote:

> The 80 character thing is reported from checkpatch.pl as WARNING, not as
> ERROR - so there will be a chance of the patch to become accepted by a
> custodian.

No, it will *not* be accepted. There must be a very good reason to
accept it.

As far as I know, there are only a few warnings that are generally
accepted (I think using typedf is one of them).

> In between i tried to reformat by Code to obey to these rules, but now
> checkpatch.pl tells me following:
> 
> WARNING: Avoid unnecessary line continuations
> #531: FILE: board/BuR/bur_tseries/board.c:155:
> +	if (tps65217_voltage_update(TPS65217_DEFDCDC3, \

Why do you need "\" ? It is not a macro, checkpatch is right.

> 
> in real life the code section looks like this:
> /* Set DCDC3 (CORE) voltage to 1.125V */
> if (tps65217_voltage_update(TPS65217_DEFDCDC3, \
> 			TPS65217_DCDC_VOLT_SEL_1125MV)) {

Again, you do not need the line continuation because it is not a macro.
The compiler knows that the statement is not yet finished.

> 	puts("tps65217_voltage_update failure\n");
> 	return;
> }
> 
> If i don't do the line break  at line 155 checkpatch.pl is disturbing me
> with the 80 character rule.

Simply drop the unnecessary "\".

> 
> Another thing is linewrapping of output strings, to obey to the rules i
> have to format the string as following:
> 
> if (i2c_probe(TPS65217_CHIP_PM)) {
> 	printf("PMIC chip (0x%02x) not present! skipping" \
> 		"further configuration.\n", TPS65217_CHIP_PM);
> 	return;
> }
> 
> But this makes it impossible to grep the code in case of an error.

You must combine a more complicate grep, maybe with the -A (after
context) option or using a regexp. However, this is not a reason to
break the rule.

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

  reply	other threads:[~2014-02-04 15:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-04 12:50 [U-Boot] Question about Coding-Style Hannes Petermaier
2014-02-04 14:14 ` Stefano Babic
2014-02-04 14:18   ` Michael Trimarchi
2014-02-04 14:50   ` Hannes Petermaier
2014-02-04 15:02     ` Stefano Babic [this message]
2014-02-04 15:07       ` Tom Rini
2014-02-10  9:58         ` Albert ARIBAUD
2014-02-10 10:16           ` Chris Moore
2014-02-10 10:54             ` Albert ARIBAUD
2014-02-10 18:27             ` Wolfgang Denk
2014-02-04 20:32     ` Wolfgang Denk
2014-02-04 15:02 ` Tom Rini
2014-02-04 20:20 ` Wolfgang Denk
2014-02-04 22:03 ` Scott Wood
2014-02-12 13:21   ` Fabio Estevam

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=52F10120.9040700@denx.de \
    --to=sbabic@denx.de \
    --cc=u-boot@lists.denx.de \
    /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.