aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ide/ide-probe.c3
-rw-r--r--drivers/ide/setup-pci.c39
-rw-r--r--include/linux/ide.h2
3 files changed, 38 insertions, 6 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 9ab5892eaea1..f0c162488ec4 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1609,6 +1609,9 @@ struct ide_host *ide_host_alloc_all(const struct ide_port_info *d,
1609 if (hws[0]) 1609 if (hws[0])
1610 host->dev[0] = hws[0]->dev; 1610 host->dev[0] = hws[0]->dev;
1611 1611
1612 if (d)
1613 host->host_flags = d->host_flags;
1614
1612 return host; 1615 return host;
1613} 1616}
1614EXPORT_SYMBOL_GPL(ide_host_alloc_all); 1617EXPORT_SYMBOL_GPL(ide_host_alloc_all);
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index ca17bf8896df..20f0ee004695 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -548,8 +548,7 @@ int ide_pci_init_one(struct pci_dev *dev, const struct ide_port_info *d,
548 548
549 host->host_priv = priv; 549 host->host_priv = priv;
550 550
551 if (priv) 551 pci_set_drvdata(dev, host);
552 pci_set_drvdata(dev, host);
553 552
554 ret = do_ide_setup_pci_device(dev, d, 1); 553 ret = do_ide_setup_pci_device(dev, d, 1);
555 if (ret < 0) 554 if (ret < 0)
@@ -593,10 +592,8 @@ int ide_pci_init_two(struct pci_dev *dev1, struct pci_dev *dev2,
593 592
594 host->host_priv = priv; 593 host->host_priv = priv;
595 594
596 if (priv) { 595 pci_set_drvdata(pdev[0], host);
597 pci_set_drvdata(pdev[0], host); 596 pci_set_drvdata(pdev[1], host);
598 pci_set_drvdata(pdev[1], host);
599 }
600 597
601 for (i = 0; i < 2; i++) { 598 for (i = 0; i < 2; i++) {
602 ret = do_ide_setup_pci_device(pdev[i], d, !i); 599 ret = do_ide_setup_pci_device(pdev[i], d, !i);
@@ -619,3 +616,33 @@ out:
619 return ret; 616 return ret;
620} 617}
621EXPORT_SYMBOL_GPL(ide_pci_init_two); 618EXPORT_SYMBOL_GPL(ide_pci_init_two);
619
620void ide_pci_remove(struct pci_dev *dev)
621{
622 struct ide_host *host = pci_get_drvdata(dev);
623 struct pci_dev *dev2 = host->dev[1] ? to_pci_dev(host->dev[1]) : NULL;
624 int bars;
625
626 if (host->host_flags & IDE_HFLAG_SINGLE)
627 bars = (1 << 2) - 1;
628 else
629 bars = (1 << 4) - 1;
630
631 if ((host->host_flags & IDE_HFLAG_NO_DMA) == 0) {
632 if (host->host_flags & IDE_HFLAG_CS5520)
633 bars |= (1 << 2);
634 else
635 bars |= (1 << 4);
636 }
637
638 ide_host_remove(host);
639
640 if (dev2)
641 pci_release_selected_regions(dev2, bars);
642 pci_release_selected_regions(dev, bars);
643
644 if (dev2)
645 pci_disable_device(dev2);
646 pci_disable_device(dev);
647}
648EXPORT_SYMBOL_GPL(ide_pci_remove);
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 3eccac0a2a36..dbd0aeb3a56d 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -631,6 +631,7 @@ struct ide_host {
631 ide_hwif_t *ports[MAX_HWIFS]; 631 ide_hwif_t *ports[MAX_HWIFS];
632 unsigned int n_ports; 632 unsigned int n_ports;
633 struct device *dev[2]; 633 struct device *dev[2];
634 unsigned long host_flags;
634 void *host_priv; 635 void *host_priv;
635}; 636};
636 637
@@ -1213,6 +1214,7 @@ struct ide_port_info {
1213int ide_pci_init_one(struct pci_dev *, const struct ide_port_info *, void *); 1214int ide_pci_init_one(struct pci_dev *, const struct ide_port_info *, void *);
1214int ide_pci_init_two(struct pci_dev *, struct pci_dev *, 1215int ide_pci_init_two(struct pci_dev *, struct pci_dev *,
1215 const struct ide_port_info *, void *); 1216 const struct ide_port_info *, void *);
1217void ide_pci_remove(struct pci_dev *);
1216 1218
1217void ide_map_sg(ide_drive_t *, struct request *); 1219void ide_map_sg(ide_drive_t *, struct request *);
1218void ide_init_sg_cmd(ide_drive_t *, struct request *); 1220void ide_init_sg_cmd(ide_drive_t *, struct request *);