Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 57031
b: refs/heads/master
c: 09ff92f
h: refs/heads/master
i:
  57029: b063f75
  57027: 8a50317
  57023: eb47503
v: v3
  • Loading branch information
Alan Stern authored and James Bottomley committed May 22, 2007
1 parent f990903 commit 0f3bd22
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cab537d609fb718e9fb09d73e3e3e3062db25743
refs/heads/master: 09ff92fea2890c697a36d8b26f5a3ea725ef8fb4
18 changes: 11 additions & 7 deletions trunk/drivers/scsi/sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1789,7 +1789,7 @@ static void sd_shutdown(struct device *dev)
static int sd_suspend(struct device *dev, pm_message_t mesg)
{
struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev);
int ret;
int ret = 0;

if (!sdkp)
return 0; /* this can happen */
Expand All @@ -1798,30 +1798,34 @@ static int sd_suspend(struct device *dev, pm_message_t mesg)
sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n");
ret = sd_sync_cache(sdkp);
if (ret)
return ret;
goto done;
}

if (mesg.event == PM_EVENT_SUSPEND &&
sdkp->device->manage_start_stop) {
sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n");
ret = sd_start_stop_device(sdkp, 0);
if (ret)
return ret;
}

return 0;
done:
scsi_disk_put(sdkp);
return ret;
}

static int sd_resume(struct device *dev)
{
struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev);
int ret = 0;

if (!sdkp->device->manage_start_stop)
return 0;
goto done;

sd_printk(KERN_NOTICE, sdkp, "Starting disk\n");
ret = sd_start_stop_device(sdkp, 1);

return sd_start_stop_device(sdkp, 1);
done:
scsi_disk_put(sdkp);
return ret;
}

/**
Expand Down

0 comments on commit 0f3bd22

Please sign in to comment.