public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Michael Trimarchi <trimarchi@gandalf.sssup.it>
Cc: len.brown@intel.com, linux-pm@lists.linux-foundation.org
Subject: Re: [RFC Add no_suspend attribute V2] Let the driver	know if it's in use
Date: Fri, 24 Apr 2009 15:55:01 -0700	[thread overview]
Message-ID: <20090424225501.GC3343@kroah.com> (raw)
In-Reply-To: <49F1FD2B.5020906@gandalf.sssup.it>

On Fri, Apr 24, 2009 at 07:55:55PM +0200, Michael Trimarchi wrote:
> >  /**
> > + *	device_set_no_suspend_enable - Mark the device as used by userspace
> > + *	application
> > + */

This is not proper kernel-doc, please fix this up.

And "no_suspend_enable" is ackward, drop the "enable" part?


> > +void device_set_no_suspend_enable(struct device *dev, bool enable)
> > +{
> > +	struct device *next;
> > +
> > +	mutex_lock(&dpm_list_mtx);
> > +
> > +	/* the new status is equal the old one */
> > +	if (dev->power.no_suspend == !!enable)
> > +		goto out;
> > +
> > +	/* change the device status */
> > +	dev->power.no_suspend = !!enable;
> > +	if (dev->power.no_suspend)
> > +		dev->power.subtree_no_suspend = 0;
> >   
> I find a bug here, i will fix.
> It can be ok the rest of the code?
> > +
> > +	list_for_each_entry_reverse(next, &dev->power.entry, power.entry) {
> > +		/* 
> > +		 * exit if we find a node with the same parent of the start
> > +		 * device
> > +		 */
> > +		if (dev->parent && next->parent == dev->parent)
> > +			break;
> > +
> > +		if (next->parent) {
> > +			/* Propagate the status */
> > +			next->power.subtree_no_suspend =
> > +				device_no_suspend_enable(next->parent);
> > +		}
> > +	}
> > +out:
> > +	mutex_unlock(&dpm_list_mtx);
> > +	return;
> > +}
> > +EXPORT_SYMBOL_GPL(device_set_no_suspend_enable);
> > +
> > +/**
> >   *	device_pm_add - add a device to the list of active devices
> >   *	@dev:	Device to be added to the list
> >   */
> > @@ -78,6 +117,11 @@ void device_pm_add(struct device *dev)
> >  		if (dev->parent->power.status >= DPM_SUSPENDING)
> >  			dev_warn(dev, "parent %s should not be sleeping\n",
> >  				 dev_name(dev->parent));
> > +		if (device_no_suspend_enable(dev->parent)) {
> > +			/* if the parent has suspend disable, propagate it
> > +			 * to the new child */
> > +			dev->power.subtree_no_suspend = 1;
> > +		}
> >  	} else if (transition_started) {
> >  		/*
> >  		 * We refuse to register parentless devices while a PM
> > @@ -87,7 +131,15 @@ void device_pm_add(struct device *dev)
> >  		dev_WARN(dev, "Parentless device registered during a PM transaction\n");
> >  	}
> >  
> > -	list_add_tail(&dev->power.entry, &dpm_list);
> > +	if (dev->parent) {
> > +		/*
> > +		 * if the device has a parent insert just before it.
> > +		 */
> > +		list_add_tail(&dev->power.entry, &(dev->parent)->power.entry);
> > +	}
> > +	else
> > +		list_add_tail(&dev->power.entry, &dpm_list);
> > +

Why are you changing the ordering for when we add devices to the list?
This seems like you are adding stuff now in backwards order, why make
this change?

confused,

greg k-h

  reply	other threads:[~2009-04-24 22:55 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-24 17:24 [RFC Add no_suspend attribute V2] Let the driver know if it's in use Michael Trimarchi
2009-04-24 17:31 ` Randy Dunlap
2009-04-24 17:36   ` Michael Trimarchi
2009-04-24 17:55 ` Michael Trimarchi
2009-04-24 22:55   ` Greg KH [this message]
2009-04-25  8:21     ` Michael Trimarchi
2009-04-25  9:07     ` Michael Trimarchi
2009-04-25 10:56       ` Rafael J. Wysocki
2009-04-25 12:03         ` Michael Trimarchi
2009-04-25 16:57           ` Alan Stern
2009-04-25 17:11             ` Michael Trimarchi
2009-04-25 18:33               ` Alan Stern
2009-04-30 23:42                 ` Michael Trimarchi
2009-05-01  2:27                   ` Alan Stern
2009-07-23 14:09             ` Michael Trimarchi
2009-07-23 14:32               ` Rafael J. Wysocki
2009-07-23 14:56                 ` Alan Stern
2009-07-23 16:00                   ` Michael Trimarchi
2009-07-24 15:36                     ` 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=20090424225501.GC3343@kroah.com \
    --to=greg@kroah.com \
    --cc=len.brown@intel.com \
    --cc=linux-pm@lists.linux-foundation.org \
    --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