ide: ide_unregister() warm-plug bugfix

Fix ide_unregister() to work for ports with no devices attached to them.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

+7 -7
+7 -7
drivers/ide/ide.c
··· 315 316 BUG_ON(in_interrupt()); 317 BUG_ON(irqs_disabled()); 318 - 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 325 spin_unlock_irq(&ide_lock); 326 327 ide_proc_unregister_port(hwif); ··· 360 /* restore hwif data to pristine status */ 361 ide_init_port_data(hwif, hwif->index); 362 363 - abort: 364 spin_unlock_irq(&ide_lock); 365 mutex_unlock(&ide_cfg_mtx); 366 }
··· 315 316 BUG_ON(in_interrupt()); 317 BUG_ON(irqs_disabled()); 318 319 + mutex_lock(&ide_cfg_mtx); 320 + 321 + spin_lock_irq(&ide_lock); 322 + if (hwif->present) { 323 + __ide_port_unregister_devices(hwif); 324 + hwif->present = 0; 325 + } 326 spin_unlock_irq(&ide_lock); 327 328 ide_proc_unregister_port(hwif); ··· 359 /* restore hwif data to pristine status */ 360 ide_init_port_data(hwif, hwif->index); 361 362 spin_unlock_irq(&ide_lock); 363 mutex_unlock(&ide_cfg_mtx); 364 }