aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2006-06-12 10:05:38 -0400
committerJeff Garzik <jeff@garzik.org>2006-06-12 10:23:21 -0400
commitf0eb62b81dd16bfc4034916418c3406ba20011e1 (patch)
treec051e5da940044e189b2227ede4ccb373d0fa169
parentd01712698c7c52bc71f41192e864dccc90a1217d (diff)
[PATCH] libata: add host_set->next for legacy two host_sets case, take #3
For a legacy ATA controller, libata registers two separate host sets. There was no connection between the two hosts making it impossible to traverse all ports related to the controller. This patch adds host_set->next which points to the second host_set and makes ata_pci_remove_one() remove all associated host_sets. * On device removal, all ports hanging off the device are properly detached. Prior to this patch, ports on the first host_set weren't detached casuing oops on driver unloading. * On device removal, both host_sets are properly freed This will also be used by new power management code to suspend and resume all ports of a controller. host_set/port representation will be improved to handle legacy controllers better and this host_set linking will go away with it. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--drivers/scsi/libata-bmdma.c15
-rw-r--r--drivers/scsi/libata-core.c4
-rw-r--r--include/linux/libata.h3
3 files changed, 19 insertions, 3 deletions
diff --git a/drivers/scsi/libata-bmdma.c b/drivers/scsi/libata-bmdma.c
index 4bc05371737c..13fab97c840e 100644
--- a/drivers/scsi/libata-bmdma.c
+++ b/drivers/scsi/libata-bmdma.c
@@ -1076,10 +1076,21 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
1076 1076
1077 /* FIXME: check ata_device_add return */ 1077 /* FIXME: check ata_device_add return */
1078 if (legacy_mode) { 1078 if (legacy_mode) {
1079 if (legacy_mode & (1 << 0)) 1079 struct device *dev = &pdev->dev;
1080 struct ata_host_set *host_set = NULL;
1081
1082 if (legacy_mode & (1 << 0)) {
1080 ata_device_add(probe_ent); 1083 ata_device_add(probe_ent);
1081 if (legacy_mode & (1 << 1)) 1084 host_set = dev_get_drvdata(dev);
1085 }
1086
1087 if (legacy_mode & (1 << 1)) {
1082 ata_device_add(probe_ent2); 1088 ata_device_add(probe_ent2);
1089 if (host_set) {
1090 host_set->next = dev_get_drvdata(dev);
1091 dev_set_drvdata(dev, host_set);
1092 }
1093 }
1083 } else 1094 } else
1084 ata_device_add(probe_ent); 1095 ata_device_add(probe_ent);
1085 1096
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 014855e5a43a..d73cb3672d6a 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -5621,8 +5621,12 @@ void ata_pci_remove_one (struct pci_dev *pdev)
5621{ 5621{
5622 struct device *dev = pci_dev_to_dev(pdev); 5622 struct device *dev = pci_dev_to_dev(pdev);
5623 struct ata_host_set *host_set = dev_get_drvdata(dev); 5623 struct ata_host_set *host_set = dev_get_drvdata(dev);
5624 struct ata_host_set *host_set2 = host_set->next;
5624 5625
5625 ata_host_set_remove(host_set); 5626 ata_host_set_remove(host_set);
5627 if (host_set2)
5628 ata_host_set_remove(host_set2);
5629
5626 pci_release_regions(pdev); 5630 pci_release_regions(pdev);
5627 pci_disable_device(pdev); 5631 pci_disable_device(pdev);
5628 dev_set_drvdata(dev, NULL); 5632 dev_set_drvdata(dev, NULL);
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 61eea5795d5a..f03b8664af11 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -356,7 +356,8 @@ struct ata_host_set {
356 unsigned long flags; 356 unsigned long flags;
357 int simplex_claimed; /* Keep seperate in case we 357 int simplex_claimed; /* Keep seperate in case we
358 ever need to do this locked */ 358 ever need to do this locked */
359 struct ata_port * ports[0]; 359 struct ata_host_set *next; /* for legacy mode */
360 struct ata_port *ports[0];
360}; 361};
361 362
362struct ata_queued_cmd { 363struct ata_queued_cmd {