aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-scsi.c
diff options
context:
space:
mode:
authorAaron Lu <aaron.lu@intel.com>2013-08-22 22:17:54 -0400
committerTejun Heo <tj@kernel.org>2013-08-23 12:09:23 -0400
commitf1bc1e4c44b1b78fe34431936c60759b5aad5e3f (patch)
tree8412ab2e71faa0e8d55be7a4565090af6669d4fa /drivers/ata/libata-scsi.c
parent2b79c56fb41d3956f672990fe83e342a809c89ab (diff)
ata: acpi: rework the ata acpi bind support
Binding ACPI handle to SCSI device has several drawbacks, namely: 1 During ATA device initialization time, ACPI handle will be needed while SCSI devices are not created yet. So each time ACPI handle is needed, instead of retrieving the handle by ACPI_HANDLE macro, a namespace scan is performed to find the handle for the corresponding ATA device. This is inefficient, and also expose a restriction on calling path not holding any lock. 2 The binding to SCSI device tree makes code complex, while at the same time doesn't bring us any benefit. All ACPI handlings are still done in ATA module, not in SCSI. Rework the ATA ACPI binding code to bind ACPI handle to ATA transport devices(ATA port and ATA device). The binding needs to be done only once, since the ATA transport devices do not go away with hotplug. And due to this, the flush_work call in hotplug handler for ATA bay is no longer needed. Tested on an Intel test platform for binding and runtime power off for ODD(ZPODD) and hard disk; on an ASUS S400C for binding and normal boot and S3, where its SATA port node has _SDD and _GTF control methods when configured as an AHCI controller and its PATA device node has _GTF control method when configured as an IDE controller. SATA PMP binding and ATA hotplug is not tested. Signed-off-by: Aaron Lu <aaron.lu@intel.com> Tested-by: Dirk Griesbach <spamthis@freenet.de> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/ata/libata-scsi.c')
-rw-r--r--drivers/ata/libata-scsi.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 83c08907e042..f177ad6bfd09 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -49,7 +49,6 @@
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>
53#include <asm/unaligned.h> 52#include <asm/unaligned.h>
54 53
55#include "libata.h" 54#include "libata.h"
@@ -3665,9 +3664,7 @@ void ata_scsi_scan_host(struct ata_port *ap, int sync)
3665 if (!IS_ERR(sdev)) { 3664 if (!IS_ERR(sdev)) {
3666 dev->sdev = sdev; 3665 dev->sdev = sdev;
3667 scsi_device_put(sdev); 3666 scsi_device_put(sdev);
3668 if (zpodd_dev_enabled(dev)) 3667 ata_scsi_acpi_bind(dev);
3669 dev_pm_qos_expose_flags(
3670 &sdev->sdev_gendev, 0);
3671 } else { 3668 } else {
3672 dev->sdev = NULL; 3669 dev->sdev = NULL;
3673 } 3670 }
@@ -3755,6 +3752,8 @@ static void ata_scsi_remove_dev(struct ata_device *dev)
3755 struct scsi_device *sdev; 3752 struct scsi_device *sdev;
3756 unsigned long flags; 3753 unsigned long flags;
3757 3754
3755 ata_scsi_acpi_unbind(dev);
3756
3758 /* Alas, we need to grab scan_mutex to ensure SCSI device 3757 /* Alas, we need to grab scan_mutex to ensure SCSI device
3759 * state doesn't change underneath us and thus 3758 * state doesn't change underneath us and thus
3760 * scsi_device_get() always succeeds. The mutex locking can 3759 * scsi_device_get() always succeeds. The mutex locking can
@@ -3764,9 +3763,6 @@ static void ata_scsi_remove_dev(struct ata_device *dev)
3764 mutex_lock(&ap->scsi_host->scan_mutex); 3763 mutex_lock(&ap->scsi_host->scan_mutex);
3765 spin_lock_irqsave(ap->lock, flags); 3764 spin_lock_irqsave(ap->lock, flags);
3766 3765
3767 if (zpodd_dev_enabled(dev))
3768 zpodd_exit(dev);
3769
3770 /* clearing dev->sdev is protected by host lock */ 3766 /* clearing dev->sdev is protected by host lock */
3771 sdev = dev->sdev; 3767 sdev = dev->sdev;
3772 dev->sdev = NULL; 3768 dev->sdev = NULL;
@@ -3816,6 +3812,9 @@ static void ata_scsi_handle_link_detach(struct ata_link *link)
3816 dev->flags &= ~ATA_DFLAG_DETACHED; 3812 dev->flags &= ~ATA_DFLAG_DETACHED;
3817 spin_unlock_irqrestore(ap->lock, flags); 3813 spin_unlock_irqrestore(ap->lock, flags);
3818 3814
3815 if (zpodd_dev_enabled(dev))
3816 zpodd_exit(dev);
3817
3819 ata_scsi_remove_dev(dev); 3818 ata_scsi_remove_dev(dev);
3820 } 3819 }
3821} 3820}