From: David Brownell <david-b@pacbell.net>
To: Russell King <rmk@arm.linux.org.uk>
Cc: Andrew Victor <andrew@sanpeople.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-pm@lists.linux-foundation.org
Subject: Re: [patch 2.6.23-rc2 1/2] define clk_must_disable()
Date: Tue, 7 Aug 2007 14:04:41 -0700 [thread overview]
Message-ID: <200708071404.41476.david-b@pacbell.net> (raw)
In-Reply-To: <20070807125054.GC2833@flint.arm.linux.org.uk>
On Tuesday 07 August 2007, Russell King wrote:
> 3. due to the negative semantics, code such as the following is difficult
> to interpret and work out whether it's correct due to the double
> negative:
In terms of pure patch review, the "-" bit you omitted sure helps me
to see that it's an "obviously" correct transformation:
- if (device_may_wakeup(&pdev->dev) && !at91_suspend_entering_slow_clock())
> + if (device_may_wakeup(&pdev->dev)
> + && !clk_must_disable(atmel_port->clk))
> enable_irq_wake(port->irq);
In the case of nutball configurations like clocking UART from 32KiHz,
it's more correct. Likewise, it can work with AVR32 platforms, once
they support PM.
There are numerous idioms that one could allege are confusing -- especially
when looking at them without any context! -- but which in practice are not.
The whole "if" statement is:
if (device_may_wakeup(&pdev->dev)
&& !clk_must_disable(atmel_port->clk))
enable_irq_wake(port->irq);
else {
uart_suspend_port(&atmel_uart, port);
atmel_port->suspended = 1;
}
That's a lot more clear then the fragment you showed -- suspend, or
keep it active with wakeup enabled -- with the main confusion coming
from the serial stack itself: the way clk_disable() gets hidden
deep inside uart_suspend_port().
If you're saying that should be rewritten, something like:
if (!device_may_wakeup(...) || clk_must_disable(...)) {
suspend port
} else
leave it active, with wakeup enabled
That might be true, but it's not a new issue or attributable to
this patch. Likewise with (potentially) adding comments.
- Dave
next prev parent reply other threads:[~2007-08-07 21:04 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-06 18:11 [patch 2.6.23-rc2 1/2] define clk_must_disable() David Brownell
2007-08-06 20:04 ` Russell King
2007-08-06 20:38 ` David Brownell
2007-08-06 21:03 ` David Brownell
2007-08-06 21:48 ` Russell King
2007-08-06 23:46 ` David Brownell
2007-08-07 5:23 ` Andrew Morton
2007-08-07 12:50 ` Russell King
2007-08-07 17:21 ` Andrew Morton
2007-08-07 17:25 ` Russell King
2007-08-07 20:15 ` David Brownell
2007-08-07 20:18 ` David Brownell
2007-08-07 21:04 ` David Brownell [this message]
2007-08-07 21:17 ` David Brownell
2007-08-07 22:20 ` Rafael J. Wysocki
2007-08-07 21:20 ` David Brownell
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=200708071404.41476.david-b@pacbell.net \
--to=david-b@pacbell.net \
--cc=akpm@linux-foundation.org \
--cc=andrew@sanpeople.com \
--cc=linux-pm@lists.linux-foundation.org \
--cc=rmk@arm.linux.org.uk \
/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