public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Michael Trimarchi <trimarchi@gandalf.sssup.it>
Cc: Greg KH <greg@kroah.com>,
	linux-pm@lists.linux-foundation.org, pavel@suse.cz,
	len.brown@intel.com
Subject: Re: [RFC Add in_use attribute] Let the driver know if it's in use
Date: Thu, 23 Apr 2009 16:59:19 +0200	[thread overview]
Message-ID: <200904231659.20598.rjw@sisk.pl> (raw)
In-Reply-To: <49F02B2A.7030701@gandalf.sssup.it>

On Thursday 23 April 2009, Michael Trimarchi wrote:
> Greg KH wrote:
> > On Tue, Apr 21, 2009 at 08:43:28AM +0200, Michael Trimarchi wrote:
> >   
> >>>>> Exactly, what are you trying to do that differs from
> >>>>> device_for_each_child()?
> >>>>>   
> >>>>>       
> >>>>>           
> >>>> Is device for each child use to visist the first level of the tree?
> >>>>     
> >>>>         
> >>> Have you tried it?
> >>>   
> >>>       
> >> No, I take a look at the code.
> >>
> >> int device_for_each_child(struct device *parent, void *data,
> >>                           int (*fn)(struct device *dev, void *data))
> >> {
> >>         struct klist_iter i;
> >>         struct device *child;
> >>         int error = 0;
> >>
> >>         klist_iter_init(&parent->p->klist_children, &i);
> >>
> >> I was thinking that the klist_children is the fist_level one children, 
> >> so each time
> >> a device is registerd it add the link to the parent.
> >>     
> >
> > Yes it does.
> >
> > But you have to start at some device, right?  So you don't need to
> > iterate over it, just go from there on down if needed.
> >   
> I start for a device, go down until I find a leaf or find that the 
> subtree is marked.
> Mark the leaf and go up and take the next node like the walk_tg_tree. 
> The difference is
> that I skip subtree if they are mark in_use.
> > So I don't see why this helper function is needed at all yet, shouldn't
> > we be doing the check within the normal suspend device walk of the tree?
> >   
> Sorry but here I need some help here. Where is the walk of the device 
> tree during suspend?

In drivers/base/power/main.c there are functions like dpm_suspend(), for one
example, that walk the device tree, but they do it in a simplified way, using a
list prepared specifically for this purpose (so the walk is in fact linear).

Thanks,
Rafael

  reply	other threads:[~2009-04-23 14:59 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-16 13:13 [RFC Add in_use attribute] Let the driver know if it's in use Michael Trimarchi
2009-04-20  9:09 ` Michael Trimarchi
2009-04-20 21:54 ` Rafael J. Wysocki
2009-04-20 22:11   ` Alan Stern
2009-04-20 22:15     ` Greg KH
2009-04-21 18:33       ` Rafael J. Wysocki
2009-04-21 21:55         ` Greg KH
2009-04-21  5:17     ` Michael Trimarchi
2009-04-21 18:30     ` Rafael J. Wysocki
2009-04-20 22:45   ` Greg KH
2009-04-21  5:08     ` Michael Trimarchi
2009-04-21  6:17       ` Greg KH
2009-04-21  6:43         ` Michael Trimarchi
2009-04-21 21:56           ` Greg KH
2009-04-23  8:47             ` Michael Trimarchi
2009-04-23 14:59               ` Rafael J. Wysocki [this message]
2009-04-23 16:49                 ` Michael Trimarchi
2009-04-23 21:41                   ` Rafael J. Wysocki
2009-04-21  5:01   ` Michael Trimarchi
2009-04-21 18:46     ` Rafael J. Wysocki
2009-04-23  6:01       ` Michael Trimarchi
2009-04-23  6:11       ` Michael Trimarchi
2009-04-23 14:56         ` Rafael J. Wysocki

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=200904231659.20598.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=greg@kroah.com \
    --cc=len.brown@intel.com \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=pavel@suse.cz \
    --cc=trimarchi@gandalf.sssup.it \
    /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