public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Russell King <rmk@arm.linux.org.uk>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Andrew Victor <andrew@sanpeople.com>,
	linux-pm@lists.linux-foundation.org
Subject: Re: [patch 2.6.23-rc2 1/2] define clk_must_disable()
Date: Tue, 7 Aug 2007 18:25:42 +0100	[thread overview]
Message-ID: <20070807172542.GA31094@flint.arm.linux.org.uk> (raw)
In-Reply-To: <20070807102106.58c8191f.akpm@linux-foundation.org>

On Tue, Aug 07, 2007 at 10:21:06AM -0700, Andrew Morton wrote:
> On Tue, 7 Aug 2007 13:50:54 +0100 Russell King <rmk@arm.linux.org.uk> wrote:
> 
> > I do not think that the clk_must_disable() API is well enough thought out
> > for the following reasons:
> > 
> > 1. the name sucks - it tells you nothing about it's purpose, which as
> >    the name currently stands can be interpreted in as many ways as there
> >    are species of animals on this planet.
> > 
> >    While the comments around the prototype help interpret its semantics,
> >    it is no subsitute for having a good name for the function.
> > 
> > 2. it's unclear how this function obtains information about the "upcoming
> >    system state" and therefore decides whether the particular clock may
> >    be available.
> > 
> > 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:
> > 
> >   +     if (device_may_wakeup(&pdev->dev)
> >   +                     && !clk_must_disable(atmel_port->clk))
> >                 enable_irq_wake(port->irq);
> > 
> > 4. the description of the function implies that this function may be
> >    called when we are not suspending:
> > 
> >   + * On platforms that support reduced functionality operating states, the
> >   + * constraint may also need to be tested during resume() and probe() calls.
> > 
> >    With SoCs with multiple power states affecting which clocks are
> >    available, and the need in point (2) for the architecture code to
> >    record which PM mode we're entering via the pm_ops set_target method,
> >    calling clk_must_disable() outside of the suspend methods results in
> >    this function essentially returning undefined values at driver probe
> >    time.  Note: there is no locking between driver probing and the
> >    set_target method.
> > 
> >    Moreover, if used in a driver probe() path, the return value could
> >    well depend on the _last_ system suspend state entered, and would be
> >    undefined for a system which hasn't been suspended from boot.
> > 
> > Changing the function name to "clk_available_in_suspend()" addresses at
> > least two of these points.  The other two points are addressed by
> > providing a way for the method to be passed the desired system suspend
> > state, which may be resolved by expanding pm_message_t to contain that
> > information.
> 
> I see, thanks.  clk_available_in_suspend() sure is a better name.
> 
> > Finally, concerning merging this during the -rc phase, I'd much rather
> > see the one liner simple build fix of adding the missing function
> > prototype going into the -rc kernels, and then a similar patch to this
> > going in during the next merge window.
> 
> Here's where confusion sets in.  I have this:

See 2/2.  Both patches need to be looked at together.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:

  reply	other threads:[~2007-08-07 17:25 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 [this message]
2007-08-07 20:15             ` David Brownell
2007-08-07 20:18             ` David Brownell
2007-08-07 21:04             ` David Brownell
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=20070807172542.GA31094@flint.arm.linux.org.uk \
    --to=rmk@arm.linux.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=andrew@sanpeople.com \
    --cc=linux-pm@lists.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