public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: linux-pm@lists.linux-foundation.org
Subject: Re: Runtime PM: Calling Device runtime PM callbacks?
Date: Sat, 19 Dec 2009 22:31:40 +0100	[thread overview]
Message-ID: <200912192231.40234.rjw@sisk.pl> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0912191138410.29317-100000@netrider.rowland.org>

On Saturday 19 December 2009, Alan Stern wrote:
> On Sat, 19 Dec 2009, Rafael J. Wysocki wrote:
> 
> > On Tuesday 15 December 2009, Rafael J. Wysocki wrote:
> > > On Tuesday 15 December 2009, Alan Stern wrote:
> > > > On Tue, 15 Dec 2009, Rafael J. Wysocki wrote:
> > ...
> > > 
> > > > > Now, if we agree that only one callback will be called for given device
> > > > > (either bus type, or device type, or device class), the code may be simpler
> > > > > and there won't be an issue with the ordering in _idle.
> > > > 
> > > > That would be perfectly fine with me.
> > > 
> > > OK
> > 
> > Updated patch is appended, please tell me what you think.
> 
> Yes, this is the sort of thing I had in mind.  Although it might be
> nice to avoid all the repeated code.  For example, you might add a
> helper routine:
> 
> 	static int invoke_callback(struct device *dev,
> 			int (*func)(struct device *))
> 	{
> 		int retval;
> 
> 		spin_unlock_irq(&dev->power.lock);
> 		retval = func(dev);
> 		spin_lock_irq(&dev->power.lock);
> 		return retval;
> 	}

The problem with dev->power.runtime_error would reappear in
that case and I think the "unlock, do something, lock" structure looks odd. :-)

The only things repeated are unlocking, locking and
"dev->power.runtime_error = retval", which I think is not too much ...

Rafael

      reply	other threads:[~2009-12-19 21:31 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-13  5:20 Runtime PM: Calling Device runtime PM callbacks? Mahalingam, Nithish
2009-12-13 12:34 ` Rafael J. Wysocki
2009-12-13 16:57   ` Alan Stern
2009-12-13 18:36     ` Rafael J. Wysocki
2009-12-13 18:49       ` Alan Stern
2009-12-14  0:03         ` Rafael J. Wysocki
2009-12-14  3:36           ` Mahalingam, Nithish
2009-12-14  4:42             ` Alan Stern
2009-12-14 21:58               ` Rafael J. Wysocki
2009-12-14  4:37           ` Alan Stern
2009-12-14 21:57             ` Rafael J. Wysocki
2009-12-14 22:08               ` Alan Stern
2009-12-14 22:28                 ` Rafael J. Wysocki
2009-12-14 23:09                   ` Alan Stern
2009-12-14 23:26                     ` Rafael J. Wysocki
2009-12-15  3:11                       ` Mahalingam, Nithish
2009-12-15 14:40                       ` Alan Stern
2009-12-15 20:30                         ` Rafael J. Wysocki
2009-12-15 20:51                           ` Alan Stern
2009-12-15 21:04                             ` Rafael J. Wysocki
2009-12-19 15:13                               ` Rafael J. Wysocki
2009-12-19 16:46                                 ` Alan Stern
2009-12-19 21:31                                   ` Rafael J. Wysocki [this message]

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=200912192231.40234.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=stern@rowland.harvard.edu \
    /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