aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNigel Cunningham <ncunningham@cyclades.com>2006-03-23 08:22:16 -0500
committerJeff Garzik <jeff@garzik.org>2006-03-24 09:51:36 -0500
commit082776e4be791736c32baf818e50f501a7f83819 (patch)
tree508fe750353ccd8f6a77cf2c882c15ab20a1e63e
parent83206a2903fd2ddb1761d906b2b3b3de17ef87f1 (diff)
[PATCH] Make libata not powerdown drivers on PM_EVENT_FREEZE.
At the moment libata doesn't pass pm_message_t down ata_device_suspend. This causes drives to be powered down when we just want a freeze, causing unnecessary wear and tear. This patch gets pm_message_t passed down so that it can be used to determine whether to power down the drive. Signed-off-by: Nigel Cunningham <nigel@suspend2.net> drivers/scsi/libata-core.c | 5 +++-- drivers/scsi/libata-scsi.c | 4 ++-- drivers/scsi/scsi_sysfs.c | 2 +- include/linux/libata.h | 4 ++-- include/scsi/scsi_host.h | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--drivers/scsi/libata-core.c5
-rw-r--r--drivers/scsi/libata-scsi.c4
-rw-r--r--drivers/scsi/scsi_sysfs.c2
-rw-r--r--include/linux/libata.h4
-rw-r--r--include/scsi/scsi_host.h2
5 files changed, 9 insertions, 8 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 6970f6867334..d8f77f2a5af1 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -4336,14 +4336,15 @@ int ata_device_resume(struct ata_port *ap, struct ata_device *dev)
4336 * Flush the cache on the drive, if appropriate, then issue a 4336 * Flush the cache on the drive, if appropriate, then issue a
4337 * standbynow command. 4337 * standbynow command.
4338 */ 4338 */
4339int ata_device_suspend(struct ata_port *ap, struct ata_device *dev) 4339int ata_device_suspend(struct ata_port *ap, struct ata_device *dev, pm_message_t state)
4340{ 4340{
4341 if (!ata_dev_present(dev)) 4341 if (!ata_dev_present(dev))
4342 return 0; 4342 return 0;
4343 if (dev->class == ATA_DEV_ATA) 4343 if (dev->class == ATA_DEV_ATA)
4344 ata_flush_cache(ap, dev); 4344 ata_flush_cache(ap, dev);
4345 4345
4346 ata_standby_drive(ap, dev); 4346 if (state.event != PM_EVENT_FREEZE)
4347 ata_standby_drive(ap, dev);
4347 ap->flags |= ATA_FLAG_SUSPENDED; 4348 ap->flags |= ATA_FLAG_SUSPENDED;
4348 return 0; 4349 return 0;
4349} 4350}
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index a1259b242b8e..1fd3826da97e 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -414,12 +414,12 @@ int ata_scsi_device_resume(struct scsi_device *sdev)
414 return ata_device_resume(ap, dev); 414 return ata_device_resume(ap, dev);
415} 415}
416 416
417int ata_scsi_device_suspend(struct scsi_device *sdev) 417int ata_scsi_device_suspend(struct scsi_device *sdev, pm_message_t state)
418{ 418{
419 struct ata_port *ap = (struct ata_port *) &sdev->host->hostdata[0]; 419 struct ata_port *ap = (struct ata_port *) &sdev->host->hostdata[0];
420 struct ata_device *dev = &ap->device[sdev->id]; 420 struct ata_device *dev = &ap->device[sdev->id];
421 421
422 return ata_device_suspend(ap, dev); 422 return ata_device_suspend(ap, dev, state);
423} 423}
424 424
425/** 425/**
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 89055494dfee..a6fde52946d6 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -286,7 +286,7 @@ static int scsi_bus_suspend(struct device * dev, pm_message_t state)
286 return err; 286 return err;
287 287
288 if (sht->suspend) 288 if (sht->suspend)
289 err = sht->suspend(sdev); 289 err = sht->suspend(sdev, state);
290 290
291 return err; 291 return err;
292} 292}
diff --git a/include/linux/libata.h b/include/linux/libata.h
index fbe8ba212598..c52f13498556 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -520,9 +520,9 @@ extern void ata_eh_qc_retry(struct ata_queued_cmd *qc);
520extern int ata_scsi_release(struct Scsi_Host *host); 520extern int ata_scsi_release(struct Scsi_Host *host);
521extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); 521extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc);
522extern int ata_scsi_device_resume(struct scsi_device *); 522extern int ata_scsi_device_resume(struct scsi_device *);
523extern int ata_scsi_device_suspend(struct scsi_device *); 523extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t state);
524extern int ata_device_resume(struct ata_port *, struct ata_device *); 524extern int ata_device_resume(struct ata_port *, struct ata_device *);
525extern int ata_device_suspend(struct ata_port *, struct ata_device *); 525extern int ata_device_suspend(struct ata_port *, struct ata_device *, pm_message_t state);
526extern int ata_ratelimit(void); 526extern int ata_ratelimit(void);
527extern unsigned int ata_busy_sleep(struct ata_port *ap, 527extern unsigned int ata_busy_sleep(struct ata_port *ap,
528 unsigned long timeout_pat, 528 unsigned long timeout_pat,
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index a6cf3e535c0b..dc6862d09e53 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -286,7 +286,7 @@ struct scsi_host_template {
286 * suspend support 286 * suspend support
287 */ 287 */
288 int (*resume)(struct scsi_device *); 288 int (*resume)(struct scsi_device *);
289 int (*suspend)(struct scsi_device *); 289 int (*suspend)(struct scsi_device *, pm_message_t state);
290 290
291 /* 291 /*
292 * Name of proc directory 292 * Name of proc directory