diff options
-rw-r--r-- | drivers/ata/libata-acpi.c | 37 | ||||
-rw-r--r-- | drivers/ata/libata-core.c | 2 | ||||
-rw-r--r-- | drivers/ata/libata.h | 2 |
3 files changed, 40 insertions, 1 deletions
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index 87f2f395d79a..cf4e7020adac 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
@@ -156,8 +156,10 @@ static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device *dev, | |||
156 | 156 | ||
157 | spin_unlock_irqrestore(ap->lock, flags); | 157 | spin_unlock_irqrestore(ap->lock, flags); |
158 | 158 | ||
159 | if (wait) | 159 | if (wait) { |
160 | ata_port_wait_eh(ap); | 160 | ata_port_wait_eh(ap); |
161 | flush_work(&ap->hotplug_task.work); | ||
162 | } | ||
161 | } | 163 | } |
162 | 164 | ||
163 | static void ata_acpi_dev_notify_dock(acpi_handle handle, u32 event, void *data) | 165 | static void ata_acpi_dev_notify_dock(acpi_handle handle, u32 event, void *data) |
@@ -214,6 +216,39 @@ static const struct acpi_dock_ops ata_acpi_ap_dock_ops = { | |||
214 | .uevent = ata_acpi_ap_uevent, | 216 | .uevent = ata_acpi_ap_uevent, |
215 | }; | 217 | }; |
216 | 218 | ||
219 | void ata_acpi_hotplug_init(struct ata_host *host) | ||
220 | { | ||
221 | int i; | ||
222 | |||
223 | for (i = 0; i < host->n_ports; i++) { | ||
224 | struct ata_port *ap = host->ports[i]; | ||
225 | acpi_handle handle; | ||
226 | struct ata_device *dev; | ||
227 | |||
228 | if (!ap) | ||
229 | continue; | ||
230 | |||
231 | handle = ata_ap_acpi_handle(ap); | ||
232 | if (handle) { | ||
233 | /* we might be on a docking station */ | ||
234 | register_hotplug_dock_device(handle, | ||
235 | &ata_acpi_ap_dock_ops, ap, | ||
236 | NULL, NULL); | ||
237 | } | ||
238 | |||
239 | ata_for_each_dev(dev, &ap->link, ALL) { | ||
240 | handle = ata_dev_acpi_handle(dev); | ||
241 | if (!handle) | ||
242 | continue; | ||
243 | |||
244 | /* we might be on a docking station */ | ||
245 | register_hotplug_dock_device(handle, | ||
246 | &ata_acpi_dev_dock_ops, | ||
247 | dev, NULL, NULL); | ||
248 | } | ||
249 | } | ||
250 | } | ||
251 | |||
217 | /** | 252 | /** |
218 | * ata_acpi_dissociate - dissociate ATA host from ACPI objects | 253 | * ata_acpi_dissociate - dissociate ATA host from ACPI objects |
219 | * @host: target ATA host | 254 | * @host: target ATA host |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index f2184276539d..adf002a3c584 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -6148,6 +6148,8 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) | |||
6148 | if (rc) | 6148 | if (rc) |
6149 | goto err_tadd; | 6149 | goto err_tadd; |
6150 | 6150 | ||
6151 | ata_acpi_hotplug_init(host); | ||
6152 | |||
6151 | /* set cable, sata_spd_limit and report */ | 6153 | /* set cable, sata_spd_limit and report */ |
6152 | for (i = 0; i < host->n_ports; i++) { | 6154 | for (i = 0; i < host->n_ports; i++) { |
6153 | struct ata_port *ap = host->ports[i]; | 6155 | struct ata_port *ap = host->ports[i]; |
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index c949dd311b2e..577d902bc4de 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h | |||
@@ -122,6 +122,7 @@ extern int ata_acpi_register(void); | |||
122 | extern void ata_acpi_unregister(void); | 122 | extern void ata_acpi_unregister(void); |
123 | extern void ata_acpi_bind(struct ata_device *dev); | 123 | extern void ata_acpi_bind(struct ata_device *dev); |
124 | extern void ata_acpi_unbind(struct ata_device *dev); | 124 | extern void ata_acpi_unbind(struct ata_device *dev); |
125 | extern void ata_acpi_hotplug_init(struct ata_host *host); | ||
125 | #else | 126 | #else |
126 | static inline void ata_acpi_dissociate(struct ata_host *host) { } | 127 | static inline void ata_acpi_dissociate(struct ata_host *host) { } |
127 | static inline int ata_acpi_on_suspend(struct ata_port *ap) { return 0; } | 128 | static inline int ata_acpi_on_suspend(struct ata_port *ap) { return 0; } |
@@ -134,6 +135,7 @@ static inline int ata_acpi_register(void) { return 0; } | |||
134 | static inline void ata_acpi_unregister(void) { } | 135 | static inline void ata_acpi_unregister(void) { } |
135 | static inline void ata_acpi_bind(struct ata_device *dev) { } | 136 | static inline void ata_acpi_bind(struct ata_device *dev) { } |
136 | static inline void ata_acpi_unbind(struct ata_device *dev) { } | 137 | static inline void ata_acpi_unbind(struct ata_device *dev) { } |
138 | static inline void ata_acpi_hotplug_init(struct ata_host *host) {} | ||
137 | #endif | 139 | #endif |
138 | 140 | ||
139 | /* libata-scsi.c */ | 141 | /* libata-scsi.c */ |