From patchwork Wed Sep 12 08:29:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [v7,5/6] scsi: sr: use may_power_off From: Aaron Lu X-Patchwork-Id: 183283 Message-Id: <1347438597-5903-6-git-send-email-aaron.lu@intel.com> To: Alan Stern , Oliver Neukum , James Bottomley , Jeff Garzik Cc: linux-scsi@vger.kernel.org, linux-ide@vger.kernel.org, linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org, Aaron Lu , Aaron Lu Date: Wed, 12 Sep 2012 16:29:56 +0800 If may_power_off is 0, we do not check if it is ready to be powered off in its suspend callback. Signed-off-by: Aaron Lu --- drivers/scsi/sr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index ef72682..4c1a182 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -181,7 +181,7 @@ static int sr_suspend(struct device *dev, pm_message_t msg) struct scsi_sense_hdr sshdr; struct scsi_cd *cd = dev_get_drvdata(dev); - if (!cd->device->can_power_off) + if (!cd->device->may_power_off) return 0; /* See if we can power off this ZPODD device */ @@ -786,6 +786,10 @@ static int sr_probe(struct device *dev) sdev_printk(KERN_DEBUG, sdev, "Attached scsi CD-ROM %s\n", cd->cdi.name); + /* By default, we allow power off of ZPODD */ + if (cd->device->can_power_off) + cd->device->may_power_off = 1; + /* enable runtime pm */ scsi_autopm_put_device(cd->device);