All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Alan Stern <stern@rowland.harvard.edu>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Linux PCI <linux-pci@vger.kernel.org>,
	pm list <linux-pm@lists.linux-foundation.org>,
	linux-usb@vger.kernel.org, Greg KH <gregkh@suse.de>,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	James Bottomley <James.Bottomley@suse.de>,
	Linux SCSI <linux-scsi@vger.kernel.org>,
	Arjan van de Ven <arjan@infradead.org>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	Len Brown <lenb@kernel.org>,
	Nigel Cunningham <ncunningham@crca.org.au>
Subject: [PATCH 8/8] PM: Allow SCSI devices to suspend/resume asynchronously
Date: Sun, 24 Jan 2010 00:41:30 +0100	[thread overview]
Message-ID: <201001240041.30899.rjw@sisk.pl> (raw)
In-Reply-To: <201001240033.34253.rjw@sisk.pl>

From: Rafael J. Wysocki <rjw@sisk.pl>

Set power.async_suspend for all SCSI devices, targets and hosts, so
that they can be suspended and resumed in parallel with the main
suspend/resume thread and possibly with other devices they don't
depend on in a known way (i.e. devices which are not their parents or
children).

The power.async_suspend flag is also set for devices that don't have
suspend or resume callbacks, because otherwise they would make the
main suspend/resume thread wait for their "asynchronous" children
(during suspend) or parents (during resume), effectively negating the
possible gains from executing these devices' suspend and resume
callbacks asynchronously.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/scsi/hosts.c      |    4 ++++
 drivers/scsi/scsi_sysfs.c |    4 ++++
 2 files changed, 8 insertions(+)

Index: linux-2.6/drivers/scsi/hosts.c
===================================================================
--- linux-2.6.orig/drivers/scsi/hosts.c
+++ linux-2.6/drivers/scsi/hosts.c
@@ -215,6 +215,8 @@ int scsi_add_host_with_dma(struct Scsi_H
 		shost->shost_gendev.parent = dev ? dev : &platform_bus;
 	shost->dma_dev = dma_dev;
 
+	device_enable_async_suspend(&shost->shost_gendev);
+
 	error = device_add(&shost->shost_gendev);
 	if (error)
 		goto out;
@@ -222,6 +224,8 @@ int scsi_add_host_with_dma(struct Scsi_H
 	scsi_host_set_state(shost, SHOST_RUNNING);
 	get_device(shost->shost_gendev.parent);
 
+	device_enable_async_suspend(&shost->shost_dev);
+
 	error = device_add(&shost->shost_dev);
 	if (error)
 		goto out_del_gendev;
Index: linux-2.6/drivers/scsi/scsi_sysfs.c
===================================================================
--- linux-2.6.orig/drivers/scsi/scsi_sysfs.c
+++ linux-2.6/drivers/scsi/scsi_sysfs.c
@@ -847,6 +847,8 @@ static int scsi_target_add(struct scsi_t
 	if (starget->state != STARGET_CREATED)
 		return 0;
 
+	device_enable_async_suspend(&starget->dev);
+
 	error = device_add(&starget->dev);
 	if (error) {
 		dev_err(&starget->dev, "target device_add failed, error %d\n", error);
@@ -886,11 +888,13 @@ int scsi_sysfs_add_sdev(struct scsi_devi
 		return error;
 
 	transport_configure_device(&starget->dev);
+	device_enable_async_suspend(&sdev->sdev_gendev);
 	error = device_add(&sdev->sdev_gendev);
 	if (error) {
 		printk(KERN_INFO "error 1\n");
 		goto out_remove;
 	}
+	device_enable_async_suspend(&sdev->sdev_dev);
 	error = device_add(&sdev->sdev_dev);
 	if (error) {
 		printk(KERN_INFO "error 2\n");


      parent reply	other threads:[~2010-01-23 23:42 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-23 23:33 [PATCH 0/8] PM: Asynchronous suspen and resume Rafael J. Wysocki
2010-01-23 23:34 ` [PATCH 1/8] PM: Add parent information to timing messages Rafael J. Wysocki
2010-01-23 23:34   ` Rafael J. Wysocki
2010-02-25  7:01   ` Pavel Machek
2010-02-25  7:01   ` Pavel Machek
2010-01-23 23:35 ` [PATCH 2/8] PM: Asynchronous suspend and resume of devices Rafael J. Wysocki
2010-01-24 16:37   ` Alan Stern
2010-01-24 16:37   ` Alan Stern
2010-01-24 16:37     ` Alan Stern
2010-01-24 20:09     ` Rafael J. Wysocki
2010-01-24 22:30       ` Alan Stern
2010-01-24 23:27         ` Rafael J. Wysocki
2010-01-25  3:12           ` Alan Stern
2010-01-25  3:12           ` Alan Stern
2010-01-25 21:26             ` Rafael J. Wysocki
2010-01-25 22:04               ` Alan Stern
2010-01-25 22:04               ` Alan Stern
2010-02-01 21:00               ` [PATCH] USB: implement non-tree resume ordering constraints for PCI host controllers Alan Stern
2010-01-25 21:26             ` [PATCH 2/8] PM: Asynchronous suspend and resume of devices Rafael J. Wysocki
2010-01-24 23:27         ` Rafael J. Wysocki
2010-01-24 22:30       ` Alan Stern
2010-01-24 20:09     ` Rafael J. Wysocki
2010-01-23 23:35 ` Rafael J. Wysocki
2010-01-23 23:36 ` [PATCH 3/8] PM: Add a switch for disabling/enabling asynchronous suspend/resume Rafael J. Wysocki
2010-01-23 23:36 ` Rafael J. Wysocki
2010-01-23 23:38 ` [PATCH 4/8] PM: Add facility for advanced testing of async suspend/resume Rafael J. Wysocki
2010-01-23 23:38 ` Rafael J. Wysocki
2010-01-23 23:38 ` [PATCH 5/8] PM: Start asynchronous resume threads upfront Rafael J. Wysocki
2010-01-23 23:38 ` Rafael J. Wysocki
2010-01-23 23:39 ` [PATCH 6/8] PM: Allow PCI devices to suspend/resume asynchronously Rafael J. Wysocki
2010-01-23 23:39 ` Rafael J. Wysocki
2010-01-23 23:40 ` [PATCH 7/8] PM: Allow USB " Rafael J. Wysocki
2010-01-23 23:40 ` Rafael J. Wysocki
2010-01-23 23:41 ` [PATCH 8/8] PM: Allow SCSI " Rafael J. Wysocki
2010-01-23 23:41 ` 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=201001240041.30899.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=James.Bottomley@suse.de \
    --cc=arjan@infradead.org \
    --cc=gregkh@suse.de \
    --cc=jbarnes@virtuousgeek.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=ncunningham@crca.org.au \
    --cc=stern@rowland.harvard.edu \
    --cc=torvalds@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 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.