diff options
Diffstat (limited to 'drivers/scsi/libata-core.c')
-rw-r--r-- | drivers/scsi/libata-core.c | 81 |
1 files changed, 49 insertions, 32 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index d92273cbe0de..e5b01997117a 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -4132,6 +4132,53 @@ err_out: | |||
4132 | } | 4132 | } |
4133 | 4133 | ||
4134 | /** | 4134 | /** |
4135 | * ata_host_set_remove - PCI layer callback for device removal | ||
4136 | * @host_set: ATA host set that was removed | ||
4137 | * | ||
4138 | * Unregister all objects associated with this host set. Free those | ||
4139 | * objects. | ||
4140 | * | ||
4141 | * LOCKING: | ||
4142 | * Inherited from calling layer (may sleep). | ||
4143 | */ | ||
4144 | |||
4145 | |||
4146 | void ata_host_set_remove(struct ata_host_set *host_set) | ||
4147 | { | ||
4148 | struct ata_port *ap; | ||
4149 | unsigned int i; | ||
4150 | |||
4151 | for (i = 0; i < host_set->n_ports; i++) { | ||
4152 | ap = host_set->ports[i]; | ||
4153 | scsi_remove_host(ap->host); | ||
4154 | } | ||
4155 | |||
4156 | free_irq(host_set->irq, host_set); | ||
4157 | |||
4158 | for (i = 0; i < host_set->n_ports; i++) { | ||
4159 | ap = host_set->ports[i]; | ||
4160 | |||
4161 | ata_scsi_release(ap->host); | ||
4162 | |||
4163 | if ((ap->flags & ATA_FLAG_NO_LEGACY) == 0) { | ||
4164 | struct ata_ioports *ioaddr = &ap->ioaddr; | ||
4165 | |||
4166 | if (ioaddr->cmd_addr == 0x1f0) | ||
4167 | release_region(0x1f0, 8); | ||
4168 | else if (ioaddr->cmd_addr == 0x170) | ||
4169 | release_region(0x170, 8); | ||
4170 | } | ||
4171 | |||
4172 | scsi_host_put(ap->host); | ||
4173 | } | ||
4174 | |||
4175 | if (host_set->ops->host_stop) | ||
4176 | host_set->ops->host_stop(host_set); | ||
4177 | |||
4178 | kfree(host_set); | ||
4179 | } | ||
4180 | |||
4181 | /** | ||
4135 | * ata_scsi_release - SCSI layer callback hook for host unload | 4182 | * ata_scsi_release - SCSI layer callback hook for host unload |
4136 | * @host: libata host to be unloaded | 4183 | * @host: libata host to be unloaded |
4137 | * | 4184 | * |
@@ -4471,39 +4518,8 @@ void ata_pci_remove_one (struct pci_dev *pdev) | |||
4471 | { | 4518 | { |
4472 | struct device *dev = pci_dev_to_dev(pdev); | 4519 | struct device *dev = pci_dev_to_dev(pdev); |
4473 | struct ata_host_set *host_set = dev_get_drvdata(dev); | 4520 | struct ata_host_set *host_set = dev_get_drvdata(dev); |
4474 | struct ata_port *ap; | ||
4475 | unsigned int i; | ||
4476 | |||
4477 | for (i = 0; i < host_set->n_ports; i++) { | ||
4478 | ap = host_set->ports[i]; | ||
4479 | |||
4480 | scsi_remove_host(ap->host); | ||
4481 | } | ||
4482 | |||
4483 | free_irq(host_set->irq, host_set); | ||
4484 | |||
4485 | for (i = 0; i < host_set->n_ports; i++) { | ||
4486 | ap = host_set->ports[i]; | ||
4487 | |||
4488 | ata_scsi_release(ap->host); | ||
4489 | |||
4490 | if ((ap->flags & ATA_FLAG_NO_LEGACY) == 0) { | ||
4491 | struct ata_ioports *ioaddr = &ap->ioaddr; | ||
4492 | |||
4493 | if (ioaddr->cmd_addr == 0x1f0) | ||
4494 | release_region(0x1f0, 8); | ||
4495 | else if (ioaddr->cmd_addr == 0x170) | ||
4496 | release_region(0x170, 8); | ||
4497 | } | ||
4498 | |||
4499 | scsi_host_put(ap->host); | ||
4500 | } | ||
4501 | |||
4502 | if (host_set->ops->host_stop) | ||
4503 | host_set->ops->host_stop(host_set); | ||
4504 | |||
4505 | kfree(host_set); | ||
4506 | 4521 | ||
4522 | ata_host_set_remove(host_set); | ||
4507 | pci_release_regions(pdev); | 4523 | pci_release_regions(pdev); |
4508 | pci_disable_device(pdev); | 4524 | pci_disable_device(pdev); |
4509 | dev_set_drvdata(dev, NULL); | 4525 | dev_set_drvdata(dev, NULL); |
@@ -4573,6 +4589,7 @@ module_exit(ata_exit); | |||
4573 | EXPORT_SYMBOL_GPL(ata_std_bios_param); | 4589 | EXPORT_SYMBOL_GPL(ata_std_bios_param); |
4574 | EXPORT_SYMBOL_GPL(ata_std_ports); | 4590 | EXPORT_SYMBOL_GPL(ata_std_ports); |
4575 | EXPORT_SYMBOL_GPL(ata_device_add); | 4591 | EXPORT_SYMBOL_GPL(ata_device_add); |
4592 | EXPORT_SYMBOL_GPL(ata_host_set_remove); | ||
4576 | EXPORT_SYMBOL_GPL(ata_sg_init); | 4593 | EXPORT_SYMBOL_GPL(ata_sg_init); |
4577 | EXPORT_SYMBOL_GPL(ata_sg_init_one); | 4594 | EXPORT_SYMBOL_GPL(ata_sg_init_one); |
4578 | EXPORT_SYMBOL_GPL(ata_qc_complete); | 4595 | EXPORT_SYMBOL_GPL(ata_qc_complete); |