aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
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
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')
-rw-r--r--drivers/ide/arm/bast-ide.c2
-rw-r--r--drivers/ide/arm/ide_arm.c2
-rw-r--r--drivers/ide/cris/ide-cris.c2
-rw-r--r--drivers/ide/h8300/ide-h8300.c2
-rw-r--r--drivers/ide/ide-pnp.c2
-rw-r--r--drivers/ide/ide-probe.c17
-rw-r--r--drivers/ide/ide.c23
-rw-r--r--drivers/ide/legacy/buddha.c4
-rw-r--r--drivers/ide/legacy/falconide.c2
-rw-r--r--drivers/ide/legacy/gayle.c2
-rw-r--r--drivers/ide/legacy/ide-cs.c2
-rw-r--r--drivers/ide/legacy/macide.c6
-rw-r--r--drivers/ide/legacy/q40ide.c2
-rw-r--r--drivers/ide/pci/delkin_cb.c2
-rw-r--r--drivers/ide/setup-pci.c6
15 files changed, 34 insertions, 42 deletions
diff --git a/drivers/ide/arm/bast-ide.c b/drivers/ide/arm/bast-ide.c
index f7449d04114a..48db6167bb90 100644
--- a/drivers/ide/arm/bast-ide.c
+++ b/drivers/ide/arm/bast-ide.c
@@ -45,7 +45,7 @@ bastide_register(unsigned int base, unsigned int aux, int irq,
45 hw.io_ports[IDE_CONTROL_OFFSET] = aux + (6 * 0x20); 45 hw.io_ports[IDE_CONTROL_OFFSET] = aux + (6 * 0x20);
46 hw.irq = irq; 46 hw.irq = irq;
47 47
48 ide_register_hw(&hw, 0, hwif); 48 ide_register_hw(&hw, NULL, 0, hwif);
49 49
50 return 0; 50 return 0;
51} 51}
diff --git a/drivers/ide/arm/ide_arm.c b/drivers/ide/arm/ide_arm.c
index bce2bec81413..8957cbadf5c2 100644
--- a/drivers/ide/arm/ide_arm.c
+++ b/drivers/ide/arm/ide_arm.c
@@ -31,5 +31,5 @@ void __init ide_arm_init(void)
31 memset(&hw, 0, sizeof(hw)); 31 memset(&hw, 0, sizeof(hw));
32 ide_std_init_ports(&hw, IDE_ARM_IO, IDE_ARM_IO + 0x206); 32 ide_std_init_ports(&hw, IDE_ARM_IO, IDE_ARM_IO + 0x206);
33 hw.irq = IDE_ARM_IRQ; 33 hw.irq = IDE_ARM_IRQ;
34 ide_register_hw(&hw, 1, NULL); 34 ide_register_hw(&hw, NULL, 1, NULL);
35} 35}
diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c
index 9a96a10ba9d3..ff20377b4c82 100644
--- a/drivers/ide/cris/ide-cris.c
+++ b/drivers/ide/cris/ide-cris.c
@@ -782,7 +782,7 @@ init_e100_ide (void)
782 ide_offsets, 782 ide_offsets,
783 0, 0, cris_ide_ack_intr, 783 0, 0, cris_ide_ack_intr,
784 ide_default_irq(0)); 784 ide_default_irq(0));
785 ide_register_hw(&hw, 1, &hwif); 785 ide_register_hw(&hw, NULL, 1, &hwif);
786 hwif->mmio = 1; 786 hwif->mmio = 1;
787 hwif->chipset = ide_etrax100; 787 hwif->chipset = ide_etrax100;
788 hwif->set_pio_mode = &cris_set_pio_mode; 788 hwif->set_pio_mode = &cris_set_pio_mode;
diff --git a/drivers/ide/h8300/ide-h8300.c b/drivers/ide/h8300/ide-h8300.c
index 6d26ad7360d5..37b9174a7edc 100644
--- a/drivers/ide/h8300/ide-h8300.c
+++ b/drivers/ide/h8300/ide-h8300.c
@@ -101,7 +101,7 @@ void __init h8300_ide_init(void)
101 hw_setup(&hw); 101 hw_setup(&hw);
102 102
103 /* register if */ 103 /* register if */
104 idx = ide_register_hw(&hw, 1, &hwif); 104 idx = ide_register_hw(&hw, NULL, 1, &hwif);
105 if (idx == -1) { 105 if (idx == -1) {
106 printk(KERN_ERR "ide-h8300: IDE I/F register failed\n"); 106 printk(KERN_ERR "ide-h8300: IDE I/F register failed\n");
107 return; 107 return;
diff --git a/drivers/ide/ide-pnp.c b/drivers/ide/ide-pnp.c
index 2b8009c50e91..2afaa87022e3 100644
--- a/drivers/ide/ide-pnp.c
+++ b/drivers/ide/ide-pnp.c
@@ -42,7 +42,7 @@ static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id
42 hw.irq = pnp_irq(dev, 0); 42 hw.irq = pnp_irq(dev, 0);
43 hw.dma = NO_DMA; 43 hw.dma = NO_DMA;
44 44
45 index = ide_register_hw(&hw, 1, &hwif); 45 index = ide_register_hw(&hw, NULL, 1, &hwif);
46 46
47 if (index != -1) { 47 if (index != -1) {
48 printk(KERN_INFO "ide%d: generic PnP IDE interface\n", index); 48 printk(KERN_INFO "ide%d: generic PnP IDE interface\n", index);
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 549174853381..c6ba439b1435 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -717,7 +717,7 @@ EXPORT_SYMBOL_GPL(ide_undecoded_slave);
717 * This routine only knows how to look for drive units 0 and 1 717 * This routine only knows how to look for drive units 0 and 1
718 * on an interface, so any setting of MAX_DRIVES > 2 won't work here. 718 * on an interface, so any setting of MAX_DRIVES > 2 won't work here.
719 */ 719 */
720static void probe_hwif(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif)) 720static void probe_hwif(ide_hwif_t *hwif)
721{ 721{
722 unsigned long flags; 722 unsigned long flags;
723 unsigned int irqd; 723 unsigned int irqd;
@@ -819,8 +819,8 @@ static void probe_hwif(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif))
819 return; 819 return;
820 } 820 }
821 821
822 if (fixup) 822 if (hwif->fixup)
823 fixup(hwif); 823 hwif->fixup(hwif);
824 824
825 for (unit = 0; unit < MAX_DRIVES; ++unit) { 825 for (unit = 0; unit < MAX_DRIVES; ++unit) {
826 ide_drive_t *drive = &hwif->drives[unit]; 826 ide_drive_t *drive = &hwif->drives[unit];
@@ -861,9 +861,9 @@ static void probe_hwif(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif))
861static int hwif_init(ide_hwif_t *hwif); 861static int hwif_init(ide_hwif_t *hwif);
862static void hwif_register_devices(ide_hwif_t *hwif); 862static void hwif_register_devices(ide_hwif_t *hwif);
863 863
864int probe_hwif_init_with_fixup(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif)) 864int probe_hwif_init(ide_hwif_t *hwif)
865{ 865{
866 probe_hwif(hwif, fixup); 866 probe_hwif(hwif);
867 867
868 if (!hwif_init(hwif)) { 868 if (!hwif_init(hwif)) {
869 printk(KERN_INFO "%s: failed to initialize IDE interface\n", 869 printk(KERN_INFO "%s: failed to initialize IDE interface\n",
@@ -877,11 +877,6 @@ int probe_hwif_init_with_fixup(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif)
877 return 0; 877 return 0;
878} 878}
879 879
880int probe_hwif_init(ide_hwif_t *hwif)
881{
882 return probe_hwif_init_with_fixup(hwif, NULL);
883}
884
885EXPORT_SYMBOL(probe_hwif_init); 880EXPORT_SYMBOL(probe_hwif_init);
886 881
887#if MAX_HWIFS > 1 882#if MAX_HWIFS > 1
@@ -1394,7 +1389,7 @@ int ideprobe_init (void)
1394 1389
1395 for (index = 0; index < MAX_HWIFS; ++index) 1390 for (index = 0; index < MAX_HWIFS; ++index)
1396 if (probe[index]) 1391 if (probe[index])
1397 probe_hwif(&ide_hwifs[index], NULL); 1392 probe_hwif(&ide_hwifs[index]);
1398 for (index = 0; index < MAX_HWIFS; ++index) 1393 for (index = 0; index < MAX_HWIFS; ++index)
1399 if (probe[index]) 1394 if (probe[index])
1400 hwif_init(&ide_hwifs[index]); 1395 hwif_init(&ide_hwifs[index]);
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 }
diff --git a/drivers/ide/legacy/buddha.c b/drivers/ide/legacy/buddha.c
index 101aee1711c4..4a0be251a05f 100644
--- a/drivers/ide/legacy/buddha.c
+++ b/drivers/ide/legacy/buddha.c
@@ -212,8 +212,8 @@ fail_base2:
212// xsurf_iops, 212// xsurf_iops,
213 IRQ_AMIGA_PORTS); 213 IRQ_AMIGA_PORTS);
214 } 214 }
215 215
216 index = ide_register_hw(&hw, 1, &hwif); 216 index = ide_register_hw(&hw, NULL, 1, &hwif);
217 if (index != -1) { 217 if (index != -1) {
218 hwif->mmio = 1; 218 hwif->mmio = 1;
219 printk("ide%d: ", index); 219 printk("ide%d: ", index);
diff --git a/drivers/ide/legacy/falconide.c b/drivers/ide/legacy/falconide.c
index f0829b83e970..7d7936f1b900 100644
--- a/drivers/ide/legacy/falconide.c
+++ b/drivers/ide/legacy/falconide.c
@@ -72,7 +72,7 @@ void __init falconide_init(void)
72 0, 0, NULL, 72 0, 0, NULL,
73// falconide_iops, 73// falconide_iops,
74 IRQ_MFP_IDE); 74 IRQ_MFP_IDE);
75 index = ide_register_hw(&hw, 1, NULL); 75 index = ide_register_hw(&hw, NULL, 1, NULL);
76 76
77 if (index != -1) 77 if (index != -1)
78 printk("ide%d: Falcon IDE interface\n", index); 78 printk("ide%d: Falcon IDE interface\n", index);
diff --git a/drivers/ide/legacy/gayle.c b/drivers/ide/legacy/gayle.c
index 0830a021bbb6..53331ee1e957 100644
--- a/drivers/ide/legacy/gayle.c
+++ b/drivers/ide/legacy/gayle.c
@@ -165,7 +165,7 @@ found:
165// &gayle_iops, 165// &gayle_iops,
166 IRQ_AMIGA_PORTS); 166 IRQ_AMIGA_PORTS);
167 167
168 index = ide_register_hw(&hw, 1, &hwif); 168 index = ide_register_hw(&hw, NULL, 1, &hwif);
169 if (index != -1) { 169 if (index != -1) {
170 hwif->mmio = 1; 170 hwif->mmio = 1;
171 switch (i) { 171 switch (i) {
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c
index e8e360c2619d..03715c058664 100644
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -153,7 +153,7 @@ static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq
153 hw.irq = irq; 153 hw.irq = irq;
154 hw.chipset = ide_pci; 154 hw.chipset = ide_pci;
155 hw.dev = &handle->dev; 155 hw.dev = &handle->dev;
156 return ide_register_hw_with_fixup(&hw, 0, NULL, ide_undecoded_slave); 156 return ide_register_hw(&hw, &ide_undecoded_slave, 0, NULL);
157} 157}
158 158
159/*====================================================================== 159/*======================================================================
diff --git a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c
index b557c45a5a9d..e87cd2f16430 100644
--- a/drivers/ide/legacy/macide.c
+++ b/drivers/ide/legacy/macide.c
@@ -93,21 +93,21 @@ void macide_init(void)
93 0, 0, macide_ack_intr, 93 0, 0, macide_ack_intr,
94// quadra_ide_iops, 94// quadra_ide_iops,
95 IRQ_NUBUS_F); 95 IRQ_NUBUS_F);
96 index = ide_register_hw(&hw, 1, &hwif); 96 index = ide_register_hw(&hw, NULL, 1, &hwif);
97 break; 97 break;
98 case MAC_IDE_PB: 98 case MAC_IDE_PB:
99 ide_setup_ports(&hw, IDE_BASE, macide_offsets, 99 ide_setup_ports(&hw, IDE_BASE, macide_offsets,
100 0, 0, macide_ack_intr, 100 0, 0, macide_ack_intr,
101// macide_pb_iops, 101// macide_pb_iops,
102 IRQ_NUBUS_C); 102 IRQ_NUBUS_C);
103 index = ide_register_hw(&hw, 1, &hwif); 103 index = ide_register_hw(&hw, NULL, 1, &hwif);
104 break; 104 break;
105 case MAC_IDE_BABOON: 105 case MAC_IDE_BABOON:
106 ide_setup_ports(&hw, BABOON_BASE, macide_offsets, 106 ide_setup_ports(&hw, BABOON_BASE, macide_offsets,
107 0, 0, NULL, 107 0, 0, NULL,
108// macide_baboon_iops, 108// macide_baboon_iops,
109 IRQ_BABOON_1); 109 IRQ_BABOON_1);
110 index = ide_register_hw(&hw, 1, &hwif); 110 index = ide_register_hw(&hw, NULL, 1, &hwif);
111 if (index == -1) break; 111 if (index == -1) break;
112 if (macintosh_config->ident == MAC_MODEL_PB190) { 112 if (macintosh_config->ident == MAC_MODEL_PB190) {
113 113
diff --git a/drivers/ide/legacy/q40ide.c b/drivers/ide/legacy/q40ide.c
index e628a983ce33..a530d6de194a 100644
--- a/drivers/ide/legacy/q40ide.c
+++ b/drivers/ide/legacy/q40ide.c
@@ -142,7 +142,7 @@ void q40ide_init(void)
142 0, NULL, 142 0, NULL,
143// m68kide_iops, 143// m68kide_iops,
144 q40ide_default_irq(pcide_bases[i])); 144 q40ide_default_irq(pcide_bases[i]));
145 index = ide_register_hw(&hw, 1, &hwif); 145 index = ide_register_hw(&hw, NULL, 1, &hwif);
146 // **FIXME** 146 // **FIXME**
147 if (index != -1) 147 if (index != -1)
148 hwif->mmio = 1; 148 hwif->mmio = 1;
diff --git a/drivers/ide/pci/delkin_cb.c b/drivers/ide/pci/delkin_cb.c
index 46f4a888c037..83829081640a 100644
--- a/drivers/ide/pci/delkin_cb.c
+++ b/drivers/ide/pci/delkin_cb.c
@@ -80,7 +80,7 @@ delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id)
80 hw.irq = dev->irq; 80 hw.irq = dev->irq;
81 hw.chipset = ide_pci; /* this enables IRQ sharing */ 81 hw.chipset = ide_pci; /* this enables IRQ sharing */
82 82
83 rc = ide_register_hw_with_fixup(&hw, 0, &hwif, ide_undecoded_slave); 83 rc = ide_register_hw(&hw, &ide_undecoded_slave, 0, &hwif);
84 if (rc < 0) { 84 if (rc < 0) {
85 printk(KERN_ERR "delkin_cb: ide_register_hw failed (%d)\n", rc); 85 printk(KERN_ERR "delkin_cb: ide_register_hw failed (%d)\n", rc);
86 pci_disable_device(dev); 86 pci_disable_device(dev);
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index d62b225f569f..4e9de2043113 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -567,6 +567,8 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a
567 (d->host_flags & IDE_HFLAG_FORCE_LEGACY_IRQS)) 567 (d->host_flags & IDE_HFLAG_FORCE_LEGACY_IRQS))
568 hwif->irq = port ? 15 : 14; 568 hwif->irq = port ? 15 : 14;
569 569
570 hwif->fixup = d->fixup;
571
570 hwif->host_flags = d->host_flags; 572 hwif->host_flags = d->host_flags;
571 hwif->pio_mask = d->pio_mask; 573 hwif->pio_mask = d->pio_mask;
572 574
@@ -692,9 +694,9 @@ int ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d)
692 mate = &ide_hwifs[index_list.b.high]; 694 mate = &ide_hwifs[index_list.b.high];
693 695
694 if (hwif) 696 if (hwif)
695 probe_hwif_init_with_fixup(hwif, d->fixup); 697 probe_hwif_init(hwif);
696 if (mate) 698 if (mate)
697 probe_hwif_init_with_fixup(mate, d->fixup); 699 probe_hwif_init(mate);
698 700
699 if (hwif) 701 if (hwif)
700 ide_proc_register_port(hwif); 702 ide_proc_register_port(hwif);