diff options
author | Aaron Lu <aaron.lu@intel.com> | 2013-01-23 02:09:32 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2013-01-25 15:36:43 -0500 |
commit | 6f4c827e68a78731c6c75df69bf7b75b029ec70c (patch) | |
tree | 5113f12fc6fd5c7e2769aa19c2a1bb59ea647652 /drivers/ata/libata-zpodd.c | |
parent | 6c7f1e2f12f6f37ddda01180c9e5c407eccce616 (diff) |
[libata] scsi: no poll when ODD is powered off
When the ODD is powered off, any action the user did to the ODD that
would generate a media event will trigger an ACPI interrupt, so the
poll for media event is no longer necessary. And the poll will also
cause a runtime status change, which will stop the ODD from staying in
powered off state, so the poll should better be stopped.
But since we don't have access to the gendisk structure in LLDs, here
comes the disk_events_disable_depth for scsi device. This field is a
hint set by LLDs to convey information to upper layer drivers. A value
of 0 means media poll is necessary for the device, while values above 0
means media poll is not needed and should better be skipped. So we can
increase its value when we are to power off the ODD in ATA layer and
decrease its value when the ODD is powered on, effectively silence the
media events poll.
Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/libata-zpodd.c')
-rw-r--r-- | drivers/ata/libata-zpodd.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/ata/libata-zpodd.c b/drivers/ata/libata-zpodd.c index 540b0b7904fb..a7df60383532 100644 --- a/drivers/ata/libata-zpodd.c +++ b/drivers/ata/libata-zpodd.c | |||
@@ -178,11 +178,16 @@ bool zpodd_zpready(struct ata_device *dev) | |||
178 | * Enable runtime wake capability through ACPI and set the powered_off flag, | 178 | * Enable runtime wake capability through ACPI and set the powered_off flag, |
179 | * this flag will be used during resume to decide what operations are needed | 179 | * this flag will be used during resume to decide what operations are needed |
180 | * to take. | 180 | * to take. |
181 | * | ||
182 | * Also, media poll needs to be silenced, so that it doesn't bring the ODD | ||
183 | * back to full power state every few seconds. | ||
181 | */ | 184 | */ |
182 | void zpodd_enable_run_wake(struct ata_device *dev) | 185 | void zpodd_enable_run_wake(struct ata_device *dev) |
183 | { | 186 | { |
184 | struct zpodd *zpodd = dev->zpodd; | 187 | struct zpodd *zpodd = dev->zpodd; |
185 | 188 | ||
189 | sdev_disable_disk_events(dev->sdev); | ||
190 | |||
186 | zpodd->powered_off = true; | 191 | zpodd->powered_off = true; |
187 | device_set_run_wake(&dev->sdev->sdev_gendev, true); | 192 | device_set_run_wake(&dev->sdev->sdev_gendev, true); |
188 | acpi_pm_device_run_wake(&dev->sdev->sdev_gendev, true); | 193 | acpi_pm_device_run_wake(&dev->sdev->sdev_gendev, true); |
@@ -231,6 +236,8 @@ void zpodd_post_poweron(struct ata_device *dev) | |||
231 | 236 | ||
232 | zpodd->zp_sampled = false; | 237 | zpodd->zp_sampled = false; |
233 | zpodd->zp_ready = false; | 238 | zpodd->zp_ready = false; |
239 | |||
240 | sdev_enable_disk_events(dev->sdev); | ||
234 | } | 241 | } |
235 | 242 | ||
236 | static void zpodd_wake_dev(acpi_handle handle, u32 event, void *context) | 243 | static void zpodd_wake_dev(acpi_handle handle, u32 event, void *context) |