aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAaron Lu <aaron.lu@intel.com>2013-03-04 23:12:04 -0500
committerJeff Garzik <jgarzik@redhat.com>2013-04-03 19:55:32 -0400
commit7381fe73749bc3c1f914b3389891d7d22be7e0f1 (patch)
tree4e6f36310234eea10b989bc51c76959e4917c198 /drivers
parentb1a72d600a5acb93c1831865d72a6a90bfd7bcbf (diff)
libata-acpi: remove redundent code for power resource handling
With commit: bc9b6407bd6df3ab7189e5622816bbc11ae9d2d8 ACPI / PM: Rework the handling of devices depending on power resources The ACPI core now takes care of the power resources an acpi device depends on in that when the power resources are turned on, any devices that are bound to or in the dependent list of this acpi device will be runtime resumed. So there is no need for ata acpi code to duplicate this effort, and thus, the ata_acpi_(un)register_power_resource functions are no longer needed. The above commit thinks the scsi device is not bound to the acpi device, so needs to be added to the dependent list. But actually, it is. So there is no need to add it to the dependent list, or it will be runtime resumed twice(though this wouldn't cause any problem). This patch fixes it, and as a result, the ata_acpi_(un)register_power_resource and ata_acpi_(un)bind functions are removed. Signed-off-by: Aaron Lu <aaron.lu@intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/libata-acpi.c33
-rw-r--r--drivers/ata/libata-scsi.c6
2 files changed, 4 insertions, 35 deletions
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index 8a52dab412e2..1c33f78040c6 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
@@ -17,7 +17,6 @@
17#include <linux/pci.h> 17#include <linux/pci.h>
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/pm_runtime.h> 19#include <linux/pm_runtime.h>
20#include <linux/pm_qos.h>
21#include <scsi/scsi_device.h> 20#include <scsi/scsi_device.h>
22#include "libata.h" 21#include "libata.h"
23 22
@@ -1020,38 +1019,6 @@ void ata_acpi_on_disable(struct ata_device *dev)
1020 ata_acpi_clear_gtf(dev); 1019 ata_acpi_clear_gtf(dev);
1021} 1020}
1022 1021
1023static void ata_acpi_register_power_resource(struct ata_device *dev)
1024{
1025 struct scsi_device *sdev = dev->sdev;
1026 acpi_handle handle;
1027
1028 handle = ata_dev_acpi_handle(dev);
1029 if (handle)
1030 acpi_dev_pm_add_dependent(handle, &sdev->sdev_gendev);
1031}
1032
1033static void ata_acpi_unregister_power_resource(struct ata_device *dev)
1034{
1035 struct scsi_device *sdev = dev->sdev;
1036 acpi_handle handle;
1037
1038 handle = ata_dev_acpi_handle(dev);
1039 if (handle)
1040 acpi_dev_pm_remove_dependent(handle, &sdev->sdev_gendev);
1041}
1042
1043void ata_acpi_bind(struct ata_device *dev)
1044{
1045 ata_acpi_register_power_resource(dev);
1046 if (zpodd_dev_enabled(dev))
1047 dev_pm_qos_expose_flags(&dev->sdev->sdev_gendev, 0);
1048}
1049
1050void ata_acpi_unbind(struct ata_device *dev)
1051{
1052 ata_acpi_unregister_power_resource(dev);
1053}
1054
1055static int compat_pci_ata(struct ata_port *ap) 1022static int compat_pci_ata(struct ata_port *ap)
1056{ 1023{
1057 struct device *dev = ap->tdev.parent; 1024 struct device *dev = ap->tdev.parent;
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index ff44787e5a45..fe759cafc67a 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -49,6 +49,7 @@
49#include <linux/hdreg.h> 49#include <linux/hdreg.h>
50#include <linux/uaccess.h> 50#include <linux/uaccess.h>
51#include <linux/suspend.h> 51#include <linux/suspend.h>
52#include <linux/pm_qos.h>
52#include <asm/unaligned.h> 53#include <asm/unaligned.h>
53 54
54#include "libata.h" 55#include "libata.h"
@@ -3668,7 +3669,9 @@ void ata_scsi_scan_host(struct ata_port *ap, int sync)
3668 if (!IS_ERR(sdev)) { 3669 if (!IS_ERR(sdev)) {
3669 dev->sdev = sdev; 3670 dev->sdev = sdev;
3670 scsi_device_put(sdev); 3671 scsi_device_put(sdev);
3671 ata_acpi_bind(dev); 3672 if (zpodd_dev_enabled(dev))
3673 dev_pm_qos_expose_flags(
3674 &sdev->sdev_gendev, 0);
3672 } else { 3675 } else {
3673 dev->sdev = NULL; 3676 dev->sdev = NULL;
3674 } 3677 }
@@ -3767,7 +3770,6 @@ static void ata_scsi_remove_dev(struct ata_device *dev)
3767 3770
3768 if (zpodd_dev_enabled(dev)) 3771 if (zpodd_dev_enabled(dev))
3769 zpodd_exit(dev); 3772 zpodd_exit(dev);
3770 ata_acpi_unbind(dev);
3771 3773
3772 /* clearing dev->sdev is protected by host lock */ 3774 /* clearing dev->sdev is protected by host lock */
3773 sdev = dev->sdev; 3775 sdev = dev->sdev;