diff options
-rw-r--r-- | drivers/ide/arm/rapide.c | 2 | ||||
-rw-r--r-- | drivers/ide/ide-pnp.c | 7 | ||||
-rw-r--r-- | drivers/ide/ide.c | 19 | ||||
-rw-r--r-- | drivers/ide/legacy/ide-cs.c | 2 | ||||
-rw-r--r-- | drivers/ide/legacy/ide_platform.c | 2 | ||||
-rw-r--r-- | drivers/ide/mips/au1xxx-ide.c | 2 | ||||
-rw-r--r-- | drivers/ide/pci/delkin_cb.c | 3 | ||||
-rw-r--r-- | drivers/ide/pci/scc_pata.c | 2 | ||||
-rw-r--r-- | drivers/macintosh/mediabay.c | 2 | ||||
-rw-r--r-- | include/linux/ide.h | 2 |
10 files changed, 25 insertions, 18 deletions
diff --git a/drivers/ide/arm/rapide.c b/drivers/ide/arm/rapide.c index b30adcf321c3..823d3331318d 100644 --- a/drivers/ide/arm/rapide.c +++ b/drivers/ide/arm/rapide.c | |||
@@ -76,7 +76,7 @@ static void __devexit rapide_remove(struct expansion_card *ec) | |||
76 | 76 | ||
77 | ecard_set_drvdata(ec, NULL); | 77 | ecard_set_drvdata(ec, NULL); |
78 | 78 | ||
79 | ide_unregister(hwif->index); | 79 | ide_unregister(hwif->index, 1, 1); |
80 | 80 | ||
81 | ecard_release_resources(ec); | 81 | ecard_release_resources(ec); |
82 | } | 82 | } |
diff --git a/drivers/ide/ide-pnp.c b/drivers/ide/ide-pnp.c index 61c33ef64bda..a766bdbbad38 100644 --- a/drivers/ide/ide-pnp.c +++ b/drivers/ide/ide-pnp.c | |||
@@ -60,9 +60,10 @@ static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id | |||
60 | static void idepnp_remove(struct pnp_dev * dev) | 60 | static void idepnp_remove(struct pnp_dev * dev) |
61 | { | 61 | { |
62 | ide_hwif_t *hwif = pnp_get_drvdata(dev); | 62 | ide_hwif_t *hwif = pnp_get_drvdata(dev); |
63 | if (hwif) { | 63 | |
64 | ide_unregister(hwif->index); | 64 | if (hwif) |
65 | } else | 65 | ide_unregister(hwif->index, 1, 1); |
66 | else | ||
66 | printk(KERN_ERR "idepnp: Unable to remove device, please report.\n"); | 67 | printk(KERN_ERR "idepnp: Unable to remove device, please report.\n"); |
67 | } | 68 | } |
68 | 69 | ||
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 4b130e7102eb..166acd513d5b 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
@@ -499,6 +499,8 @@ void ide_remove_port_from_hwgroup(ide_hwif_t *hwif) | |||
499 | /** | 499 | /** |
500 | * ide_unregister - free an IDE interface | 500 | * ide_unregister - free an IDE interface |
501 | * @index: index of interface (will change soon to a pointer) | 501 | * @index: index of interface (will change soon to a pointer) |
502 | * @init_default: init default hwif flag | ||
503 | * @restore: restore hwif flag | ||
502 | * | 504 | * |
503 | * Perform the final unregister of an IDE interface. At the moment | 505 | * Perform the final unregister of an IDE interface. At the moment |
504 | * we don't refcount interfaces so this will also get split up. | 506 | * we don't refcount interfaces so this will also get split up. |
@@ -518,7 +520,7 @@ void ide_remove_port_from_hwgroup(ide_hwif_t *hwif) | |||
518 | * This is raving bonkers. | 520 | * This is raving bonkers. |
519 | */ | 521 | */ |
520 | 522 | ||
521 | void ide_unregister(unsigned int index) | 523 | void ide_unregister(unsigned int index, int init_default, int restore) |
522 | { | 524 | { |
523 | ide_drive_t *drive; | 525 | ide_drive_t *drive; |
524 | ide_hwif_t *hwif, *g; | 526 | ide_hwif_t *hwif, *g; |
@@ -602,9 +604,12 @@ void ide_unregister(unsigned int index) | |||
602 | 604 | ||
603 | /* restore hwif data to pristine status */ | 605 | /* restore hwif data to pristine status */ |
604 | ide_init_port_data(hwif, index); | 606 | ide_init_port_data(hwif, index); |
605 | init_hwif_default(hwif, index); | ||
606 | 607 | ||
607 | ide_hwif_restore(hwif, &tmp_hwif); | 608 | if (init_default) |
609 | init_hwif_default(hwif, index); | ||
610 | |||
611 | if (restore) | ||
612 | ide_hwif_restore(hwif, &tmp_hwif); | ||
608 | 613 | ||
609 | abort: | 614 | abort: |
610 | spin_unlock_irq(&ide_lock); | 615 | spin_unlock_irq(&ide_lock); |
@@ -710,12 +715,12 @@ int ide_register_hw(hw_regs_t *hw, void (*quirkproc)(ide_drive_t *), | |||
710 | goto found; | 715 | goto found; |
711 | } | 716 | } |
712 | for (index = 0; index < MAX_HWIFS; index++) | 717 | for (index = 0; index < MAX_HWIFS; index++) |
713 | ide_unregister(index); | 718 | ide_unregister(index, 1, 1); |
714 | } while (retry--); | 719 | } while (retry--); |
715 | return -1; | 720 | return -1; |
716 | found: | 721 | found: |
717 | if (hwif->present) | 722 | if (hwif->present) |
718 | ide_unregister(index); | 723 | ide_unregister(index, 0, 1); |
719 | else if (!hwif->hold) | 724 | else if (!hwif->hold) |
720 | ide_init_port_data(hwif, index); | 725 | ide_init_port_data(hwif, index); |
721 | 726 | ||
@@ -1058,7 +1063,7 @@ int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device | |||
1058 | case HDIO_UNREGISTER_HWIF: | 1063 | case HDIO_UNREGISTER_HWIF: |
1059 | if (!capable(CAP_SYS_RAWIO)) return -EACCES; | 1064 | if (!capable(CAP_SYS_RAWIO)) return -EACCES; |
1060 | /* (arg > MAX_HWIFS) checked in function */ | 1065 | /* (arg > MAX_HWIFS) checked in function */ |
1061 | ide_unregister(arg); | 1066 | ide_unregister(arg, 1, 1); |
1062 | return 0; | 1067 | return 0; |
1063 | case HDIO_SET_NICE: | 1068 | case HDIO_SET_NICE: |
1064 | if (!capable(CAP_SYS_ADMIN)) return -EACCES; | 1069 | if (!capable(CAP_SYS_ADMIN)) return -EACCES; |
@@ -1703,7 +1708,7 @@ void __exit cleanup_module (void) | |||
1703 | int index; | 1708 | int index; |
1704 | 1709 | ||
1705 | for (index = 0; index < MAX_HWIFS; ++index) | 1710 | for (index = 0; index < MAX_HWIFS; ++index) |
1706 | ide_unregister(index); | 1711 | ide_unregister(index, 0, 0); |
1707 | 1712 | ||
1708 | proc_ide_destroy(); | 1713 | proc_ide_destroy(); |
1709 | 1714 | ||
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c index 3bd29676ef6a..2d772e2bebb3 100644 --- a/drivers/ide/legacy/ide-cs.c +++ b/drivers/ide/legacy/ide-cs.c | |||
@@ -337,7 +337,7 @@ void ide_release(struct pcmcia_device *link) | |||
337 | if (info->ndev) { | 337 | if (info->ndev) { |
338 | /* FIXME: if this fails we need to queue the cleanup somehow | 338 | /* FIXME: if this fails we need to queue the cleanup somehow |
339 | -- need to investigate the required PCMCIA magic */ | 339 | -- need to investigate the required PCMCIA magic */ |
340 | ide_unregister(info->hd); | 340 | ide_unregister(info->hd, 1, 1); |
341 | } | 341 | } |
342 | info->ndev = 0; | 342 | info->ndev = 0; |
343 | 343 | ||
diff --git a/drivers/ide/legacy/ide_platform.c b/drivers/ide/legacy/ide_platform.c index 7c7f42a1fffa..c0dd67f4af32 100644 --- a/drivers/ide/legacy/ide_platform.c +++ b/drivers/ide/legacy/ide_platform.c | |||
@@ -122,7 +122,7 @@ static int __devexit plat_ide_remove(struct platform_device *pdev) | |||
122 | { | 122 | { |
123 | ide_hwif_t *hwif = pdev->dev.driver_data; | 123 | ide_hwif_t *hwif = pdev->dev.driver_data; |
124 | 124 | ||
125 | ide_unregister(hwif->index); | 125 | ide_unregister(hwif->index, 1, 1); |
126 | 126 | ||
127 | return 0; | 127 | return 0; |
128 | } | 128 | } |
diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c index b80d77a260da..66a675a10f13 100644 --- a/drivers/ide/mips/au1xxx-ide.c +++ b/drivers/ide/mips/au1xxx-ide.c | |||
@@ -678,7 +678,7 @@ static int au_ide_remove(struct device *dev) | |||
678 | ide_hwif_t *hwif = dev_get_drvdata(dev); | 678 | ide_hwif_t *hwif = dev_get_drvdata(dev); |
679 | _auide_hwif *ahwif = &auide_hwif; | 679 | _auide_hwif *ahwif = &auide_hwif; |
680 | 680 | ||
681 | ide_unregister(hwif->index); | 681 | ide_unregister(hwif->index, 1, 1); |
682 | 682 | ||
683 | iounmap((void *)ahwif->regbase); | 683 | iounmap((void *)ahwif->regbase); |
684 | 684 | ||
diff --git a/drivers/ide/pci/delkin_cb.c b/drivers/ide/pci/delkin_cb.c index 3fdf5e5a6fbe..4e9ebaa79624 100644 --- a/drivers/ide/pci/delkin_cb.c +++ b/drivers/ide/pci/delkin_cb.c | |||
@@ -99,7 +99,8 @@ delkin_cb_remove (struct pci_dev *dev) | |||
99 | ide_hwif_t *hwif = pci_get_drvdata(dev); | 99 | ide_hwif_t *hwif = pci_get_drvdata(dev); |
100 | 100 | ||
101 | if (hwif) | 101 | if (hwif) |
102 | ide_unregister(hwif->index); | 102 | ide_unregister(hwif->index, 1, 1); |
103 | |||
103 | pci_disable_device(dev); | 104 | pci_disable_device(dev); |
104 | } | 105 | } |
105 | 106 | ||
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c index 085c1b58a99c..7e52a55c86cc 100644 --- a/drivers/ide/pci/scc_pata.c +++ b/drivers/ide/pci/scc_pata.c | |||
@@ -736,7 +736,7 @@ static void __devexit scc_remove(struct pci_dev *dev) | |||
736 | hwif->dmatable_cpu = NULL; | 736 | hwif->dmatable_cpu = NULL; |
737 | } | 737 | } |
738 | 738 | ||
739 | ide_unregister(hwif->index); | 739 | ide_unregister(hwif->index, 1, 1); |
740 | 740 | ||
741 | hwif->chipset = ide_unknown; | 741 | hwif->chipset = ide_unknown; |
742 | iounmap((void*)ports->dma); | 742 | iounmap((void*)ports->dma); |
diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c index 18dde2a27209..de9ebbfbf122 100644 --- a/drivers/macintosh/mediabay.c +++ b/drivers/macintosh/mediabay.c | |||
@@ -595,7 +595,7 @@ static void media_bay_step(int i) | |||
595 | if (bay->cd_index >= 0) { | 595 | if (bay->cd_index >= 0) { |
596 | printk(KERN_DEBUG "Unregistering mb %d ide, index:%d\n", i, | 596 | printk(KERN_DEBUG "Unregistering mb %d ide, index:%d\n", i, |
597 | bay->cd_index); | 597 | bay->cd_index); |
598 | ide_unregister(bay->cd_index); | 598 | ide_unregister(bay->cd_index, 1, 1); |
599 | bay->cd_index = -1; | 599 | bay->cd_index = -1; |
600 | } | 600 | } |
601 | if (bay->cd_retry) { | 601 | if (bay->cd_retry) { |
diff --git a/include/linux/ide.h b/include/linux/ide.h index f7fe8b1fe681..8ae0480af008 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -1208,7 +1208,7 @@ static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {} | |||
1208 | void ide_remove_port_from_hwgroup(ide_hwif_t *); | 1208 | void ide_remove_port_from_hwgroup(ide_hwif_t *); |
1209 | extern int ide_hwif_request_regions(ide_hwif_t *hwif); | 1209 | extern int ide_hwif_request_regions(ide_hwif_t *hwif); |
1210 | extern void ide_hwif_release_regions(ide_hwif_t* hwif); | 1210 | extern void ide_hwif_release_regions(ide_hwif_t* hwif); |
1211 | extern void ide_unregister (unsigned int index); | 1211 | void ide_unregister(unsigned int, int, int); |
1212 | 1212 | ||
1213 | void ide_register_region(struct gendisk *); | 1213 | void ide_register_region(struct gendisk *); |
1214 | void ide_unregister_region(struct gendisk *); | 1214 | void ide_unregister_region(struct gendisk *); |