aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-19 18:32:31 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-19 18:32:31 -0400
commitfd9bb53942a7ca3398a63f2c238afd8fbed3ec0e (patch)
treeeab9592f5bcbee89e0fdf9661e40a92d629d0a32 /drivers/ide/ide.c
parent438c470261036db25bfae15235ba99812e3dc763 (diff)
ide: add ->fixup method to ide_hwif_t
* Add ->fixup method to ide_hwif_t. * Set hwif->fixup in ide_pci_setup_ports() to d->fixup. * Use hwif->fixup in probe_hwif(). * Use probe_hwif_init() instead of probe_hwif_init_with_fixup() in ide_setup_pci_device(). * Add 'fixup' argument to ide_register_hw() and use it to set hwif->fixup, update all ide_register_hw() users accordingly. * Convert ide-cs/delkin_cb host drivers to use ide_register_hw(). * Restore hwif->fixup in ide_hwif_restore(). * Remove ide_register_hw_with_fixup(), probe_hwif_init_with_fixup() and 'fixup' argument from probe_hwif(). Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide.c')
-rw-r--r--drivers/ide/ide.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 961e6c897286..35f24b9b8219 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -391,6 +391,8 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif)
391 hwif->cds = tmp_hwif->cds; 391 hwif->cds = tmp_hwif->cds;
392#endif 392#endif
393 393
394 hwif->fixup = tmp_hwif->fixup;
395
394 hwif->set_pio_mode = tmp_hwif->set_pio_mode; 396 hwif->set_pio_mode = tmp_hwif->set_pio_mode;
395 hwif->set_dma_mode = tmp_hwif->set_dma_mode; 397 hwif->set_dma_mode = tmp_hwif->set_dma_mode;
396 hwif->mdma_filter = tmp_hwif->mdma_filter; 398 hwif->mdma_filter = tmp_hwif->mdma_filter;
@@ -660,11 +662,11 @@ void ide_setup_ports ( hw_regs_t *hw,
660} 662}
661 663
662/** 664/**
663 * ide_register_hw_with_fixup - register IDE interface 665 * ide_register_hw - register IDE interface
664 * @hw: hardware registers 666 * @hw: hardware registers
667 * @fixup: fixup function
665 * @initializing: set while initializing built-in drivers 668 * @initializing: set while initializing built-in drivers
666 * @hwifp: pointer to returned hwif 669 * @hwifp: pointer to returned hwif
667 * @fixup: fixup function
668 * 670 *
669 * Register an IDE interface, specifying exactly the registers etc. 671 * Register an IDE interface, specifying exactly the registers etc.
670 * Set init=1 iff calling before probes have taken place. 672 * Set init=1 iff calling before probes have taken place.
@@ -672,9 +674,8 @@ void ide_setup_ports ( hw_regs_t *hw,
672 * Returns -1 on error. 674 * Returns -1 on error.
673 */ 675 */
674 676
675int ide_register_hw_with_fixup(hw_regs_t *hw, int initializing, 677int ide_register_hw(hw_regs_t *hw, void (*fixup)(ide_hwif_t *),
676 ide_hwif_t **hwifp, 678 int initializing, ide_hwif_t **hwifp)
677 void(*fixup)(ide_hwif_t *hwif))
678{ 679{
679 int index, retry = 1; 680 int index, retry = 1;
680 ide_hwif_t *hwif; 681 ide_hwif_t *hwif;
@@ -710,11 +711,12 @@ found:
710 memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->hw.io_ports)); 711 memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->hw.io_ports));
711 hwif->irq = hw->irq; 712 hwif->irq = hw->irq;
712 hwif->noprobe = 0; 713 hwif->noprobe = 0;
714 hwif->fixup = fixup;
713 hwif->chipset = hw->chipset; 715 hwif->chipset = hw->chipset;
714 hwif->gendev.parent = hw->dev; 716 hwif->gendev.parent = hw->dev;
715 717
716 if (!initializing) { 718 if (!initializing) {
717 probe_hwif_init_with_fixup(hwif, fixup); 719 probe_hwif_init(hwif);
718 ide_proc_register_port(hwif); 720 ide_proc_register_port(hwif);
719 } 721 }
720 722
@@ -724,13 +726,6 @@ found:
724 return (initializing || hwif->present) ? index : -1; 726 return (initializing || hwif->present) ? index : -1;
725} 727}
726 728
727EXPORT_SYMBOL(ide_register_hw_with_fixup);
728
729int ide_register_hw(hw_regs_t *hw, int initializing, ide_hwif_t **hwifp)
730{
731 return ide_register_hw_with_fixup(hw, initializing, hwifp, NULL);
732}
733
734EXPORT_SYMBOL(ide_register_hw); 729EXPORT_SYMBOL(ide_register_hw);
735 730
736/* 731/*
@@ -1046,7 +1041,7 @@ int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device
1046 ide_init_hwif_ports(&hw, (unsigned long) args[0], 1041 ide_init_hwif_ports(&hw, (unsigned long) args[0],
1047 (unsigned long) args[1], NULL); 1042 (unsigned long) args[1], NULL);
1048 hw.irq = args[2]; 1043 hw.irq = args[2];
1049 if (ide_register_hw(&hw, 0, NULL) == -1) 1044 if (ide_register_hw(&hw, NULL, 0, NULL) == -1)
1050 return -EIO; 1045 return -EIO;
1051 return 0; 1046 return 0;
1052 } 1047 }