diff options
author | Tejun Heo <htejun@gmail.com> | 2007-12-15 01:05:01 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-12-17 20:33:12 -0500 |
commit | 562f0c2d771ee7be6b37fe015f94a929f8056120 (patch) | |
tree | 17d1616b39894564f70255bd68eec5c19ebf0473 | |
parent | 7f9ad9b8b96855f529f4fe9db0bf32cd3f14c01b (diff) |
libata-acpi: add new hooks ata_acpi_dissociate() and ata_acpi_on_disable()
Add two hooks - ata_acpi_dissociate() which is called during driver
detach after the whole host is shutdown and ata_acpi_on_disable()
which is called when a device is disabled.
Signed-off-by: Tejun heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r-- | drivers/ata/libata-acpi.c | 28 | ||||
-rw-r--r-- | drivers/ata/libata-core.c | 4 | ||||
-rw-r--r-- | drivers/ata/libata.h | 8 |
3 files changed, 38 insertions, 2 deletions
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index 8ae36ad029c5..9e5fc5d75b2e 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
@@ -188,6 +188,21 @@ void ata_acpi_associate(struct ata_host *host) | |||
188 | } | 188 | } |
189 | 189 | ||
190 | /** | 190 | /** |
191 | * ata_acpi_dissociate - dissociate ATA host from ACPI objects | ||
192 | * @host: target ATA host | ||
193 | * | ||
194 | * This function is called during driver detach after the whole host | ||
195 | * is shut down. | ||
196 | * | ||
197 | * LOCKING: | ||
198 | * EH context. | ||
199 | */ | ||
200 | void ata_acpi_dissociate(struct ata_host *host) | ||
201 | { | ||
202 | /* nada */ | ||
203 | } | ||
204 | |||
205 | /** | ||
191 | * ata_acpi_gtm - execute _GTM | 206 | * ata_acpi_gtm - execute _GTM |
192 | * @ap: target ATA port | 207 | * @ap: target ATA port |
193 | * @gtm: out parameter for _GTM result | 208 | * @gtm: out parameter for _GTM result |
@@ -716,3 +731,16 @@ int ata_acpi_on_devcfg(struct ata_device *dev) | |||
716 | dev->flags |= ATA_DFLAG_ACPI_FAILED; | 731 | dev->flags |= ATA_DFLAG_ACPI_FAILED; |
717 | return rc; | 732 | return rc; |
718 | } | 733 | } |
734 | |||
735 | /** | ||
736 | * ata_acpi_on_disable - ATA ACPI hook called when a device is disabled | ||
737 | * @dev: target ATA device | ||
738 | * | ||
739 | * This function is called when @dev is about to be disabled. | ||
740 | * | ||
741 | * LOCKING: | ||
742 | * EH context. | ||
743 | */ | ||
744 | void ata_acpi_on_disable(struct ata_device *dev) | ||
745 | { | ||
746 | } | ||
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index c316eacbeddd..4af939a00e54 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -622,6 +622,7 @@ void ata_dev_disable(struct ata_device *dev) | |||
622 | if (ata_dev_enabled(dev)) { | 622 | if (ata_dev_enabled(dev)) { |
623 | if (ata_msg_drv(dev->link->ap)) | 623 | if (ata_msg_drv(dev->link->ap)) |
624 | ata_dev_printk(dev, KERN_WARNING, "disabled\n"); | 624 | ata_dev_printk(dev, KERN_WARNING, "disabled\n"); |
625 | ata_acpi_on_disable(dev); | ||
625 | ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO0 | | 626 | ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO0 | |
626 | ATA_DNXFER_QUIET); | 627 | ATA_DNXFER_QUIET); |
627 | dev->class++; | 628 | dev->class++; |
@@ -7249,6 +7250,9 @@ void ata_host_detach(struct ata_host *host) | |||
7249 | 7250 | ||
7250 | for (i = 0; i < host->n_ports; i++) | 7251 | for (i = 0; i < host->n_ports; i++) |
7251 | ata_port_detach(host->ports[i]); | 7252 | ata_port_detach(host->ports[i]); |
7253 | |||
7254 | /* the host is dead now, dissociate ACPI */ | ||
7255 | ata_acpi_dissociate(host); | ||
7252 | } | 7256 | } |
7253 | 7257 | ||
7254 | /** | 7258 | /** |
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index 0e6cf3a484dc..bbe59c2fd1e2 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h | |||
@@ -108,15 +108,19 @@ extern void ata_lpm_schedule(struct ata_port *ap, enum link_pm); | |||
108 | #ifdef CONFIG_ATA_ACPI | 108 | #ifdef CONFIG_ATA_ACPI |
109 | extern void ata_acpi_associate_sata_port(struct ata_port *ap); | 109 | extern void ata_acpi_associate_sata_port(struct ata_port *ap); |
110 | extern void ata_acpi_associate(struct ata_host *host); | 110 | extern void ata_acpi_associate(struct ata_host *host); |
111 | extern void ata_acpi_dissociate(struct ata_host *host); | ||
111 | extern int ata_acpi_on_suspend(struct ata_port *ap); | 112 | extern int ata_acpi_on_suspend(struct ata_port *ap); |
112 | extern void ata_acpi_on_resume(struct ata_port *ap); | 113 | extern void ata_acpi_on_resume(struct ata_port *ap); |
113 | extern int ata_acpi_on_devcfg(struct ata_device *adev); | 114 | extern int ata_acpi_on_devcfg(struct ata_device *dev); |
115 | extern void ata_acpi_on_disable(struct ata_device *dev); | ||
114 | #else | 116 | #else |
115 | static inline void ata_acpi_associate_sata_port(struct ata_port *ap) { } | 117 | static inline void ata_acpi_associate_sata_port(struct ata_port *ap) { } |
116 | static inline void ata_acpi_associate(struct ata_host *host) { } | 118 | static inline void ata_acpi_associate(struct ata_host *host) { } |
119 | static inline void ata_acpi_dissociate(struct ata_host *host) { } | ||
117 | static inline int ata_acpi_on_suspend(struct ata_port *ap) { return 0; } | 120 | static inline int ata_acpi_on_suspend(struct ata_port *ap) { return 0; } |
118 | static inline void ata_acpi_on_resume(struct ata_port *ap) { } | 121 | static inline void ata_acpi_on_resume(struct ata_port *ap) { } |
119 | static inline int ata_acpi_on_devcfg(struct ata_device *adev) { return 0; } | 122 | static inline int ata_acpi_on_devcfg(struct ata_device *dev) { return 0; } |
123 | static inline void ata_acpi_on_disable(struct ata_device *dev) { } | ||
120 | #endif | 124 | #endif |
121 | 125 | ||
122 | /* libata-scsi.c */ | 126 | /* libata-scsi.c */ |