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>

authored by Tejun Heo and committed by Jeff Garzik 562f0c2d 7f9ad9b8

+38 -2
+28
drivers/ata/libata-acpi.c
··· 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 206 * ata_acpi_gtm - execute _GTM 192 207 * @ap: target ATA port 193 208 * @gtm: out parameter for _GTM result ··· 730 715 } 731 716 dev->flags |= ATA_DFLAG_ACPI_FAILED; 732 717 return rc; 718 + } 719 + 720 + /** 721 + * ata_acpi_on_disable - ATA ACPI hook called when a device is disabled 722 + * @dev: target ATA device 723 + * 724 + * This function is called when @dev is about to be disabled. 725 + * 726 + * LOCKING: 727 + * EH context. 728 + */ 729 + void ata_acpi_on_disable(struct ata_device *dev) 730 + { 733 731 }
+4
drivers/ata/libata-core.c
··· 622 622 if (ata_dev_enabled(dev)) { 623 623 if (ata_msg_drv(dev->link->ap)) 624 624 ata_dev_printk(dev, KERN_WARNING, "disabled\n"); 625 + ata_acpi_on_disable(dev); 625 626 ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO0 | 626 627 ATA_DNXFER_QUIET); 627 628 dev->class++; ··· 7250 7249 7251 7250 for (i = 0; i < host->n_ports; i++) 7252 7251 ata_port_detach(host->ports[i]); 7252 + 7253 + /* the host is dead now, dissociate ACPI */ 7254 + ata_acpi_dissociate(host); 7253 7255 } 7254 7256 7255 7257 /**
+6 -2
drivers/ata/libata.h
··· 108 108 #ifdef CONFIG_ATA_ACPI 109 109 extern void ata_acpi_associate_sata_port(struct ata_port *ap); 110 110 extern void ata_acpi_associate(struct ata_host *host); 111 + extern void ata_acpi_dissociate(struct ata_host *host); 111 112 extern int ata_acpi_on_suspend(struct ata_port *ap); 112 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 116 #else 115 117 static inline void ata_acpi_associate_sata_port(struct ata_port *ap) { } 116 118 static inline void ata_acpi_associate(struct ata_host *host) { } 119 + static inline void ata_acpi_dissociate(struct ata_host *host) { } 117 120 static inline int ata_acpi_on_suspend(struct ata_port *ap) { return 0; } 118 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 124 #endif 121 125 122 126 /* libata-scsi.c */