mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@infradead.org>
To: Tilman Schmidt <tilman@imap.cc>
Cc: Andy Whitcroft <apw@canonical.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Andy Walls <awalls@radix.net>
Subject: Re: checkpatch is not detecting bad whitespacing when using macros on formulas
Date: Sun, 11 Oct 2009 11:26:24 -0300	[thread overview]
Message-ID: <20091011112624.39830ef9@pedra.chehab.org> (raw)
In-Reply-To: <4AD1BB06.70309@imap.cc>

Em Sun, 11 Oct 2009 13:01:26 +0200
Tilman Schmidt <tilman@imap.cc> escreveu:

> Mauro Carvalho Chehab schrieb:
> > While reviewing a patch from Andy Walls, I noticed that checkpatch v 0.29
> > didn't get any errors when bad whitespacing is used on some formulas:
> > 
> > $ checkpatch.pl cx23888-ir-part2_2.patch
> > total: 0 errors, 0 warnings, 1237 lines checked
> > 
> > cx23888-ir-part2_2.patch has no obvious style problems and is ready for submission.
> > 
> > However, there are several places at the patch like:
> > 
> > +static inline u16 ns_to_clock_divider(unsigned int ns)
> > +{
> > +       return count_to_clock_divider(
> > +                 DIV_ROUND_CLOSEST(CX23888_IR_REFCLK_FREQ/1000000 * ns, 1000));
> > +}
> 
> checkpatch is already complaining too much rather than too little.
> No need to add even more complaints.
> 
> The code you cite above is fine IMHO, but if you don't like it, feel
> free to raise your complaints. You can do so without help from
> checkpatch, too.

Chapter 3.1 of CodingStyle says:

	Use one space around (on each side of) most binary and ternary operators,
	such as any of these:

	        =  +  -  <  >  *  /  %  |  &  ^  <=  >=  ==  !=  ?  :

At the above, it should have an space before and after the first division
operator. So, we should or fix checkpatch.pl or remove the above rule from
CodingStyle.

Note that the patch has other similar troubles, like:

+       if (d > RXCLK_RCD+1)
+                                CX23888_IR_REFCLK_FREQ/1000000);
+       if (rem >= CX23888_IR_REFCLK_FREQ/1000000/2)
+       clocks = CX23888_IR_REFCLK_FREQ/1000000 * (u64) ns; /* millicycles    */
+       return DIV_ROUND_CLOSEST((n+1) * 100, 16);



Cheers,
Mauro

  reply	other threads:[~2009-10-11 14:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-11 10:19 Mauro Carvalho Chehab
2009-10-11 11:01 ` Tilman Schmidt
2009-10-11 14:26   ` Mauro Carvalho Chehab [this message]
2009-10-11 22:04     ` Tilman Schmidt
2009-10-26 11:20 ` Andy Whitcroft

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=20091011112624.39830ef9@pedra.chehab.org \
    --to=mchehab@infradead.org \
    --cc=apw@canonical.com \
    --cc=awalls@radix.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tilman@imap.cc \
    /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

all inboxes | Powered by JetHome®