aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-07-05 16:06:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-05 16:06:19 -0400
commitfbe0825752dc34b505777fd59cde4a6ce832eb16 (patch)
tree7c6056676dc5d657e105761ae0dc19f98a700917 /drivers
parentd28f87aa87ce8b196349d7c306a7e6fe3abd7155 (diff)
parent2b54ed9467697b0ce2d60d89e5e4253c9e322c26 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: ide: ide_unregister() locking bugfix ide: ide_unregister() warm-plug bugfix ide: fix hwif->gendev refcounting
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ide/ide-probe.c2
-rw-r--r--drivers/ide/ide.c24
2 files changed, 8 insertions, 18 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 380fa0c8cc84..d27061b39324 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -646,8 +646,6 @@ static int ide_register_port(ide_hwif_t *hwif)
646 goto out; 646 goto out;
647 } 647 }
648 648
649 get_device(&hwif->gendev);
650
651 hwif->portdev = device_create_drvdata(ide_port_class, &hwif->gendev, 649 hwif->portdev = device_create_drvdata(ide_port_class, &hwif->gendev,
652 MKDEV(0, 0), hwif, hwif->name); 650 MKDEV(0, 0), hwif, hwif->name);
653 if (IS_ERR(hwif->portdev)) { 651 if (IS_ERR(hwif->portdev)) {
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