@@ -966,6 +966,26 @@ void ata_acpi_on_disable(struct ata_device *dev)
ata_acpi_clear_gtf(dev);
}
+void ata_acpi_bind_dock(struct ata_device *dev)
+{
+ struct device **docks;
+
+ if (!ata_dev_acpi_handle(dev))
+ return;
+ docks = dock_link_device(ata_dev_acpi_handle(dev));
+ kfree(docks);
+}
+
+void ata_acpi_unbind_dock(struct ata_device *dev)
+{
+ struct device **docks;
+
+ if (!ata_dev_acpi_handle(dev))
+ return;
+ docks = dock_unlink_device(ata_dev_acpi_handle(dev));
+ kfree(docks);
+}
+
static int is_pci_ata(struct device *dev)
{
struct pci_dev *pdev;
@@ -3393,6 +3393,7 @@ void ata_scsi_scan_host(struct ata_port *ap, int sync)
if (!IS_ERR(sdev)) {
dev->sdev = sdev;
scsi_device_put(sdev);
+ ata_acpi_bind_dock(dev);
}
}
}
@@ -3513,6 +3514,8 @@ static void ata_scsi_remove_dev(struct ata_device *dev)
spin_unlock_irqrestore(ap->lock, flags);
mutex_unlock(&ap->scsi_host->scan_mutex);
+ ata_acpi_unbind_dock(dev);
+
if (sdev) {
ata_dev_printk(dev, KERN_INFO, "detaching (SCSI %s)\n",
dev_name(&sdev->sdev_gendev));
@@ -114,6 +114,8 @@ extern void ata_acpi_on_disable(struct ata_device *dev);
extern void ata_acpi_set_state(struct ata_port *ap, pm_message_t state);
extern int ata_acpi_register(void);
extern void ata_acpi_unregister(void);
+extern void ata_acpi_bind_dock(struct ata_device *dev);
+extern void ata_acpi_unbind_dock(struct ata_device *dev);
#else
static inline void ata_acpi_dissociate(struct ata_host *host) { }
static inline int ata_acpi_on_suspend(struct ata_port *ap) { return 0; }
@@ -124,6 +126,8 @@ static inline void ata_acpi_set_state(struct ata_port *ap,
pm_message_t state) { }
static inline int ata_acpi_register(void) { return 0; }
static void ata_acpi_unregister(void) { }
+static void ata_acpi_bind_dock(struct ata_device *dev) { }
+static void ata_acpi_unbind_dock(struct ata_device *dev) { }
#endif
/* libata-scsi.c */