aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide.c')
-rw-r--r--drivers/ide/ide.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index c758dcb13b14..300431d080a9 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -315,13 +315,14 @@ void ide_unregister(ide_hwif_t *hwif)
315 315
316 BUG_ON(in_interrupt()); 316 BUG_ON(in_interrupt());
317 BUG_ON(irqs_disabled()); 317 BUG_ON(irqs_disabled());
318
318 mutex_lock(&ide_cfg_mtx); 319 mutex_lock(&ide_cfg_mtx);
319 spin_lock_irq(&ide_lock);
320 if (!hwif->present)
321 goto abort;
322 __ide_port_unregister_devices(hwif);
323 hwif->present = 0;
324 320
321 spin_lock_irq(&ide_lock);
322 if (hwif->present) {
323 __ide_port_unregister_devices(hwif);
324 hwif->present = 0;
325 }
325 spin_unlock_irq(&ide_lock); 326 spin_unlock_irq(&ide_lock);
326 327
327 ide_proc_unregister_port(hwif); 328 ide_proc_unregister_port(hwif);
@@ -351,16 +352,15 @@ void ide_unregister(ide_hwif_t *hwif)
351 blk_unregister_region(MKDEV(hwif->major, 0), MAX_DRIVES<<PARTN_BITS); 352 blk_unregister_region(MKDEV(hwif->major, 0), MAX_DRIVES<<PARTN_BITS);
352 kfree(hwif->sg_table); 353 kfree(hwif->sg_table);
353 unregister_blkdev(hwif->major, hwif->name); 354 unregister_blkdev(hwif->major, hwif->name);
354 spin_lock_irq(&ide_lock);
355 355
356 if (hwif->dma_base) 356 if (hwif->dma_base)
357 ide_release_dma_engine(hwif); 357 ide_release_dma_engine(hwif);
358 358
359 spin_lock_irq(&ide_lock);
359 /* restore hwif data to pristine status */ 360 /* restore hwif data to pristine status */
360 ide_init_port_data(hwif, hwif->index); 361 ide_init_port_data(hwif, hwif->index);
361
362abort:
363 spin_unlock_irq(&ide_lock); 362 spin_unlock_irq(&ide_lock);
363
364 mutex_unlock(&ide_cfg_mtx); 364 mutex_unlock(&ide_cfg_mtx);
365} 365}
366 366
@@ -1094,13 +1094,6 @@ struct bus_type ide_bus_type = {
1094 1094
1095EXPORT_SYMBOL_GPL(ide_bus_type); 1095EXPORT_SYMBOL_GPL(ide_bus_type);
1096 1096
1097static void ide_port_class_release(struct device *portdev)
1098{
1099 ide_hwif_t *hwif = dev_get_drvdata(portdev);
1100
1101 put_device(&hwif->gendev);
1102}
1103
1104int ide_vlb_clk; 1097int ide_vlb_clk;
1105EXPORT_SYMBOL_GPL(ide_vlb_clk); 1098EXPORT_SYMBOL_GPL(ide_vlb_clk);
1106 1099
@@ -1305,7 +1298,6 @@ static int __init ide_init(void)
1305 ret = PTR_ERR(ide_port_class); 1298 ret = PTR_ERR(ide_port_class);
1306 goto out_port_class; 1299 goto out_port_class;
1307 } 1300 }
1308 ide_port_class->dev_release = ide_port_class_release;
1309 1301
1310 init_ide_data(); 1302 init_ide_data();
1311 1303