mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Randy Dunlap <randy.dunlap@oracle.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Ingo Molnar <mingo@elte.hu>,
	Jeremy Fitzhardinge <jeremy@goop.org>,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	stable@kernel.org, Greg KH <greg@kroah.com>,
	Chris Wright <chrisw@sous-sol.org>
Subject: Re: [patch] fix the softlockup watchdog to actually work
Date: Tue, 17 Jul 2007 14:38:43 -0700	[thread overview]
Message-ID: <20070717143843.2a5cbf1b.randy.dunlap@oracle.com> (raw)
In-Reply-To: <alpine.LFD.0.999.0707171110540.27353@woody.linux-foundation.org>

On Tue, 17 Jul 2007 11:14:51 -0700 (PDT) Linus Torvalds wrote:

> On Tue, 17 Jul 2007, Randy Dunlap wrote:
> >
> > > +	if ((print_timestamp >= touch_timestamp &&
> > > +			print_timestamp < (touch_timestamp + 1)) ||
> > > +			did_panic || !per_cpu(watchdog_task, this_cpu)) {
> > >  		return;
> > > +	}
> > >  
> > >  	/* do not print during early bootup: */
> > >  	if (unlikely(system_state != SYSTEM_RUNNING)) {
> > 
> > patch contains unneeded braces { }.
> 
> When there are issues with indentation, those braces are actually not 
> unneeded any more, except for the compiler.
> 
> Just _look_ at the code. The indentation is not obvious, because the 
> if-conditional itself is multiple lines, and indented (arguably wrongly so 
> too, but that's another issue).

I strongly agree with your parenthetical remark and think that is
the real problem.


> So it's no longer a trivial one-liner statement, it's a "multi-statement" 
> spread out over multiple lines, and I think the braces are actually a good 
> idea for things like that.
> 
> I also encourage people do do braces when you have nested indentation, ie
> 
> 	if (something)
> 		if (somethingelse)
> 			return;

I think that this is wrong only when there is an "else" branch
following this.

> is actively *wrong*, while
> 
> 	if (something) {
> 		if (somethingelse)
> 			return;
> 	}
> 
> is right, even though the braces are "unnecessary". Again, it's about the 
> visual representation, not about whether the compiler needs them or not.

I agree with your last statement.
And thankfully none of this is in CodingStyle.  (oops)


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

  reply	other threads:[~2007-07-17 21:37 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-17 11:44 [patch] softlockup watchdog: fix Xen bogosity Ingo Molnar
2007-07-17 14:17 ` Jeremy Fitzhardinge
2007-07-17 15:49   ` [patch] fix the softlockup watchdog to actually work Ingo Molnar
2007-07-17 17:03     ` Randy Dunlap
2007-07-17 17:25       ` Ingo Molnar
2007-07-17 18:14       ` Linus Torvalds
2007-07-17 21:38         ` Randy Dunlap [this message]
2007-07-19  7:22     ` Andrew Morton
2007-07-19  7:46       ` Ingo Molnar
2007-07-19  7:51       ` Ingo Molnar
2007-07-19 14:31         ` Jeremy Fitzhardinge
2007-07-19 14:35           ` Ingo Molnar
2007-07-19 14:40             ` Jeremy Fitzhardinge
2007-07-19 14:46             ` Jeremy Fitzhardinge
2007-07-19 14:50               ` Ingo Molnar
2007-07-19 15:04                 ` Jeremy Fitzhardinge
2007-07-19 15:09                   ` Ingo Molnar
2007-07-19 15:21                     ` Jeremy Fitzhardinge
2007-07-19 15:42                       ` [patch] sched: implement cpu_clock(cpu) high-speed time source Ingo Molnar
2007-07-19 15:44                         ` [patch] sched: implement cpu_clock(cpu) high-speed time source, take #2 Ingo Molnar
2007-07-19 16:11                           ` Jeremy Fitzhardinge
2007-07-19 16:16                             ` Ingo Molnar
2007-07-19 16:18                               ` Jeremy Fitzhardinge
2007-07-19 16:21                                 ` Ingo Molnar
2007-07-19 16:29                                   ` Jeremy Fitzhardinge
2007-07-19 17:24                             ` Jens Axboe
2007-07-19 18:10                               ` Jeremy Fitzhardinge
2007-07-19 18:20                                 ` Jens Axboe
2007-07-25  8:49     ` [patch] fix the softlockup watchdog to actually work Andrew Morton
2007-07-25  8:52       ` Ingo Molnar
2007-07-25  8:55         ` Ingo Molnar
2007-07-25  9:00         ` Andrew Morton
2007-07-25  9:04           ` Ingo Molnar
2007-07-25  9:17             ` Andrew Morton
2007-07-25  9:23               ` Ingo Molnar
2007-07-25  9:59                 ` Jens Axboe
2007-07-25 11:04                   ` Ingo Molnar
2007-07-25 11:06                     ` Jens Axboe
2007-07-25 16:34       ` Andi Kleen
2007-10-03 23:49     ` Yinghai Lu

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=20070717143843.2a5cbf1b.randy.dunlap@oracle.com \
    --to=randy.dunlap@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=chrisw@sous-sol.org \
    --cc=greg@kroah.com \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome