diff options
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r-- | drivers/scsi/sd.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index f071b9edaf36..448d316f12d7 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -1789,7 +1789,7 @@ static void sd_shutdown(struct device *dev) | |||
1789 | static int sd_suspend(struct device *dev, pm_message_t mesg) | 1789 | static int sd_suspend(struct device *dev, pm_message_t mesg) |
1790 | { | 1790 | { |
1791 | struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); | 1791 | struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); |
1792 | int ret; | 1792 | int ret = 0; |
1793 | 1793 | ||
1794 | if (!sdkp) | 1794 | if (!sdkp) |
1795 | return 0; /* this can happen */ | 1795 | return 0; /* this can happen */ |
@@ -1798,30 +1798,34 @@ static int sd_suspend(struct device *dev, pm_message_t mesg) | |||
1798 | sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n"); | 1798 | sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n"); |
1799 | ret = sd_sync_cache(sdkp); | 1799 | ret = sd_sync_cache(sdkp); |
1800 | if (ret) | 1800 | if (ret) |
1801 | return ret; | 1801 | goto done; |
1802 | } | 1802 | } |
1803 | 1803 | ||
1804 | if (mesg.event == PM_EVENT_SUSPEND && | 1804 | if (mesg.event == PM_EVENT_SUSPEND && |
1805 | sdkp->device->manage_start_stop) { | 1805 | sdkp->device->manage_start_stop) { |
1806 | sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n"); | 1806 | sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n"); |
1807 | ret = sd_start_stop_device(sdkp, 0); | 1807 | ret = sd_start_stop_device(sdkp, 0); |
1808 | if (ret) | ||
1809 | return ret; | ||
1810 | } | 1808 | } |
1811 | 1809 | ||
1812 | return 0; | 1810 | done: |
1811 | scsi_disk_put(sdkp); | ||
1812 | return ret; | ||
1813 | } | 1813 | } |
1814 | 1814 | ||
1815 | static int sd_resume(struct device *dev) | 1815 | static int sd_resume(struct device *dev) |
1816 | { | 1816 | { |
1817 | struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); | 1817 | struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); |
1818 | int ret = 0; | ||
1818 | 1819 | ||
1819 | if (!sdkp->device->manage_start_stop) | 1820 | if (!sdkp->device->manage_start_stop) |
1820 | return 0; | 1821 | goto done; |
1821 | 1822 | ||
1822 | sd_printk(KERN_NOTICE, sdkp, "Starting disk\n"); | 1823 | sd_printk(KERN_NOTICE, sdkp, "Starting disk\n"); |
1824 | ret = sd_start_stop_device(sdkp, 1); | ||
1823 | 1825 | ||
1824 | return sd_start_stop_device(sdkp, 1); | 1826 | done: |
1827 | scsi_disk_put(sdkp); | ||
1828 | return ret; | ||
1825 | } | 1829 | } |
1826 | 1830 | ||
1827 | /** | 1831 | /** |