diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-27 09:38:31 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-27 09:38:31 -0400 |
commit | 387750c3bf49c22f6189436032145e2131985076 (patch) | |
tree | 823d10a2e5008048990d66643819a36d5fc70b3f /drivers/ide | |
parent | bf64b7a9ddc604883a1f41535d3d7a62bca9ee81 (diff) |
ide: make ide_unregister() take 'ide_hwif_t *' as an argument (take 2)
* Make ide_unregister() take 'ide_hwif_t *hwif' instead of 'unsigned int
index' (hwif->index) as an argument and update all users accordingly.
While at it:
* Remove unnecessary checks for hwif != NULL from ide-pnp.c::idepnp_remove()
and delkin_cb.c::delkin_cb_remove().
* Remove needless hwif->chipset assignment from scc_pata.c::scc_remove().
v2:
* Fixup ide_unregister() documentation.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/arm/rapide.c | 2 | ||||
-rw-r--r-- | drivers/ide/ide-pnp.c | 5 | ||||
-rw-r--r-- | drivers/ide/ide.c | 11 | ||||
-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 | 3 |
8 files changed, 11 insertions, 19 deletions
diff --git a/drivers/ide/arm/rapide.c b/drivers/ide/arm/rapide.c index c0581bd98d0d..3d30d4b5f9e3 100644 --- a/drivers/ide/arm/rapide.c +++ b/drivers/ide/arm/rapide.c | |||
@@ -75,7 +75,7 @@ static void __devexit rapide_remove(struct expansion_card *ec) | |||
75 | 75 | ||
76 | ecard_set_drvdata(ec, NULL); | 76 | ecard_set_drvdata(ec, NULL); |
77 | 77 | ||
78 | ide_unregister(hwif->index); | 78 | ide_unregister(hwif); |
79 | 79 | ||
80 | ecard_release_resources(ec); | 80 | ecard_release_resources(ec); |
81 | } | 81 | } |
diff --git a/drivers/ide/ide-pnp.c b/drivers/ide/ide-pnp.c index 10c20e9a5785..6a8953f68e9f 100644 --- a/drivers/ide/ide-pnp.c +++ b/drivers/ide/ide-pnp.c | |||
@@ -82,10 +82,7 @@ static void idepnp_remove(struct pnp_dev *dev) | |||
82 | { | 82 | { |
83 | ide_hwif_t *hwif = pnp_get_drvdata(dev); | 83 | ide_hwif_t *hwif = pnp_get_drvdata(dev); |
84 | 84 | ||
85 | if (hwif) | 85 | ide_unregister(hwif); |
86 | ide_unregister(hwif->index); | ||
87 | else | ||
88 | printk(KERN_ERR "idepnp: Unable to remove device, please report.\n"); | ||
89 | 86 | ||
90 | release_region(pnp_port_start(dev, 1), 1); | 87 | release_region(pnp_port_start(dev, 1), 1); |
91 | release_region(pnp_port_start(dev, 0), 8); | 88 | release_region(pnp_port_start(dev, 0), 8); |
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 53c6a038e179..7bcc4c452255 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
@@ -287,7 +287,7 @@ EXPORT_SYMBOL_GPL(ide_port_unregister_devices); | |||
287 | 287 | ||
288 | /** | 288 | /** |
289 | * ide_unregister - free an IDE interface | 289 | * ide_unregister - free an IDE interface |
290 | * @index: index of interface (will change soon to a pointer) | 290 | * @hwif: IDE interface |
291 | * | 291 | * |
292 | * Perform the final unregister of an IDE interface. At the moment | 292 | * Perform the final unregister of an IDE interface. At the moment |
293 | * we don't refcount interfaces so this will also get split up. | 293 | * we don't refcount interfaces so this will also get split up. |
@@ -307,19 +307,16 @@ EXPORT_SYMBOL_GPL(ide_port_unregister_devices); | |||
307 | * This is raving bonkers. | 307 | * This is raving bonkers. |
308 | */ | 308 | */ |
309 | 309 | ||
310 | void ide_unregister(unsigned int index) | 310 | void ide_unregister(ide_hwif_t *hwif) |
311 | { | 311 | { |
312 | ide_hwif_t *hwif, *g; | 312 | ide_hwif_t *g; |
313 | ide_hwgroup_t *hwgroup; | 313 | ide_hwgroup_t *hwgroup; |
314 | int irq_count = 0; | 314 | int irq_count = 0; |
315 | 315 | ||
316 | BUG_ON(index >= MAX_HWIFS); | ||
317 | |||
318 | BUG_ON(in_interrupt()); | 316 | BUG_ON(in_interrupt()); |
319 | BUG_ON(irqs_disabled()); | 317 | BUG_ON(irqs_disabled()); |
320 | mutex_lock(&ide_cfg_mtx); | 318 | mutex_lock(&ide_cfg_mtx); |
321 | spin_lock_irq(&ide_lock); | 319 | spin_lock_irq(&ide_lock); |
322 | hwif = &ide_hwifs[index]; | ||
323 | if (!hwif->present) | 320 | if (!hwif->present) |
324 | goto abort; | 321 | goto abort; |
325 | __ide_port_unregister_devices(hwif); | 322 | __ide_port_unregister_devices(hwif); |
@@ -360,7 +357,7 @@ void ide_unregister(unsigned int index) | |||
360 | ide_release_dma_engine(hwif); | 357 | ide_release_dma_engine(hwif); |
361 | 358 | ||
362 | /* restore hwif data to pristine status */ | 359 | /* restore hwif data to pristine status */ |
363 | ide_init_port_data(hwif, index); | 360 | ide_init_port_data(hwif, hwif->index); |
364 | 361 | ||
365 | abort: | 362 | abort: |
366 | spin_unlock_irq(&ide_lock); | 363 | spin_unlock_irq(&ide_lock); |
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c index 867fe14e5de3..8753e2d7e34e 100644 --- a/drivers/ide/legacy/ide-cs.c +++ b/drivers/ide/legacy/ide-cs.c | |||
@@ -386,7 +386,7 @@ void ide_release(struct pcmcia_device *link) | |||
386 | if (info->ndev) { | 386 | if (info->ndev) { |
387 | /* FIXME: if this fails we need to queue the cleanup somehow | 387 | /* FIXME: if this fails we need to queue the cleanup somehow |
388 | -- need to investigate the required PCMCIA magic */ | 388 | -- need to investigate the required PCMCIA magic */ |
389 | ide_unregister(hwif->index); | 389 | ide_unregister(hwif); |
390 | } | 390 | } |
391 | info->ndev = 0; | 391 | info->ndev = 0; |
392 | 392 | ||
diff --git a/drivers/ide/legacy/ide_platform.c b/drivers/ide/legacy/ide_platform.c index 822f48b05c70..ff5a1c03c92c 100644 --- a/drivers/ide/legacy/ide_platform.c +++ b/drivers/ide/legacy/ide_platform.c | |||
@@ -120,7 +120,7 @@ static int __devexit plat_ide_remove(struct platform_device *pdev) | |||
120 | { | 120 | { |
121 | ide_hwif_t *hwif = pdev->dev.driver_data; | 121 | ide_hwif_t *hwif = pdev->dev.driver_data; |
122 | 122 | ||
123 | ide_unregister(hwif->index); | 123 | ide_unregister(hwif); |
124 | 124 | ||
125 | return 0; | 125 | return 0; |
126 | } | 126 | } |
diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c index 3485a310c95b..0f6399408c76 100644 --- a/drivers/ide/mips/au1xxx-ide.c +++ b/drivers/ide/mips/au1xxx-ide.c | |||
@@ -627,7 +627,7 @@ static int au_ide_remove(struct device *dev) | |||
627 | ide_hwif_t *hwif = dev_get_drvdata(dev); | 627 | ide_hwif_t *hwif = dev_get_drvdata(dev); |
628 | _auide_hwif *ahwif = &auide_hwif; | 628 | _auide_hwif *ahwif = &auide_hwif; |
629 | 629 | ||
630 | ide_unregister(hwif->index); | 630 | ide_unregister(hwif); |
631 | 631 | ||
632 | iounmap((void *)ahwif->regbase); | 632 | iounmap((void *)ahwif->regbase); |
633 | 633 | ||
diff --git a/drivers/ide/pci/delkin_cb.c b/drivers/ide/pci/delkin_cb.c index 7b0ab178459c..b9e457996d0e 100644 --- a/drivers/ide/pci/delkin_cb.c +++ b/drivers/ide/pci/delkin_cb.c | |||
@@ -119,8 +119,7 @@ delkin_cb_remove (struct pci_dev *dev) | |||
119 | { | 119 | { |
120 | ide_hwif_t *hwif = pci_get_drvdata(dev); | 120 | ide_hwif_t *hwif = pci_get_drvdata(dev); |
121 | 121 | ||
122 | if (hwif) | 122 | ide_unregister(hwif); |
123 | ide_unregister(hwif->index); | ||
124 | 123 | ||
125 | pci_release_regions(dev); | 124 | pci_release_regions(dev); |
126 | pci_disable_device(dev); | 125 | pci_disable_device(dev); |
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c index 17cf86490d59..f80306b39299 100644 --- a/drivers/ide/pci/scc_pata.c +++ b/drivers/ide/pci/scc_pata.c | |||
@@ -763,9 +763,8 @@ static void __devexit scc_remove(struct pci_dev *dev) | |||
763 | hwif->dmatable_cpu = NULL; | 763 | hwif->dmatable_cpu = NULL; |
764 | } | 764 | } |
765 | 765 | ||
766 | ide_unregister(hwif->index); | 766 | ide_unregister(hwif); |
767 | 767 | ||
768 | hwif->chipset = ide_unknown; | ||
769 | iounmap((void*)ports->dma); | 768 | iounmap((void*)ports->dma); |
770 | iounmap((void*)ports->ctl); | 769 | iounmap((void*)ports->ctl); |
771 | pci_release_selected_regions(dev, (1 << 2) - 1); | 770 | pci_release_selected_regions(dev, (1 << 2) - 1); |