Re: [PATCH] libata: device suspend/resume

Jeff Garzik
2005-05-27T02:54:04Z

James Bottomley wrote:
> +/* Just quietly quiesce the device and SYNCHRONIZE CACHE for suspend too */
> +static int sd_suspend(struct device *dev, pm_message_t state, u32 level)
> +{
> + struct scsi_device *sdp = to_scsi_device(dev);
> + struct scsi_disk *sdkp = dev_get_drvdata(dev);
> +
> + if (!sdkp)
> + return 0; /* this can happen */
> +
> + if (!sdkp->WCE)
> + return 0;
> +
> + /* don't try to sync an offline device ... it will only error */
> + if (!scsi_device_online(sdp))
> + return 0;
> +
> + if (sd_sync_cache(sdp))
> + return -EIO;

Add

if (I_can_PM_this_disk && sd_start_stop_unit(sdp))
return -EIO;

and libata is happy.

Jeff