aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-02 13:56:39 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-02 13:56:39 -0500
commitf82c2b171905b6d5af92395d8159546351ab602f (patch)
tree89790c732a73c3210b5f8578d3a94a2717ab7b3b /drivers/ide/ide.c
parentead741df385607ab74876afdb05fd8ac27da9906 (diff)
ide: add 'init_default' and 'restore' arguments to ide_unregister()
* Add 'init_default' (flag for calling init_hwif_default()) and 'restore' (flag for calling ide_hwif_restore()) arguments to ide_unregister(). * Update ide_unregister() users to set 'init_default' and 'restore' flags. * No need to set 'init_default' flag in ide_register_hw() if the setup done by init_hwif_default() is going to be overridden by ide_init_port_hw(). * No need to set 'init_default' and 'restore' flags in cleanup_module(). There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide.c')
-rw-r--r--drivers/ide/ide.c19
1 files changed, 12 insertions, 7 deletions
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
521void ide_unregister(unsigned int index) 523void 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
609abort: 614abort:
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;
716found: 721found:
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