All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aaron Lu <aaron.lu@intel.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
	James Bottomley <James.Bottomley@HansenPartnership.com>,
	SCSI development list <linux-scsi@vger.kernel.org>,
	Linux-pm mailing list <linux-pm@vger.kernel.org>,
	Aaron Lu <aaron.lwe@gmail.com>
Subject: Re: [PATCH v2 4/5] pm: use callbacks from dev_pm_ops for scsi devices
Date: Fri, 12 Oct 2012 14:48:23 +0800	[thread overview]
Message-ID: <20121012064822.GB2165@mint-spring.sh.intel.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1210111051300.1170-100000@iolanthe.rowland.org>

On Thu, Oct 11, 2012 at 10:57:26AM -0400, Alan Stern wrote:
> I have a couple of small changes to suggest.  Nothing major.
> 
> On Thu, 11 Oct 2012, Aaron Lu wrote:
> 
> > @@ -102,26 +77,87 @@ static int scsi_bus_prepare(struct device *dev)
> >  
> >  static int scsi_bus_suspend(struct device *dev)
> >  {
> > -	return scsi_bus_suspend_common(dev, PMSG_SUSPEND);
> > +	int err = 0;
> > +	const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
> > +
> > +	if (scsi_is_sdev_device(dev)) {
> > +		/*
> > +		 * sd is the only high-level SCSI driver to implement runtime
> > +		 * PM, and sd treats runtime suspend, system suspend, and
> > +		 * system hibernate identically.
> > +		 */
> 
> It would be better if we don't refer to sd specifically.  The comment 
> could be changed to something like this:
> 
> 		/*
> 		 * All the high-level SCSI drivers that implement runtime PM
> 		 * treat runtime suspend, system suspend, and system
> 		 * hibernate identically.
> 		 */

OK, will do this.

> 
> >  static int scsi_bus_freeze(struct device *dev)
> >  {
> > -	return scsi_bus_suspend_common(dev, PMSG_FREEZE);
> > +	int err = 0;
> > +	const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
> > +
> > +	if (scsi_is_sdev_device(dev)) {
> > +		/* wake up device so that FREEZE will succeed */
> > +		if (pm_runtime_suspended(dev))
> > +			pm_runtime_resume(dev);
> 
> I'm not sure why this is here.  If none of the high-level drivers 
> implement FREEZE then it's not needed.

Agree.
I should have checked the git log to see why it is here.
>From the log, it doesn't seem to have a reason.
Thanks for pointing this out.

> 
> 
> >  static int scsi_bus_poweroff(struct device *dev)
> >  {
> > -	return scsi_bus_suspend_common(dev, PMSG_HIBERNATE);
> > +	int err = 0;
> > +	const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
> > +
> > +	if (scsi_is_sdev_device(dev)) {
> > +		/*
> > +		 * sd is the only high-level SCSI driver to implement runtime
> > +		 * PM, and sd treats runtime suspend, system suspend, and
> > +		 * system hibernate identically.
> > +		 */
> 
> Same change as above for this comment.

OK.

And thanks for reviewing.

-Aaron


  reply	other threads:[~2012-10-12  6:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-11  5:08 [PATCH v2 0/5] Migrate SCSI drivers to use dev_pm_ops Aaron Lu
2012-10-11  5:08 ` [PATCH v2 1/5] sd: put to stopped power state when runtime suspend Aaron Lu
2012-10-11 14:50   ` Alan Stern
2012-10-12  6:45     ` Aaron Lu
2012-10-11  5:08 ` [PATCH v2 2/5] Revert "[SCSI] scsi_pm: set device runtime state before parent suspended" Aaron Lu
2012-10-11  5:08 ` [PATCH v2 3/5] Revert "[SCSI] runtime resume parent for child's system-resume" Aaron Lu
2012-10-11  5:08 ` [PATCH v2 4/5] pm: use callbacks from dev_pm_ops for scsi devices Aaron Lu
2012-10-11 14:57   ` Alan Stern
2012-10-12  6:48     ` Aaron Lu [this message]
2012-10-11  5:08 ` [PATCH v2 5/5] sd: update sd to use the new pm callbacks Aaron Lu

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=20121012064822.GB2165@mint-spring.sh.intel.com \
    --to=aaron.lu@intel.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=aaron.lwe@gmail.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=rjw@sisk.pl \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.