diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-02-01 17:09:31 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-02-01 17:09:31 -0500 |
commit | 36501650ec45b1db308c3b51886044863be2d762 (patch) | |
tree | 74cf9d9f313e510f8424f9bac35da8d61cce9f7b | |
parent | f6fb786d6dcdd7d730e4fba620b071796f487e1b (diff) |
ide: keep pointer to struct device instead of struct pci_dev in ide_hwif_t
Keep pointer to struct device instead of struct pci_dev in ide_hwif_t.
While on it:
* Use *dev->dma_mask instead of pci_dev->dma_mask in ide_toggle_bounce().
There should be no functionality changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
38 files changed, 236 insertions, 182 deletions
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 1ca1210ec1c0..782e5da01578 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c | |||
@@ -184,6 +184,7 @@ static int ide_dma_good_drive(ide_drive_t *drive) | |||
184 | int ide_build_sglist(ide_drive_t *drive, struct request *rq) | 184 | int ide_build_sglist(ide_drive_t *drive, struct request *rq) |
185 | { | 185 | { |
186 | ide_hwif_t *hwif = HWIF(drive); | 186 | ide_hwif_t *hwif = HWIF(drive); |
187 | struct pci_dev *pdev = to_pci_dev(hwif->dev); | ||
187 | struct scatterlist *sg = hwif->sg_table; | 188 | struct scatterlist *sg = hwif->sg_table; |
188 | 189 | ||
189 | ide_map_sg(drive, rq); | 190 | ide_map_sg(drive, rq); |
@@ -193,7 +194,7 @@ int ide_build_sglist(ide_drive_t *drive, struct request *rq) | |||
193 | else | 194 | else |
194 | hwif->sg_dma_direction = PCI_DMA_TODEVICE; | 195 | hwif->sg_dma_direction = PCI_DMA_TODEVICE; |
195 | 196 | ||
196 | return pci_map_sg(hwif->pci_dev, sg, hwif->sg_nents, hwif->sg_dma_direction); | 197 | return pci_map_sg(pdev, sg, hwif->sg_nents, hwif->sg_dma_direction); |
197 | } | 198 | } |
198 | 199 | ||
199 | EXPORT_SYMBOL_GPL(ide_build_sglist); | 200 | EXPORT_SYMBOL_GPL(ide_build_sglist); |
@@ -306,11 +307,11 @@ EXPORT_SYMBOL_GPL(ide_build_dmatable); | |||
306 | 307 | ||
307 | void ide_destroy_dmatable (ide_drive_t *drive) | 308 | void ide_destroy_dmatable (ide_drive_t *drive) |
308 | { | 309 | { |
309 | struct pci_dev *dev = HWIF(drive)->pci_dev; | 310 | ide_hwif_t *hwif = drive->hwif; |
310 | struct scatterlist *sg = HWIF(drive)->sg_table; | 311 | struct pci_dev *pdev = to_pci_dev(hwif->dev); |
311 | int nents = HWIF(drive)->sg_nents; | ||
312 | 312 | ||
313 | pci_unmap_sg(dev, sg, nents, HWIF(drive)->sg_dma_direction); | 313 | pci_unmap_sg(pdev, hwif->sg_table, hwif->sg_nents, |
314 | hwif->sg_dma_direction); | ||
314 | } | 315 | } |
315 | 316 | ||
316 | EXPORT_SYMBOL_GPL(ide_destroy_dmatable); | 317 | EXPORT_SYMBOL_GPL(ide_destroy_dmatable); |
@@ -843,10 +844,10 @@ EXPORT_SYMBOL(ide_dma_timeout); | |||
843 | static void ide_release_dma_engine(ide_hwif_t *hwif) | 844 | static void ide_release_dma_engine(ide_hwif_t *hwif) |
844 | { | 845 | { |
845 | if (hwif->dmatable_cpu) { | 846 | if (hwif->dmatable_cpu) { |
846 | pci_free_consistent(hwif->pci_dev, | 847 | struct pci_dev *pdev = to_pci_dev(hwif->dev); |
847 | PRD_ENTRIES * PRD_BYTES, | 848 | |
848 | hwif->dmatable_cpu, | 849 | pci_free_consistent(pdev, PRD_ENTRIES * PRD_BYTES, |
849 | hwif->dmatable_dma); | 850 | hwif->dmatable_cpu, hwif->dmatable_dma); |
850 | hwif->dmatable_cpu = NULL; | 851 | hwif->dmatable_cpu = NULL; |
851 | } | 852 | } |
852 | } | 853 | } |
@@ -874,7 +875,9 @@ int ide_release_dma(ide_hwif_t *hwif) | |||
874 | 875 | ||
875 | static int ide_allocate_dma_engine(ide_hwif_t *hwif) | 876 | static int ide_allocate_dma_engine(ide_hwif_t *hwif) |
876 | { | 877 | { |
877 | hwif->dmatable_cpu = pci_alloc_consistent(hwif->pci_dev, | 878 | struct pci_dev *pdev = to_pci_dev(hwif->dev); |
879 | |||
880 | hwif->dmatable_cpu = pci_alloc_consistent(pdev, | ||
878 | PRD_ENTRIES * PRD_BYTES, | 881 | PRD_ENTRIES * PRD_BYTES, |
879 | &hwif->dmatable_dma); | 882 | &hwif->dmatable_dma); |
880 | 883 | ||
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index 9b44fbdfe41f..b42940d8bf70 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c | |||
@@ -358,8 +358,10 @@ void ide_toggle_bounce(ide_drive_t *drive, int on) | |||
358 | if (!PCI_DMA_BUS_IS_PHYS) { | 358 | if (!PCI_DMA_BUS_IS_PHYS) { |
359 | addr = BLK_BOUNCE_ANY; | 359 | addr = BLK_BOUNCE_ANY; |
360 | } else if (on && drive->media == ide_disk) { | 360 | } else if (on && drive->media == ide_disk) { |
361 | if (HWIF(drive)->pci_dev) | 361 | struct device *dev = drive->hwif->dev; |
362 | addr = HWIF(drive)->pci_dev->dma_mask; | 362 | |
363 | if (dev && dev->dma_mask) | ||
364 | addr = *dev->dma_mask; | ||
363 | } | 365 | } |
364 | 366 | ||
365 | if (drive->queue) | 367 | if (drive->queue) |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index cdb81471102a..5141730dc960 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -622,8 +622,8 @@ static void hwif_register (ide_hwif_t *hwif) | |||
622 | strlcpy(hwif->gendev.bus_id,hwif->name,BUS_ID_SIZE); | 622 | strlcpy(hwif->gendev.bus_id,hwif->name,BUS_ID_SIZE); |
623 | hwif->gendev.driver_data = hwif; | 623 | hwif->gendev.driver_data = hwif; |
624 | if (hwif->gendev.parent == NULL) { | 624 | if (hwif->gendev.parent == NULL) { |
625 | if (hwif->pci_dev) | 625 | if (hwif->dev) |
626 | hwif->gendev.parent = &hwif->pci_dev->dev; | 626 | hwif->gendev.parent = hwif->dev; |
627 | else | 627 | else |
628 | /* Would like to do = &device_legacy */ | 628 | /* Would like to do = &device_legacy */ |
629 | hwif->gendev.parent = NULL; | 629 | hwif->gendev.parent = NULL; |
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 97894abd9ebc..9805c43dfd8a 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
@@ -405,8 +405,9 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif) | |||
405 | hwif->chipset = tmp_hwif->chipset; | 405 | hwif->chipset = tmp_hwif->chipset; |
406 | hwif->hold = tmp_hwif->hold; | 406 | hwif->hold = tmp_hwif->hold; |
407 | 407 | ||
408 | hwif->dev = tmp_hwif->dev; | ||
409 | |||
408 | #ifdef CONFIG_BLK_DEV_IDEPCI | 410 | #ifdef CONFIG_BLK_DEV_IDEPCI |
409 | hwif->pci_dev = tmp_hwif->pci_dev; | ||
410 | hwif->cds = tmp_hwif->cds; | 411 | hwif->cds = tmp_hwif->cds; |
411 | #endif | 412 | #endif |
412 | 413 | ||
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c index 15597597740f..28401701b8d0 100644 --- a/drivers/ide/pci/aec62xx.c +++ b/drivers/ide/pci/aec62xx.c | |||
@@ -90,7 +90,7 @@ static u8 pci_bus_clock_list_ultra (u8 speed, struct chipset_bus_clock_list_entr | |||
90 | static void aec6210_set_mode(ide_drive_t *drive, const u8 speed) | 90 | static void aec6210_set_mode(ide_drive_t *drive, const u8 speed) |
91 | { | 91 | { |
92 | ide_hwif_t *hwif = HWIF(drive); | 92 | ide_hwif_t *hwif = HWIF(drive); |
93 | struct pci_dev *dev = hwif->pci_dev; | 93 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
94 | u16 d_conf = 0; | 94 | u16 d_conf = 0; |
95 | u8 ultra = 0, ultra_conf = 0; | 95 | u8 ultra = 0, ultra_conf = 0; |
96 | u8 tmp0 = 0, tmp1 = 0, tmp2 = 0; | 96 | u8 tmp0 = 0, tmp1 = 0, tmp2 = 0; |
@@ -116,7 +116,7 @@ static void aec6210_set_mode(ide_drive_t *drive, const u8 speed) | |||
116 | static void aec6260_set_mode(ide_drive_t *drive, const u8 speed) | 116 | static void aec6260_set_mode(ide_drive_t *drive, const u8 speed) |
117 | { | 117 | { |
118 | ide_hwif_t *hwif = HWIF(drive); | 118 | ide_hwif_t *hwif = HWIF(drive); |
119 | struct pci_dev *dev = hwif->pci_dev; | 119 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
120 | u8 unit = (drive->select.b.unit & 0x01); | 120 | u8 unit = (drive->select.b.unit & 0x01); |
121 | u8 tmp1 = 0, tmp2 = 0; | 121 | u8 tmp1 = 0, tmp2 = 0; |
122 | u8 ultra = 0, drive_conf = 0, ultra_conf = 0; | 122 | u8 ultra = 0, drive_conf = 0, ultra_conf = 0; |
@@ -170,7 +170,7 @@ static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const ch | |||
170 | 170 | ||
171 | static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif) | 171 | static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif) |
172 | { | 172 | { |
173 | struct pci_dev *dev = hwif->pci_dev; | 173 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
174 | 174 | ||
175 | hwif->set_pio_mode = &aec_set_pio_mode; | 175 | hwif->set_pio_mode = &aec_set_pio_mode; |
176 | 176 | ||
@@ -188,7 +188,7 @@ static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif) | |||
188 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) { | 188 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) { |
189 | u8 ata66 = 0, mask = hwif->channel ? 0x02 : 0x01; | 189 | u8 ata66 = 0, mask = hwif->channel ? 0x02 : 0x01; |
190 | 190 | ||
191 | pci_read_config_byte(hwif->pci_dev, 0x49, &ata66); | 191 | pci_read_config_byte(dev, 0x49, &ata66); |
192 | 192 | ||
193 | hwif->cbl = (ata66 & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; | 193 | hwif->cbl = (ata66 & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; |
194 | } | 194 | } |
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index 0b65a2c9308f..88148404d918 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c | |||
@@ -293,7 +293,7 @@ static int ali_get_info (char *buffer, char **addr, off_t offset, int count) | |||
293 | static void ali_set_pio_mode(ide_drive_t *drive, const u8 pio) | 293 | static void ali_set_pio_mode(ide_drive_t *drive, const u8 pio) |
294 | { | 294 | { |
295 | ide_hwif_t *hwif = HWIF(drive); | 295 | ide_hwif_t *hwif = HWIF(drive); |
296 | struct pci_dev *dev = hwif->pci_dev; | 296 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
297 | int s_time, a_time, c_time; | 297 | int s_time, a_time, c_time; |
298 | u8 s_clc, a_clc, r_clc; | 298 | u8 s_clc, a_clc, r_clc; |
299 | unsigned long flags; | 299 | unsigned long flags; |
@@ -396,7 +396,7 @@ static u8 ali_udma_filter(ide_drive_t *drive) | |||
396 | static void ali_set_dma_mode(ide_drive_t *drive, const u8 speed) | 396 | static void ali_set_dma_mode(ide_drive_t *drive, const u8 speed) |
397 | { | 397 | { |
398 | ide_hwif_t *hwif = HWIF(drive); | 398 | ide_hwif_t *hwif = HWIF(drive); |
399 | struct pci_dev *dev = hwif->pci_dev; | 399 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
400 | u8 speed1 = speed; | 400 | u8 speed1 = speed; |
401 | u8 unit = (drive->select.b.unit & 0x01); | 401 | u8 unit = (drive->select.b.unit & 0x01); |
402 | u8 tmpbyte = 0x00; | 402 | u8 tmpbyte = 0x00; |
@@ -625,7 +625,7 @@ static int ali_cable_override(struct pci_dev *pdev) | |||
625 | 625 | ||
626 | static u8 __devinit ata66_ali15x3(ide_hwif_t *hwif) | 626 | static u8 __devinit ata66_ali15x3(ide_hwif_t *hwif) |
627 | { | 627 | { |
628 | struct pci_dev *dev = hwif->pci_dev; | 628 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
629 | unsigned long flags; | 629 | unsigned long flags; |
630 | u8 cbl = ATA_CBL_PATA40, tmpbyte; | 630 | u8 cbl = ATA_CBL_PATA40, tmpbyte; |
631 | 631 | ||
@@ -688,12 +688,13 @@ static void __devinit init_hwif_common_ali15x3 (ide_hwif_t *hwif) | |||
688 | 688 | ||
689 | static void __devinit init_hwif_ali15x3 (ide_hwif_t *hwif) | 689 | static void __devinit init_hwif_ali15x3 (ide_hwif_t *hwif) |
690 | { | 690 | { |
691 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
691 | u8 ideic, inmir; | 692 | u8 ideic, inmir; |
692 | s8 irq_routing_table[] = { -1, 9, 3, 10, 4, 5, 7, 6, | 693 | s8 irq_routing_table[] = { -1, 9, 3, 10, 4, 5, 7, 6, |
693 | 1, 11, 0, 12, 0, 14, 0, 15 }; | 694 | 1, 11, 0, 12, 0, 14, 0, 15 }; |
694 | int irq = -1; | 695 | int irq = -1; |
695 | 696 | ||
696 | if (hwif->pci_dev->device == PCI_DEVICE_ID_AL_M5229) | 697 | if (dev->device == PCI_DEVICE_ID_AL_M5229) |
697 | hwif->irq = hwif->channel ? 15 : 14; | 698 | hwif->irq = hwif->channel ? 15 : 14; |
698 | 699 | ||
699 | if (isa_dev) { | 700 | if (isa_dev) { |
diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c index 2e8cbcaf3ef5..ebc16deffe16 100644 --- a/drivers/ide/pci/amd74xx.c +++ b/drivers/ide/pci/amd74xx.c | |||
@@ -86,6 +86,7 @@ static void amd_set_speed(struct pci_dev *dev, u8 dn, u8 udma_mask, | |||
86 | static void amd_set_drive(ide_drive_t *drive, const u8 speed) | 86 | static void amd_set_drive(ide_drive_t *drive, const u8 speed) |
87 | { | 87 | { |
88 | ide_hwif_t *hwif = drive->hwif; | 88 | ide_hwif_t *hwif = drive->hwif; |
89 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
89 | ide_drive_t *peer = hwif->drives + (~drive->dn & 1); | 90 | ide_drive_t *peer = hwif->drives + (~drive->dn & 1); |
90 | struct ide_timing t, p; | 91 | struct ide_timing t, p; |
91 | int T, UT; | 92 | int T, UT; |
@@ -104,7 +105,7 @@ static void amd_set_drive(ide_drive_t *drive, const u8 speed) | |||
104 | if (speed == XFER_UDMA_5 && amd_clock <= 33333) t.udma = 1; | 105 | if (speed == XFER_UDMA_5 && amd_clock <= 33333) t.udma = 1; |
105 | if (speed == XFER_UDMA_6 && amd_clock <= 33333) t.udma = 15; | 106 | if (speed == XFER_UDMA_6 && amd_clock <= 33333) t.udma = 15; |
106 | 107 | ||
107 | amd_set_speed(hwif->pci_dev, drive->dn, udma_mask, &t); | 108 | amd_set_speed(dev, drive->dn, udma_mask, &t); |
108 | } | 109 | } |
109 | 110 | ||
110 | /* | 111 | /* |
@@ -202,8 +203,10 @@ static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev, | |||
202 | 203 | ||
203 | static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) | 204 | static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) |
204 | { | 205 | { |
206 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
207 | |||
205 | if (hwif->irq == 0) /* 0 is bogus but will do for now */ | 208 | if (hwif->irq == 0) /* 0 is bogus but will do for now */ |
206 | hwif->irq = pci_get_legacy_ide_irq(hwif->pci_dev, hwif->channel); | 209 | hwif->irq = pci_get_legacy_ide_irq(dev, hwif->channel); |
207 | 210 | ||
208 | hwif->set_pio_mode = &amd_set_pio_mode; | 211 | hwif->set_pio_mode = &amd_set_pio_mode; |
209 | hwif->set_dma_mode = &amd_set_drive; | 212 | hwif->set_dma_mode = &amd_set_drive; |
diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c index 491871984aaa..ab856d3583e1 100644 --- a/drivers/ide/pci/atiixp.c +++ b/drivers/ide/pci/atiixp.c | |||
@@ -55,7 +55,7 @@ static DEFINE_SPINLOCK(atiixp_lock); | |||
55 | 55 | ||
56 | static void atiixp_set_pio_mode(ide_drive_t *drive, const u8 pio) | 56 | static void atiixp_set_pio_mode(ide_drive_t *drive, const u8 pio) |
57 | { | 57 | { |
58 | struct pci_dev *dev = drive->hwif->pci_dev; | 58 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
59 | unsigned long flags; | 59 | unsigned long flags; |
60 | int timing_shift = (drive->dn & 2) ? 16 : 0 + (drive->dn & 1) ? 0 : 8; | 60 | int timing_shift = (drive->dn & 2) ? 16 : 0 + (drive->dn & 1) ? 0 : 8; |
61 | u32 pio_timing_data; | 61 | u32 pio_timing_data; |
@@ -88,7 +88,7 @@ static void atiixp_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
88 | 88 | ||
89 | static void atiixp_set_dma_mode(ide_drive_t *drive, const u8 speed) | 89 | static void atiixp_set_dma_mode(ide_drive_t *drive, const u8 speed) |
90 | { | 90 | { |
91 | struct pci_dev *dev = drive->hwif->pci_dev; | 91 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
92 | unsigned long flags; | 92 | unsigned long flags; |
93 | int timing_shift = (drive->dn & 2) ? 16 : 0 + (drive->dn & 1) ? 0 : 8; | 93 | int timing_shift = (drive->dn & 2) ? 16 : 0 + (drive->dn & 1) ? 0 : 8; |
94 | u32 tmp32; | 94 | u32 tmp32; |
@@ -133,9 +133,8 @@ static void atiixp_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
133 | 133 | ||
134 | static void __devinit init_hwif_atiixp(ide_hwif_t *hwif) | 134 | static void __devinit init_hwif_atiixp(ide_hwif_t *hwif) |
135 | { | 135 | { |
136 | u8 udma_mode = 0; | 136 | struct pci_dev *pdev = to_pci_dev(hwif->dev); |
137 | u8 ch = hwif->channel; | 137 | u8 udma_mode = 0, ch = hwif->channel; |
138 | struct pci_dev *pdev = hwif->pci_dev; | ||
139 | 138 | ||
140 | hwif->set_pio_mode = &atiixp_set_pio_mode; | 139 | hwif->set_pio_mode = &atiixp_set_pio_mode; |
141 | hwif->set_dma_mode = &atiixp_set_dma_mode; | 140 | hwif->set_dma_mode = &atiixp_set_dma_mode; |
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c index effd79a715b0..70265d5c59ba 100644 --- a/drivers/ide/pci/cmd64x.c +++ b/drivers/ide/pci/cmd64x.c | |||
@@ -71,7 +71,7 @@ static u8 quantize_timing(int timing, int quant) | |||
71 | */ | 71 | */ |
72 | static void program_cycle_times (ide_drive_t *drive, int cycle_time, int active_time) | 72 | static void program_cycle_times (ide_drive_t *drive, int cycle_time, int active_time) |
73 | { | 73 | { |
74 | struct pci_dev *dev = HWIF(drive)->pci_dev; | 74 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
75 | int clock_time = 1000 / system_bus_clock(); | 75 | int clock_time = 1000 / system_bus_clock(); |
76 | u8 cycle_count, active_count, recovery_count, drwtim; | 76 | u8 cycle_count, active_count, recovery_count, drwtim; |
77 | static const u8 recovery_values[] = | 77 | static const u8 recovery_values[] = |
@@ -118,7 +118,7 @@ static void program_cycle_times (ide_drive_t *drive, int cycle_time, int active_ | |||
118 | static void cmd64x_tune_pio(ide_drive_t *drive, const u8 pio) | 118 | static void cmd64x_tune_pio(ide_drive_t *drive, const u8 pio) |
119 | { | 119 | { |
120 | ide_hwif_t *hwif = HWIF(drive); | 120 | ide_hwif_t *hwif = HWIF(drive); |
121 | struct pci_dev *dev = hwif->pci_dev; | 121 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
122 | unsigned int cycle_time; | 122 | unsigned int cycle_time; |
123 | u8 setup_count, arttim = 0; | 123 | u8 setup_count, arttim = 0; |
124 | 124 | ||
@@ -183,7 +183,7 @@ static void cmd64x_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
183 | static void cmd64x_set_dma_mode(ide_drive_t *drive, const u8 speed) | 183 | static void cmd64x_set_dma_mode(ide_drive_t *drive, const u8 speed) |
184 | { | 184 | { |
185 | ide_hwif_t *hwif = HWIF(drive); | 185 | ide_hwif_t *hwif = HWIF(drive); |
186 | struct pci_dev *dev = hwif->pci_dev; | 186 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
187 | u8 unit = drive->dn & 0x01; | 187 | u8 unit = drive->dn & 0x01; |
188 | u8 regU = 0, pciU = hwif->channel ? UDIDETCR1 : UDIDETCR0; | 188 | u8 regU = 0, pciU = hwif->channel ? UDIDETCR1 : UDIDETCR0; |
189 | 189 | ||
@@ -245,7 +245,7 @@ static int cmd648_ide_dma_end (ide_drive_t *drive) | |||
245 | static int cmd64x_ide_dma_end (ide_drive_t *drive) | 245 | static int cmd64x_ide_dma_end (ide_drive_t *drive) |
246 | { | 246 | { |
247 | ide_hwif_t *hwif = HWIF(drive); | 247 | ide_hwif_t *hwif = HWIF(drive); |
248 | struct pci_dev *dev = hwif->pci_dev; | 248 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
249 | int irq_reg = hwif->channel ? ARTTIM23 : CFR; | 249 | int irq_reg = hwif->channel ? ARTTIM23 : CFR; |
250 | u8 irq_mask = hwif->channel ? ARTTIM23_INTR_CH1 : | 250 | u8 irq_mask = hwif->channel ? ARTTIM23_INTR_CH1 : |
251 | CFR_INTR_CH0; | 251 | CFR_INTR_CH0; |
@@ -285,7 +285,7 @@ static int cmd648_ide_dma_test_irq (ide_drive_t *drive) | |||
285 | static int cmd64x_ide_dma_test_irq (ide_drive_t *drive) | 285 | static int cmd64x_ide_dma_test_irq (ide_drive_t *drive) |
286 | { | 286 | { |
287 | ide_hwif_t *hwif = HWIF(drive); | 287 | ide_hwif_t *hwif = HWIF(drive); |
288 | struct pci_dev *dev = hwif->pci_dev; | 288 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
289 | int irq_reg = hwif->channel ? ARTTIM23 : CFR; | 289 | int irq_reg = hwif->channel ? ARTTIM23 : CFR; |
290 | u8 irq_mask = hwif->channel ? ARTTIM23_INTR_CH1 : | 290 | u8 irq_mask = hwif->channel ? ARTTIM23_INTR_CH1 : |
291 | CFR_INTR_CH0; | 291 | CFR_INTR_CH0; |
@@ -375,7 +375,7 @@ static unsigned int __devinit init_chipset_cmd64x(struct pci_dev *dev, const cha | |||
375 | 375 | ||
376 | static u8 __devinit ata66_cmd64x(ide_hwif_t *hwif) | 376 | static u8 __devinit ata66_cmd64x(ide_hwif_t *hwif) |
377 | { | 377 | { |
378 | struct pci_dev *dev = hwif->pci_dev; | 378 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
379 | u8 bmidecsr = 0, mask = hwif->channel ? 0x02 : 0x01; | 379 | u8 bmidecsr = 0, mask = hwif->channel ? 0x02 : 0x01; |
380 | 380 | ||
381 | switch (dev->device) { | 381 | switch (dev->device) { |
@@ -390,7 +390,7 @@ static u8 __devinit ata66_cmd64x(ide_hwif_t *hwif) | |||
390 | 390 | ||
391 | static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif) | 391 | static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif) |
392 | { | 392 | { |
393 | struct pci_dev *dev = hwif->pci_dev; | 393 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
394 | 394 | ||
395 | hwif->set_pio_mode = &cmd64x_set_pio_mode; | 395 | hwif->set_pio_mode = &cmd64x_set_pio_mode; |
396 | hwif->set_dma_mode = &cmd64x_set_dma_mode; | 396 | hwif->set_dma_mode = &cmd64x_set_dma_mode; |
diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c index 6ec00b8d7ec1..9e01c6dc758e 100644 --- a/drivers/ide/pci/cs5520.c +++ b/drivers/ide/pci/cs5520.c | |||
@@ -69,7 +69,7 @@ static struct pio_clocks cs5520_pio_clocks[]={ | |||
69 | static void cs5520_set_pio_mode(ide_drive_t *drive, const u8 pio) | 69 | static void cs5520_set_pio_mode(ide_drive_t *drive, const u8 pio) |
70 | { | 70 | { |
71 | ide_hwif_t *hwif = HWIF(drive); | 71 | ide_hwif_t *hwif = HWIF(drive); |
72 | struct pci_dev *pdev = hwif->pci_dev; | 72 | struct pci_dev *pdev = to_pci_dev(hwif->dev); |
73 | int controller = drive->dn > 1 ? 1 : 0; | 73 | int controller = drive->dn > 1 ? 1 : 0; |
74 | 74 | ||
75 | /* FIXME: if DMA = 1 do we need to set the DMA bit here ? */ | 75 | /* FIXME: if DMA = 1 do we need to set the DMA bit here ? */ |
diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c index 50b3d7791f55..e44011481fa6 100644 --- a/drivers/ide/pci/cs5535.c +++ b/drivers/ide/pci/cs5535.c | |||
@@ -177,13 +177,15 @@ static u8 __devinit cs5535_cable_detect(struct pci_dev *dev) | |||
177 | */ | 177 | */ |
178 | static void __devinit init_hwif_cs5535(ide_hwif_t *hwif) | 178 | static void __devinit init_hwif_cs5535(ide_hwif_t *hwif) |
179 | { | 179 | { |
180 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
181 | |||
180 | hwif->set_pio_mode = &cs5535_set_pio_mode; | 182 | hwif->set_pio_mode = &cs5535_set_pio_mode; |
181 | hwif->set_dma_mode = &cs5535_set_dma_mode; | 183 | hwif->set_dma_mode = &cs5535_set_dma_mode; |
182 | 184 | ||
183 | if (hwif->dma_base == 0) | 185 | if (hwif->dma_base == 0) |
184 | return; | 186 | return; |
185 | 187 | ||
186 | hwif->cbl = cs5535_cable_detect(hwif->pci_dev); | 188 | hwif->cbl = cs5535_cable_detect(dev); |
187 | } | 189 | } |
188 | 190 | ||
189 | static const struct ide_port_info cs5535_chipset __devinitdata = { | 191 | static const struct ide_port_info cs5535_chipset __devinitdata = { |
diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c index 3ec4c659a37d..d43c52da4906 100644 --- a/drivers/ide/pci/cy82c693.c +++ b/drivers/ide/pci/cy82c693.c | |||
@@ -228,7 +228,7 @@ static void cy82c693_set_dma_mode(ide_drive_t *drive, const u8 mode) | |||
228 | static void cy82c693_set_pio_mode(ide_drive_t *drive, const u8 pio) | 228 | static void cy82c693_set_pio_mode(ide_drive_t *drive, const u8 pio) |
229 | { | 229 | { |
230 | ide_hwif_t *hwif = HWIF(drive); | 230 | ide_hwif_t *hwif = HWIF(drive); |
231 | struct pci_dev *dev = hwif->pci_dev; | 231 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
232 | pio_clocks_t pclk; | 232 | pio_clocks_t pclk; |
233 | unsigned int addrCtrl; | 233 | unsigned int addrCtrl; |
234 | 234 | ||
@@ -397,8 +397,9 @@ static void __devinit init_hwif_cy82c693(ide_hwif_t *hwif) | |||
397 | static void __devinit init_iops_cy82c693(ide_hwif_t *hwif) | 397 | static void __devinit init_iops_cy82c693(ide_hwif_t *hwif) |
398 | { | 398 | { |
399 | static ide_hwif_t *primary; | 399 | static ide_hwif_t *primary; |
400 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
400 | 401 | ||
401 | if (PCI_FUNC(hwif->pci_dev->devfn) == 1) | 402 | if (PCI_FUNC(dev->devfn) == 1) |
402 | primary = hwif; | 403 | primary = hwif; |
403 | else { | 404 | else { |
404 | hwif->mate = primary; | 405 | hwif->mate = primary; |
diff --git a/drivers/ide/pci/delkin_cb.c b/drivers/ide/pci/delkin_cb.c index 26aa492071bb..81d0bf6fcc60 100644 --- a/drivers/ide/pci/delkin_cb.c +++ b/drivers/ide/pci/delkin_cb.c | |||
@@ -87,7 +87,7 @@ delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id) | |||
87 | return -ENODEV; | 87 | return -ENODEV; |
88 | } | 88 | } |
89 | pci_set_drvdata(dev, hwif); | 89 | pci_set_drvdata(dev, hwif); |
90 | hwif->pci_dev = dev; | 90 | hwif->dev = &dev->dev; |
91 | drive = &hwif->drives[0]; | 91 | drive = &hwif->drives[0]; |
92 | if (drive->present) { | 92 | if (drive->present) { |
93 | drive->io_32bit = 1; | 93 | drive->io_32bit = 1; |
diff --git a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c index 48a9ff2e8c33..7f6abc68c0bb 100644 --- a/drivers/ide/pci/hpt34x.c +++ b/drivers/ide/pci/hpt34x.c | |||
@@ -45,7 +45,7 @@ | |||
45 | 45 | ||
46 | static void hpt34x_set_mode(ide_drive_t *drive, const u8 speed) | 46 | static void hpt34x_set_mode(ide_drive_t *drive, const u8 speed) |
47 | { | 47 | { |
48 | struct pci_dev *dev = HWIF(drive)->pci_dev; | 48 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
49 | u32 reg1= 0, tmp1 = 0, reg2 = 0, tmp2 = 0; | 49 | u32 reg1= 0, tmp1 = 0, reg2 = 0, tmp2 = 0; |
50 | u8 hi_speed, lo_speed; | 50 | u8 hi_speed, lo_speed; |
51 | 51 | ||
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c index d33a3f9c12b7..7429a55c164e 100644 --- a/drivers/ide/pci/hpt366.c +++ b/drivers/ide/pci/hpt366.c | |||
@@ -626,7 +626,8 @@ static int check_in_drive_list(ide_drive_t *drive, const char **list) | |||
626 | static u8 hpt3xx_udma_filter(ide_drive_t *drive) | 626 | static u8 hpt3xx_udma_filter(ide_drive_t *drive) |
627 | { | 627 | { |
628 | ide_hwif_t *hwif = HWIF(drive); | 628 | ide_hwif_t *hwif = HWIF(drive); |
629 | struct hpt_info *info = pci_get_drvdata(hwif->pci_dev); | 629 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
630 | struct hpt_info *info = pci_get_drvdata(dev); | ||
630 | u8 mask = hwif->ultra_mask; | 631 | u8 mask = hwif->ultra_mask; |
631 | 632 | ||
632 | switch (info->chip_type) { | 633 | switch (info->chip_type) { |
@@ -665,7 +666,8 @@ static u8 hpt3xx_udma_filter(ide_drive_t *drive) | |||
665 | static u8 hpt3xx_mdma_filter(ide_drive_t *drive) | 666 | static u8 hpt3xx_mdma_filter(ide_drive_t *drive) |
666 | { | 667 | { |
667 | ide_hwif_t *hwif = HWIF(drive); | 668 | ide_hwif_t *hwif = HWIF(drive); |
668 | struct hpt_info *info = pci_get_drvdata(hwif->pci_dev); | 669 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
670 | struct hpt_info *info = pci_get_drvdata(dev); | ||
669 | 671 | ||
670 | switch (info->chip_type) { | 672 | switch (info->chip_type) { |
671 | case HPT372 : | 673 | case HPT372 : |
@@ -699,7 +701,7 @@ static u32 get_speed_setting(u8 speed, struct hpt_info *info) | |||
699 | 701 | ||
700 | static void hpt3xx_set_mode(ide_drive_t *drive, const u8 speed) | 702 | static void hpt3xx_set_mode(ide_drive_t *drive, const u8 speed) |
701 | { | 703 | { |
702 | struct pci_dev *dev = HWIF(drive)->pci_dev; | 704 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
703 | struct hpt_info *info = pci_get_drvdata(dev); | 705 | struct hpt_info *info = pci_get_drvdata(dev); |
704 | struct hpt_timings *t = info->timings; | 706 | struct hpt_timings *t = info->timings; |
705 | u8 itr_addr = 0x40 + (drive->dn * 4); | 707 | u8 itr_addr = 0x40 + (drive->dn * 4); |
@@ -742,7 +744,7 @@ static void hpt3xx_quirkproc(ide_drive_t *drive) | |||
742 | static void hpt3xx_maskproc(ide_drive_t *drive, int mask) | 744 | static void hpt3xx_maskproc(ide_drive_t *drive, int mask) |
743 | { | 745 | { |
744 | ide_hwif_t *hwif = HWIF(drive); | 746 | ide_hwif_t *hwif = HWIF(drive); |
745 | struct pci_dev *dev = hwif->pci_dev; | 747 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
746 | struct hpt_info *info = pci_get_drvdata(dev); | 748 | struct hpt_info *info = pci_get_drvdata(dev); |
747 | 749 | ||
748 | if (drive->quirk_list) { | 750 | if (drive->quirk_list) { |
@@ -774,7 +776,7 @@ static void hpt3xx_maskproc(ide_drive_t *drive, int mask) | |||
774 | */ | 776 | */ |
775 | static void hpt366_dma_lost_irq(ide_drive_t *drive) | 777 | static void hpt366_dma_lost_irq(ide_drive_t *drive) |
776 | { | 778 | { |
777 | struct pci_dev *dev = HWIF(drive)->pci_dev; | 779 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
778 | u8 mcr1 = 0, mcr3 = 0, scr1 = 0; | 780 | u8 mcr1 = 0, mcr3 = 0, scr1 = 0; |
779 | 781 | ||
780 | pci_read_config_byte(dev, 0x50, &mcr1); | 782 | pci_read_config_byte(dev, 0x50, &mcr1); |
@@ -790,18 +792,20 @@ static void hpt366_dma_lost_irq(ide_drive_t *drive) | |||
790 | static void hpt370_clear_engine(ide_drive_t *drive) | 792 | static void hpt370_clear_engine(ide_drive_t *drive) |
791 | { | 793 | { |
792 | ide_hwif_t *hwif = HWIF(drive); | 794 | ide_hwif_t *hwif = HWIF(drive); |
795 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
793 | 796 | ||
794 | pci_write_config_byte(hwif->pci_dev, hwif->select_data, 0x37); | 797 | pci_write_config_byte(dev, hwif->select_data, 0x37); |
795 | udelay(10); | 798 | udelay(10); |
796 | } | 799 | } |
797 | 800 | ||
798 | static void hpt370_irq_timeout(ide_drive_t *drive) | 801 | static void hpt370_irq_timeout(ide_drive_t *drive) |
799 | { | 802 | { |
800 | ide_hwif_t *hwif = HWIF(drive); | 803 | ide_hwif_t *hwif = HWIF(drive); |
804 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
801 | u16 bfifo = 0; | 805 | u16 bfifo = 0; |
802 | u8 dma_cmd; | 806 | u8 dma_cmd; |
803 | 807 | ||
804 | pci_read_config_word(hwif->pci_dev, hwif->select_data + 2, &bfifo); | 808 | pci_read_config_word(dev, hwif->select_data + 2, &bfifo); |
805 | printk(KERN_DEBUG "%s: %d bytes in FIFO\n", drive->name, bfifo & 0x1ff); | 809 | printk(KERN_DEBUG "%s: %d bytes in FIFO\n", drive->name, bfifo & 0x1ff); |
806 | 810 | ||
807 | /* get DMA command mode */ | 811 | /* get DMA command mode */ |
@@ -844,10 +848,11 @@ static void hpt370_dma_timeout(ide_drive_t *drive) | |||
844 | static int hpt374_ide_dma_test_irq(ide_drive_t *drive) | 848 | static int hpt374_ide_dma_test_irq(ide_drive_t *drive) |
845 | { | 849 | { |
846 | ide_hwif_t *hwif = HWIF(drive); | 850 | ide_hwif_t *hwif = HWIF(drive); |
851 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
847 | u16 bfifo = 0; | 852 | u16 bfifo = 0; |
848 | u8 dma_stat; | 853 | u8 dma_stat; |
849 | 854 | ||
850 | pci_read_config_word(hwif->pci_dev, hwif->select_data + 2, &bfifo); | 855 | pci_read_config_word(dev, hwif->select_data + 2, &bfifo); |
851 | if (bfifo & 0x1FF) { | 856 | if (bfifo & 0x1FF) { |
852 | // printk("%s: %d bytes in FIFO\n", drive->name, bfifo); | 857 | // printk("%s: %d bytes in FIFO\n", drive->name, bfifo); |
853 | return 0; | 858 | return 0; |
@@ -867,7 +872,7 @@ static int hpt374_ide_dma_test_irq(ide_drive_t *drive) | |||
867 | static int hpt374_ide_dma_end(ide_drive_t *drive) | 872 | static int hpt374_ide_dma_end(ide_drive_t *drive) |
868 | { | 873 | { |
869 | ide_hwif_t *hwif = HWIF(drive); | 874 | ide_hwif_t *hwif = HWIF(drive); |
870 | struct pci_dev *dev = hwif->pci_dev; | 875 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
871 | u8 mcr = 0, mcr_addr = hwif->select_data; | 876 | u8 mcr = 0, mcr_addr = hwif->select_data; |
872 | u8 bwsr = 0, mask = hwif->channel ? 0x02 : 0x01; | 877 | u8 bwsr = 0, mask = hwif->channel ? 0x02 : 0x01; |
873 | 878 | ||
@@ -942,7 +947,7 @@ static void hpt3xxn_rw_disk(ide_drive_t *drive, struct request *rq) | |||
942 | static int hpt3xx_busproc(ide_drive_t *drive, int state) | 947 | static int hpt3xx_busproc(ide_drive_t *drive, int state) |
943 | { | 948 | { |
944 | ide_hwif_t *hwif = HWIF(drive); | 949 | ide_hwif_t *hwif = HWIF(drive); |
945 | struct pci_dev *dev = hwif->pci_dev; | 950 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
946 | u8 mcr_addr = hwif->select_data + 2; | 951 | u8 mcr_addr = hwif->select_data + 2; |
947 | u8 resetmask = hwif->channel ? 0x80 : 0x40; | 952 | u8 resetmask = hwif->channel ? 0x80 : 0x40; |
948 | u8 bsr2 = 0; | 953 | u8 bsr2 = 0; |
@@ -1278,7 +1283,7 @@ static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev, const cha | |||
1278 | 1283 | ||
1279 | static void __devinit init_hwif_hpt366(ide_hwif_t *hwif) | 1284 | static void __devinit init_hwif_hpt366(ide_hwif_t *hwif) |
1280 | { | 1285 | { |
1281 | struct pci_dev *dev = hwif->pci_dev; | 1286 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
1282 | struct hpt_info *info = pci_get_drvdata(dev); | 1287 | struct hpt_info *info = pci_get_drvdata(dev); |
1283 | int serialize = HPT_SERIALIZE_IO; | 1288 | int serialize = HPT_SERIALIZE_IO; |
1284 | u8 scr1 = 0, ata66 = hwif->channel ? 0x01 : 0x02; | 1289 | u8 scr1 = 0, ata66 = hwif->channel ? 0x01 : 0x02; |
@@ -1393,7 +1398,7 @@ static void __devinit init_hwif_hpt366(ide_hwif_t *hwif) | |||
1393 | 1398 | ||
1394 | static void __devinit init_dma_hpt366(ide_hwif_t *hwif, unsigned long dmabase) | 1399 | static void __devinit init_dma_hpt366(ide_hwif_t *hwif, unsigned long dmabase) |
1395 | { | 1400 | { |
1396 | struct pci_dev *dev = hwif->pci_dev; | 1401 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
1397 | u8 masterdma = 0, slavedma = 0; | 1402 | u8 masterdma = 0, slavedma = 0; |
1398 | u8 dma_new = 0, dma_old = 0; | 1403 | u8 dma_new = 0, dma_old = 0; |
1399 | unsigned long flags; | 1404 | unsigned long flags; |
diff --git a/drivers/ide/pci/it8213.c b/drivers/ide/pci/it8213.c index 2a0f45c4f4c4..df74e588a530 100644 --- a/drivers/ide/pci/it8213.c +++ b/drivers/ide/pci/it8213.c | |||
@@ -28,7 +28,7 @@ | |||
28 | static void it8213_set_pio_mode(ide_drive_t *drive, const u8 pio) | 28 | static void it8213_set_pio_mode(ide_drive_t *drive, const u8 pio) |
29 | { | 29 | { |
30 | ide_hwif_t *hwif = HWIF(drive); | 30 | ide_hwif_t *hwif = HWIF(drive); |
31 | struct pci_dev *dev = hwif->pci_dev; | 31 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
32 | int is_slave = drive->dn & 1; | 32 | int is_slave = drive->dn & 1; |
33 | int master_port = 0x40; | 33 | int master_port = 0x40; |
34 | int slave_port = 0x44; | 34 | int slave_port = 0x44; |
@@ -85,7 +85,7 @@ static void it8213_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
85 | static void it8213_set_dma_mode(ide_drive_t *drive, const u8 speed) | 85 | static void it8213_set_dma_mode(ide_drive_t *drive, const u8 speed) |
86 | { | 86 | { |
87 | ide_hwif_t *hwif = HWIF(drive); | 87 | ide_hwif_t *hwif = HWIF(drive); |
88 | struct pci_dev *dev = hwif->pci_dev; | 88 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
89 | u8 maslave = 0x40; | 89 | u8 maslave = 0x40; |
90 | int a_speed = 3 << (drive->dn * 4); | 90 | int a_speed = 3 << (drive->dn * 4); |
91 | int u_flag = 1 << drive->dn; | 91 | int u_flag = 1 << drive->dn; |
@@ -152,6 +152,7 @@ static void it8213_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
152 | 152 | ||
153 | static void __devinit init_hwif_it8213(ide_hwif_t *hwif) | 153 | static void __devinit init_hwif_it8213(ide_hwif_t *hwif) |
154 | { | 154 | { |
155 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
155 | u8 reg42h = 0; | 156 | u8 reg42h = 0; |
156 | 157 | ||
157 | hwif->set_dma_mode = &it8213_set_dma_mode; | 158 | hwif->set_dma_mode = &it8213_set_dma_mode; |
@@ -160,7 +161,7 @@ static void __devinit init_hwif_it8213(ide_hwif_t *hwif) | |||
160 | if (!hwif->dma_base) | 161 | if (!hwif->dma_base) |
161 | return; | 162 | return; |
162 | 163 | ||
163 | pci_read_config_byte(hwif->pci_dev, 0x42, ®42h); | 164 | pci_read_config_byte(dev, 0x42, ®42h); |
164 | 165 | ||
165 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) | 166 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) |
166 | hwif->cbl = (reg42h & 0x02) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; | 167 | hwif->cbl = (reg42h & 0x02) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; |
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c index e610a5340fdc..c0797b82ce78 100644 --- a/drivers/ide/pci/it821x.c +++ b/drivers/ide/pci/it821x.c | |||
@@ -113,7 +113,8 @@ static int it8212_noraid; | |||
113 | 113 | ||
114 | static void it821x_program(ide_drive_t *drive, u16 timing) | 114 | static void it821x_program(ide_drive_t *drive, u16 timing) |
115 | { | 115 | { |
116 | ide_hwif_t *hwif = drive->hwif; | 116 | ide_hwif_t *hwif = drive->hwif; |
117 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
117 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); | 118 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); |
118 | int channel = hwif->channel; | 119 | int channel = hwif->channel; |
119 | u8 conf; | 120 | u8 conf; |
@@ -123,7 +124,8 @@ static void it821x_program(ide_drive_t *drive, u16 timing) | |||
123 | conf = timing >> 8; | 124 | conf = timing >> 8; |
124 | else | 125 | else |
125 | conf = timing & 0xFF; | 126 | conf = timing & 0xFF; |
126 | pci_write_config_byte(hwif->pci_dev, 0x54 + 4 * channel, conf); | 127 | |
128 | pci_write_config_byte(dev, 0x54 + 4 * channel, conf); | ||
127 | } | 129 | } |
128 | 130 | ||
129 | /** | 131 | /** |
@@ -137,7 +139,8 @@ static void it821x_program(ide_drive_t *drive, u16 timing) | |||
137 | 139 | ||
138 | static void it821x_program_udma(ide_drive_t *drive, u16 timing) | 140 | static void it821x_program_udma(ide_drive_t *drive, u16 timing) |
139 | { | 141 | { |
140 | ide_hwif_t *hwif = drive->hwif; | 142 | ide_hwif_t *hwif = drive->hwif; |
143 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
141 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); | 144 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); |
142 | int channel = hwif->channel; | 145 | int channel = hwif->channel; |
143 | int unit = drive->select.b.unit; | 146 | int unit = drive->select.b.unit; |
@@ -148,11 +151,12 @@ static void it821x_program_udma(ide_drive_t *drive, u16 timing) | |||
148 | conf = timing >> 8; | 151 | conf = timing >> 8; |
149 | else | 152 | else |
150 | conf = timing & 0xFF; | 153 | conf = timing & 0xFF; |
151 | if(itdev->timing10 == 0) | 154 | |
152 | pci_write_config_byte(hwif->pci_dev, 0x56 + 4 * channel + unit, conf); | 155 | if (itdev->timing10 == 0) |
156 | pci_write_config_byte(dev, 0x56 + 4 * channel + unit, conf); | ||
153 | else { | 157 | else { |
154 | pci_write_config_byte(hwif->pci_dev, 0x56 + 4 * channel, conf); | 158 | pci_write_config_byte(dev, 0x56 + 4 * channel, conf); |
155 | pci_write_config_byte(hwif->pci_dev, 0x56 + 4 * channel + 1, conf); | 159 | pci_write_config_byte(dev, 0x56 + 4 * channel + 1, conf); |
156 | } | 160 | } |
157 | } | 161 | } |
158 | 162 | ||
@@ -167,6 +171,7 @@ static void it821x_program_udma(ide_drive_t *drive, u16 timing) | |||
167 | static void it821x_clock_strategy(ide_drive_t *drive) | 171 | static void it821x_clock_strategy(ide_drive_t *drive) |
168 | { | 172 | { |
169 | ide_hwif_t *hwif = drive->hwif; | 173 | ide_hwif_t *hwif = drive->hwif; |
174 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
170 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); | 175 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); |
171 | 176 | ||
172 | u8 unit = drive->select.b.unit; | 177 | u8 unit = drive->select.b.unit; |
@@ -205,10 +210,11 @@ static void it821x_clock_strategy(ide_drive_t *drive) | |||
205 | itdev->clock_mode = ATA_50; | 210 | itdev->clock_mode = ATA_50; |
206 | sel = 1; | 211 | sel = 1; |
207 | } | 212 | } |
208 | pci_read_config_byte(hwif->pci_dev, 0x50, &v); | 213 | |
214 | pci_read_config_byte(dev, 0x50, &v); | ||
209 | v &= ~(1 << (1 + hwif->channel)); | 215 | v &= ~(1 << (1 + hwif->channel)); |
210 | v |= sel << (1 + hwif->channel); | 216 | v |= sel << (1 + hwif->channel); |
211 | pci_write_config_byte(hwif->pci_dev, 0x50, v); | 217 | pci_write_config_byte(dev, 0x50, v); |
212 | 218 | ||
213 | /* | 219 | /* |
214 | * Reprogram the UDMA/PIO of the pair drive for the switch | 220 | * Reprogram the UDMA/PIO of the pair drive for the switch |
@@ -282,7 +288,8 @@ static void it821x_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
282 | 288 | ||
283 | static void it821x_tune_mwdma (ide_drive_t *drive, byte mode_wanted) | 289 | static void it821x_tune_mwdma (ide_drive_t *drive, byte mode_wanted) |
284 | { | 290 | { |
285 | ide_hwif_t *hwif = drive->hwif; | 291 | ide_hwif_t *hwif = drive->hwif; |
292 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
286 | struct it821x_dev *itdev = (void *)ide_get_hwifdata(hwif); | 293 | struct it821x_dev *itdev = (void *)ide_get_hwifdata(hwif); |
287 | int unit = drive->select.b.unit; | 294 | int unit = drive->select.b.unit; |
288 | int channel = hwif->channel; | 295 | int channel = hwif->channel; |
@@ -297,12 +304,12 @@ static void it821x_tune_mwdma (ide_drive_t *drive, byte mode_wanted) | |||
297 | itdev->udma[unit] = UDMA_OFF; | 304 | itdev->udma[unit] = UDMA_OFF; |
298 | 305 | ||
299 | /* UDMA bits off - Revision 0x10 do them in pairs */ | 306 | /* UDMA bits off - Revision 0x10 do them in pairs */ |
300 | pci_read_config_byte(hwif->pci_dev, 0x50, &conf); | 307 | pci_read_config_byte(dev, 0x50, &conf); |
301 | if(itdev->timing10) | 308 | if (itdev->timing10) |
302 | conf |= channel ? 0x60: 0x18; | 309 | conf |= channel ? 0x60: 0x18; |
303 | else | 310 | else |
304 | conf |= 1 << (3 + 2 * channel + unit); | 311 | conf |= 1 << (3 + 2 * channel + unit); |
305 | pci_write_config_byte(hwif->pci_dev, 0x50, conf); | 312 | pci_write_config_byte(dev, 0x50, conf); |
306 | 313 | ||
307 | it821x_clock_strategy(drive); | 314 | it821x_clock_strategy(drive); |
308 | /* FIXME: do we need to program this ? */ | 315 | /* FIXME: do we need to program this ? */ |
@@ -320,7 +327,8 @@ static void it821x_tune_mwdma (ide_drive_t *drive, byte mode_wanted) | |||
320 | 327 | ||
321 | static void it821x_tune_udma (ide_drive_t *drive, byte mode_wanted) | 328 | static void it821x_tune_udma (ide_drive_t *drive, byte mode_wanted) |
322 | { | 329 | { |
323 | ide_hwif_t *hwif = drive->hwif; | 330 | ide_hwif_t *hwif = drive->hwif; |
331 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
324 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); | 332 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); |
325 | int unit = drive->select.b.unit; | 333 | int unit = drive->select.b.unit; |
326 | int channel = hwif->channel; | 334 | int channel = hwif->channel; |
@@ -337,12 +345,12 @@ static void it821x_tune_udma (ide_drive_t *drive, byte mode_wanted) | |||
337 | itdev->udma[unit] |= 0x8080; /* UDMA 5/6 select on */ | 345 | itdev->udma[unit] |= 0x8080; /* UDMA 5/6 select on */ |
338 | 346 | ||
339 | /* UDMA on. Again revision 0x10 must do the pair */ | 347 | /* UDMA on. Again revision 0x10 must do the pair */ |
340 | pci_read_config_byte(hwif->pci_dev, 0x50, &conf); | 348 | pci_read_config_byte(dev, 0x50, &conf); |
341 | if(itdev->timing10) | 349 | if (itdev->timing10) |
342 | conf &= channel ? 0x9F: 0xE7; | 350 | conf &= channel ? 0x9F: 0xE7; |
343 | else | 351 | else |
344 | conf &= ~ (1 << (3 + 2 * channel + unit)); | 352 | conf &= ~ (1 << (3 + 2 * channel + unit)); |
345 | pci_write_config_byte(hwif->pci_dev, 0x50, conf); | 353 | pci_write_config_byte(dev, 0x50, conf); |
346 | 354 | ||
347 | it821x_clock_strategy(drive); | 355 | it821x_clock_strategy(drive); |
348 | it821x_program_udma(drive, itdev->udma[unit]); | 356 | it821x_program_udma(drive, itdev->udma[unit]); |
@@ -520,6 +528,7 @@ static void __devinit it821x_quirkproc(ide_drive_t *drive) | |||
520 | 528 | ||
521 | static void __devinit init_hwif_it821x(ide_hwif_t *hwif) | 529 | static void __devinit init_hwif_it821x(ide_hwif_t *hwif) |
522 | { | 530 | { |
531 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
523 | struct it821x_dev *idev = kzalloc(sizeof(struct it821x_dev), GFP_KERNEL); | 532 | struct it821x_dev *idev = kzalloc(sizeof(struct it821x_dev), GFP_KERNEL); |
524 | u8 conf; | 533 | u8 conf; |
525 | 534 | ||
@@ -532,7 +541,7 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif) | |||
532 | 541 | ||
533 | ide_set_hwifdata(hwif, idev); | 542 | ide_set_hwifdata(hwif, idev); |
534 | 543 | ||
535 | pci_read_config_byte(hwif->pci_dev, 0x50, &conf); | 544 | pci_read_config_byte(dev, 0x50, &conf); |
536 | if (conf & 1) { | 545 | if (conf & 1) { |
537 | idev->smart = 1; | 546 | idev->smart = 1; |
538 | hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; | 547 | hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; |
@@ -555,7 +564,7 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif) | |||
555 | * this is necessary. | 564 | * this is necessary. |
556 | */ | 565 | */ |
557 | 566 | ||
558 | pci_read_config_byte(hwif->pci_dev, 0x08, &conf); | 567 | pci_read_config_byte(dev, 0x08, &conf); |
559 | if (conf == 0x10) { | 568 | if (conf == 0x10) { |
560 | idev->timing10 = 1; | 569 | idev->timing10 = 1; |
561 | hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; | 570 | hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; |
diff --git a/drivers/ide/pci/jmicron.c b/drivers/ide/pci/jmicron.c index 0083eaf89c77..8b40f6479c55 100644 --- a/drivers/ide/pci/jmicron.c +++ b/drivers/ide/pci/jmicron.c | |||
@@ -30,7 +30,7 @@ typedef enum { | |||
30 | 30 | ||
31 | static u8 __devinit ata66_jmicron(ide_hwif_t *hwif) | 31 | static u8 __devinit ata66_jmicron(ide_hwif_t *hwif) |
32 | { | 32 | { |
33 | struct pci_dev *pdev = hwif->pci_dev; | 33 | struct pci_dev *pdev = to_pci_dev(hwif->dev); |
34 | 34 | ||
35 | u32 control; | 35 | u32 control; |
36 | u32 control5; | 36 | u32 control5; |
diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c index d4df4642dbb5..bd05a4aae61b 100644 --- a/drivers/ide/pci/ns87415.c +++ b/drivers/ide/pci/ns87415.c | |||
@@ -71,10 +71,9 @@ static u8 superio_ide_inb (unsigned long port) | |||
71 | 71 | ||
72 | static void __devinit superio_ide_init_iops (struct hwif_s *hwif) | 72 | static void __devinit superio_ide_init_iops (struct hwif_s *hwif) |
73 | { | 73 | { |
74 | struct pci_dev *pdev = to_pci_dev(hwif->dev); | ||
74 | u32 base, dmabase; | 75 | u32 base, dmabase; |
75 | u8 tmp; | 76 | u8 port = hwif->channel, tmp; |
76 | struct pci_dev *pdev = hwif->pci_dev; | ||
77 | u8 port = hwif->channel; | ||
78 | 77 | ||
79 | base = pci_resource_start(pdev, port * 2) & ~3; | 78 | base = pci_resource_start(pdev, port * 2) & ~3; |
80 | dmabase = pci_resource_start(pdev, 4) & ~3; | 79 | dmabase = pci_resource_start(pdev, 4) & ~3; |
@@ -93,10 +92,11 @@ static void __devinit superio_ide_init_iops (struct hwif_s *hwif) | |||
93 | 92 | ||
94 | static void __devinit init_iops_ns87415(ide_hwif_t *hwif) | 93 | static void __devinit init_iops_ns87415(ide_hwif_t *hwif) |
95 | { | 94 | { |
96 | if (PCI_SLOT(hwif->pci_dev->devfn) == 0xE) { | 95 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
96 | |||
97 | if (PCI_SLOT(dev->devfn) == 0xE) | ||
97 | /* Built-in - assume it's under superio. */ | 98 | /* Built-in - assume it's under superio. */ |
98 | superio_ide_init_iops(hwif); | 99 | superio_ide_init_iops(hwif); |
99 | } | ||
100 | } | 100 | } |
101 | #endif | 101 | #endif |
102 | 102 | ||
@@ -110,8 +110,8 @@ static unsigned int ns87415_count = 0, ns87415_control[MAX_HWIFS] = { 0 }; | |||
110 | static void ns87415_prepare_drive (ide_drive_t *drive, unsigned int use_dma) | 110 | static void ns87415_prepare_drive (ide_drive_t *drive, unsigned int use_dma) |
111 | { | 111 | { |
112 | ide_hwif_t *hwif = HWIF(drive); | 112 | ide_hwif_t *hwif = HWIF(drive); |
113 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
113 | unsigned int bit, other, new, *old = (unsigned int *) hwif->select_data; | 114 | unsigned int bit, other, new, *old = (unsigned int *) hwif->select_data; |
114 | struct pci_dev *dev = hwif->pci_dev; | ||
115 | unsigned long flags; | 115 | unsigned long flags; |
116 | 116 | ||
117 | local_irq_save(flags); | 117 | local_irq_save(flags); |
@@ -189,7 +189,7 @@ static int ns87415_ide_dma_setup(ide_drive_t *drive) | |||
189 | 189 | ||
190 | static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) | 190 | static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) |
191 | { | 191 | { |
192 | struct pci_dev *dev = hwif->pci_dev; | 192 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
193 | unsigned int ctrl, using_inta; | 193 | unsigned int ctrl, using_inta; |
194 | u8 progif; | 194 | u8 progif; |
195 | #ifdef __sparc_v9__ | 195 | #ifdef __sparc_v9__ |
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c index 89d2363a1ebd..bb29db03540e 100644 --- a/drivers/ide/pci/pdc202xx_new.c +++ b/drivers/ide/pci/pdc202xx_new.c | |||
@@ -149,6 +149,7 @@ static struct udma_timing { | |||
149 | static void pdcnew_set_dma_mode(ide_drive_t *drive, const u8 speed) | 149 | static void pdcnew_set_dma_mode(ide_drive_t *drive, const u8 speed) |
150 | { | 150 | { |
151 | ide_hwif_t *hwif = HWIF(drive); | 151 | ide_hwif_t *hwif = HWIF(drive); |
152 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
152 | u8 adj = (drive->dn & 1) ? 0x08 : 0x00; | 153 | u8 adj = (drive->dn & 1) ? 0x08 : 0x00; |
153 | 154 | ||
154 | /* | 155 | /* |
@@ -159,7 +160,7 @@ static void pdcnew_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
159 | * As we set up the PLL to output 133 MHz for UltraDMA/133 capable | 160 | * As we set up the PLL to output 133 MHz for UltraDMA/133 capable |
160 | * chips, we must override the default register settings... | 161 | * chips, we must override the default register settings... |
161 | */ | 162 | */ |
162 | if (max_dma_rate(hwif->pci_dev) == 4) { | 163 | if (max_dma_rate(dev) == 4) { |
163 | u8 mode = speed & 0x07; | 164 | u8 mode = speed & 0x07; |
164 | 165 | ||
165 | if (speed >= XFER_UDMA_0) { | 166 | if (speed >= XFER_UDMA_0) { |
@@ -186,9 +187,10 @@ static void pdcnew_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
186 | static void pdcnew_set_pio_mode(ide_drive_t *drive, const u8 pio) | 187 | static void pdcnew_set_pio_mode(ide_drive_t *drive, const u8 pio) |
187 | { | 188 | { |
188 | ide_hwif_t *hwif = drive->hwif; | 189 | ide_hwif_t *hwif = drive->hwif; |
190 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
189 | u8 adj = (drive->dn & 1) ? 0x08 : 0x00; | 191 | u8 adj = (drive->dn & 1) ? 0x08 : 0x00; |
190 | 192 | ||
191 | if (max_dma_rate(hwif->pci_dev) == 4) { | 193 | if (max_dma_rate(dev) == 4) { |
192 | set_indexed_reg(hwif, 0x0c + adj, pio_timings[pio].reg0c); | 194 | set_indexed_reg(hwif, 0x0c + adj, pio_timings[pio].reg0c); |
193 | set_indexed_reg(hwif, 0x0d + adj, pio_timings[pio].reg0d); | 195 | set_indexed_reg(hwif, 0x0d + adj, pio_timings[pio].reg0d); |
194 | set_indexed_reg(hwif, 0x13 + adj, pio_timings[pio].reg13); | 196 | set_indexed_reg(hwif, 0x13 + adj, pio_timings[pio].reg13); |
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c index ea66383c5579..df1c5fa44a7c 100644 --- a/drivers/ide/pci/pdc202xx_old.c +++ b/drivers/ide/pci/pdc202xx_old.c | |||
@@ -66,7 +66,7 @@ static void pdc_old_disable_66MHz_clock(ide_hwif_t *); | |||
66 | static void pdc202xx_set_mode(ide_drive_t *drive, const u8 speed) | 66 | static void pdc202xx_set_mode(ide_drive_t *drive, const u8 speed) |
67 | { | 67 | { |
68 | ide_hwif_t *hwif = HWIF(drive); | 68 | ide_hwif_t *hwif = HWIF(drive); |
69 | struct pci_dev *dev = hwif->pci_dev; | 69 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
70 | u8 drive_pci = 0x60 + (drive->dn << 2); | 70 | u8 drive_pci = 0x60 + (drive->dn << 2); |
71 | 71 | ||
72 | u8 AP = 0, BP = 0, CP = 0; | 72 | u8 AP = 0, BP = 0, CP = 0; |
@@ -144,9 +144,10 @@ static void pdc202xx_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
144 | 144 | ||
145 | static u8 pdc202xx_old_cable_detect (ide_hwif_t *hwif) | 145 | static u8 pdc202xx_old_cable_detect (ide_hwif_t *hwif) |
146 | { | 146 | { |
147 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
147 | u16 CIS = 0, mask = (hwif->channel) ? (1<<11) : (1<<10); | 148 | u16 CIS = 0, mask = (hwif->channel) ? (1<<11) : (1<<10); |
148 | 149 | ||
149 | pci_read_config_word(hwif->pci_dev, 0x50, &CIS); | 150 | pci_read_config_word(dev, 0x50, &CIS); |
150 | 151 | ||
151 | return (CIS & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; | 152 | return (CIS & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; |
152 | } | 153 | } |
@@ -305,12 +306,14 @@ static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev, | |||
305 | 306 | ||
306 | static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif) | 307 | static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif) |
307 | { | 308 | { |
309 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
310 | |||
308 | hwif->set_pio_mode = &pdc202xx_set_pio_mode; | 311 | hwif->set_pio_mode = &pdc202xx_set_pio_mode; |
309 | hwif->set_dma_mode = &pdc202xx_set_mode; | 312 | hwif->set_dma_mode = &pdc202xx_set_mode; |
310 | 313 | ||
311 | hwif->quirkproc = &pdc202xx_quirkproc; | 314 | hwif->quirkproc = &pdc202xx_quirkproc; |
312 | 315 | ||
313 | if (hwif->pci_dev->device != PCI_DEVICE_ID_PROMISE_20246) | 316 | if (dev->device != PCI_DEVICE_ID_PROMISE_20246) |
314 | hwif->resetproc = &pdc202xx_reset; | 317 | hwif->resetproc = &pdc202xx_reset; |
315 | 318 | ||
316 | if (hwif->dma_base == 0) | 319 | if (hwif->dma_base == 0) |
@@ -319,7 +322,7 @@ static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif) | |||
319 | hwif->dma_lost_irq = &pdc202xx_dma_lost_irq; | 322 | hwif->dma_lost_irq = &pdc202xx_dma_lost_irq; |
320 | hwif->dma_timeout = &pdc202xx_dma_timeout; | 323 | hwif->dma_timeout = &pdc202xx_dma_timeout; |
321 | 324 | ||
322 | if (hwif->pci_dev->device != PCI_DEVICE_ID_PROMISE_20246) { | 325 | if (dev->device != PCI_DEVICE_ID_PROMISE_20246) { |
323 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) | 326 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) |
324 | hwif->cbl = pdc202xx_old_cable_detect(hwif); | 327 | hwif->cbl = pdc202xx_old_cable_detect(hwif); |
325 | 328 | ||
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c index 70dc8792b44c..715cfd201847 100644 --- a/drivers/ide/pci/piix.c +++ b/drivers/ide/pci/piix.c | |||
@@ -71,7 +71,7 @@ static int no_piix_dma; | |||
71 | static void piix_set_pio_mode(ide_drive_t *drive, const u8 pio) | 71 | static void piix_set_pio_mode(ide_drive_t *drive, const u8 pio) |
72 | { | 72 | { |
73 | ide_hwif_t *hwif = HWIF(drive); | 73 | ide_hwif_t *hwif = HWIF(drive); |
74 | struct pci_dev *dev = hwif->pci_dev; | 74 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
75 | int is_slave = drive->dn & 1; | 75 | int is_slave = drive->dn & 1; |
76 | int master_port = hwif->channel ? 0x42 : 0x40; | 76 | int master_port = hwif->channel ? 0x42 : 0x40; |
77 | int slave_port = 0x44; | 77 | int slave_port = 0x44; |
@@ -140,7 +140,7 @@ static void piix_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
140 | static void piix_set_dma_mode(ide_drive_t *drive, const u8 speed) | 140 | static void piix_set_dma_mode(ide_drive_t *drive, const u8 speed) |
141 | { | 141 | { |
142 | ide_hwif_t *hwif = HWIF(drive); | 142 | ide_hwif_t *hwif = HWIF(drive); |
143 | struct pci_dev *dev = hwif->pci_dev; | 143 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
144 | u8 maslave = hwif->channel ? 0x42 : 0x40; | 144 | u8 maslave = hwif->channel ? 0x42 : 0x40; |
145 | int a_speed = 3 << (drive->dn * 4); | 145 | int a_speed = 3 << (drive->dn * 4); |
146 | int u_flag = 1 << drive->dn; | 146 | int u_flag = 1 << drive->dn; |
@@ -260,7 +260,7 @@ static const struct ich_laptop ich_laptop[] = { | |||
260 | 260 | ||
261 | static u8 __devinit piix_cable_detect(ide_hwif_t *hwif) | 261 | static u8 __devinit piix_cable_detect(ide_hwif_t *hwif) |
262 | { | 262 | { |
263 | struct pci_dev *pdev = hwif->pci_dev; | 263 | struct pci_dev *pdev = to_pci_dev(hwif->dev); |
264 | const struct ich_laptop *lap = &ich_laptop[0]; | 264 | const struct ich_laptop *lap = &ich_laptop[0]; |
265 | u8 reg54h = 0, mask = hwif->channel ? 0xc0 : 0x30; | 265 | u8 reg54h = 0, mask = hwif->channel ? 0xc0 : 0x30; |
266 | 266 | ||
diff --git a/drivers/ide/pci/rz1000.c b/drivers/ide/pci/rz1000.c index 6b10ae260fa2..1d3b2f3a8cbb 100644 --- a/drivers/ide/pci/rz1000.c +++ b/drivers/ide/pci/rz1000.c | |||
@@ -32,8 +32,8 @@ | |||
32 | 32 | ||
33 | static void __devinit init_hwif_rz1000 (ide_hwif_t *hwif) | 33 | static void __devinit init_hwif_rz1000 (ide_hwif_t *hwif) |
34 | { | 34 | { |
35 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
35 | u16 reg; | 36 | u16 reg; |
36 | struct pci_dev *dev = hwif->pci_dev; | ||
37 | 37 | ||
38 | if (!pci_read_config_word (dev, 0x40, ®) && | 38 | if (!pci_read_config_word (dev, 0x40, ®) && |
39 | !pci_write_config_word(dev, 0x40, reg & 0xdfff)) { | 39 | !pci_write_config_word(dev, 0x40, reg & 0xdfff)) { |
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c index 32fdf53379f5..c2eac1c69ae8 100644 --- a/drivers/ide/pci/sc1200.c +++ b/drivers/ide/pci/sc1200.c | |||
@@ -87,7 +87,7 @@ static const unsigned int sc1200_pio_timings[4][5] = | |||
87 | static void sc1200_tunepio(ide_drive_t *drive, u8 pio) | 87 | static void sc1200_tunepio(ide_drive_t *drive, u8 pio) |
88 | { | 88 | { |
89 | ide_hwif_t *hwif = drive->hwif; | 89 | ide_hwif_t *hwif = drive->hwif; |
90 | struct pci_dev *pdev = hwif->pci_dev; | 90 | struct pci_dev *pdev = to_pci_dev(hwif->dev); |
91 | unsigned int basereg = hwif->channel ? 0x50 : 0x40, format = 0; | 91 | unsigned int basereg = hwif->channel ? 0x50 : 0x40, format = 0; |
92 | 92 | ||
93 | pci_read_config_dword(pdev, basereg + 4, &format); | 93 | pci_read_config_dword(pdev, basereg + 4, &format); |
@@ -130,6 +130,7 @@ out: | |||
130 | static void sc1200_set_dma_mode(ide_drive_t *drive, const u8 mode) | 130 | static void sc1200_set_dma_mode(ide_drive_t *drive, const u8 mode) |
131 | { | 131 | { |
132 | ide_hwif_t *hwif = HWIF(drive); | 132 | ide_hwif_t *hwif = HWIF(drive); |
133 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
133 | int unit = drive->select.b.unit; | 134 | int unit = drive->select.b.unit; |
134 | unsigned int reg, timings; | 135 | unsigned int reg, timings; |
135 | unsigned short pci_clock; | 136 | unsigned short pci_clock; |
@@ -160,12 +161,11 @@ static void sc1200_set_dma_mode(ide_drive_t *drive, const u8 mode) | |||
160 | timings = mwdma_timing[pci_clock][mode - XFER_MW_DMA_0]; | 161 | timings = mwdma_timing[pci_clock][mode - XFER_MW_DMA_0]; |
161 | 162 | ||
162 | if (unit == 0) { /* are we configuring drive0? */ | 163 | if (unit == 0) { /* are we configuring drive0? */ |
163 | pci_read_config_dword(hwif->pci_dev, basereg+4, ®); | 164 | pci_read_config_dword(dev, basereg + 4, ®); |
164 | timings |= reg & 0x80000000; /* preserve PIO format bit */ | 165 | timings |= reg & 0x80000000; /* preserve PIO format bit */ |
165 | pci_write_config_dword(hwif->pci_dev, basereg+4, timings); | 166 | pci_write_config_dword(dev, basereg + 4, timings); |
166 | } else { | 167 | } else |
167 | pci_write_config_dword(hwif->pci_dev, basereg+12, timings); | 168 | pci_write_config_dword(dev, basereg + 12, timings); |
168 | } | ||
169 | } | 169 | } |
170 | 170 | ||
171 | /* Replacement for the standard ide_dma_end action in | 171 | /* Replacement for the standard ide_dma_end action in |
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c index 24a85bbcd2a6..7694969b02ce 100644 --- a/drivers/ide/pci/scc_pata.c +++ b/drivers/ide/pci/scc_pata.c | |||
@@ -594,7 +594,7 @@ static int __devinit init_setup_scc(struct pci_dev *dev, | |||
594 | 594 | ||
595 | static void __devinit init_mmio_iops_scc(ide_hwif_t *hwif) | 595 | static void __devinit init_mmio_iops_scc(ide_hwif_t *hwif) |
596 | { | 596 | { |
597 | struct pci_dev *dev = hwif->pci_dev; | 597 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
598 | struct scc_ports *ports = pci_get_drvdata(dev); | 598 | struct scc_ports *ports = pci_get_drvdata(dev); |
599 | unsigned long dma_base = ports->dma; | 599 | unsigned long dma_base = ports->dma; |
600 | 600 | ||
@@ -620,7 +620,7 @@ static void __devinit init_mmio_iops_scc(ide_hwif_t *hwif) | |||
620 | hwif->io_ports[IDE_STATUS_OFFSET] = dma_base + 0x3c; | 620 | hwif->io_ports[IDE_STATUS_OFFSET] = dma_base + 0x3c; |
621 | hwif->io_ports[IDE_CONTROL_OFFSET] = dma_base + 0x40; | 621 | hwif->io_ports[IDE_CONTROL_OFFSET] = dma_base + 0x40; |
622 | 622 | ||
623 | hwif->irq = hwif->pci_dev->irq; | 623 | hwif->irq = dev->irq; |
624 | hwif->dma_base = dma_base; | 624 | hwif->dma_base = dma_base; |
625 | hwif->config_data = ports->ctl; | 625 | hwif->config_data = ports->ctl; |
626 | hwif->mmio = 1; | 626 | hwif->mmio = 1; |
@@ -636,7 +636,8 @@ static void __devinit init_mmio_iops_scc(ide_hwif_t *hwif) | |||
636 | 636 | ||
637 | static void __devinit init_iops_scc(ide_hwif_t *hwif) | 637 | static void __devinit init_iops_scc(ide_hwif_t *hwif) |
638 | { | 638 | { |
639 | struct pci_dev *dev = hwif->pci_dev; | 639 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
640 | |||
640 | hwif->hwif_data = NULL; | 641 | hwif->hwif_data = NULL; |
641 | if (pci_get_drvdata(dev) == NULL) | 642 | if (pci_get_drvdata(dev) == NULL) |
642 | return; | 643 | return; |
@@ -726,10 +727,8 @@ static void __devexit scc_remove(struct pci_dev *dev) | |||
726 | unsigned long dma_size = pci_resource_len(dev, 1); | 727 | unsigned long dma_size = pci_resource_len(dev, 1); |
727 | 728 | ||
728 | if (hwif->dmatable_cpu) { | 729 | if (hwif->dmatable_cpu) { |
729 | pci_free_consistent(hwif->pci_dev, | 730 | pci_free_consistent(dev, PRD_ENTRIES * PRD_BYTES, |
730 | PRD_ENTRIES * PRD_BYTES, | 731 | hwif->dmatable_cpu, hwif->dmatable_dma); |
731 | hwif->dmatable_cpu, | ||
732 | hwif->dmatable_dma); | ||
733 | hwif->dmatable_cpu = NULL; | 732 | hwif->dmatable_cpu = NULL; |
734 | } | 733 | } |
735 | 734 | ||
diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c index bf01c387739e..cb10dfa71f5c 100644 --- a/drivers/ide/pci/serverworks.c +++ b/drivers/ide/pci/serverworks.c | |||
@@ -67,7 +67,7 @@ static int check_in_drive_lists (ide_drive_t *drive, const char **list) | |||
67 | 67 | ||
68 | static u8 svwks_udma_filter(ide_drive_t *drive) | 68 | static u8 svwks_udma_filter(ide_drive_t *drive) |
69 | { | 69 | { |
70 | struct pci_dev *dev = HWIF(drive)->pci_dev; | 70 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
71 | u8 mask = 0; | 71 | u8 mask = 0; |
72 | 72 | ||
73 | if (dev->device == PCI_DEVICE_ID_SERVERWORKS_HT1000IDE) | 73 | if (dev->device == PCI_DEVICE_ID_SERVERWORKS_HT1000IDE) |
@@ -130,7 +130,7 @@ static void svwks_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
130 | static const u8 pio_modes[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 }; | 130 | static const u8 pio_modes[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 }; |
131 | static const u8 drive_pci[] = { 0x41, 0x40, 0x43, 0x42 }; | 131 | static const u8 drive_pci[] = { 0x41, 0x40, 0x43, 0x42 }; |
132 | 132 | ||
133 | struct pci_dev *dev = drive->hwif->pci_dev; | 133 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
134 | 134 | ||
135 | pci_write_config_byte(dev, drive_pci[drive->dn], pio_modes[pio]); | 135 | pci_write_config_byte(dev, drive_pci[drive->dn], pio_modes[pio]); |
136 | 136 | ||
@@ -153,7 +153,7 @@ static void svwks_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
153 | static const u8 drive_pci2[] = { 0x45, 0x44, 0x47, 0x46 }; | 153 | static const u8 drive_pci2[] = { 0x45, 0x44, 0x47, 0x46 }; |
154 | 154 | ||
155 | ide_hwif_t *hwif = HWIF(drive); | 155 | ide_hwif_t *hwif = HWIF(drive); |
156 | struct pci_dev *dev = hwif->pci_dev; | 156 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
157 | u8 unit = (drive->select.b.unit & 0x01); | 157 | u8 unit = (drive->select.b.unit & 0x01); |
158 | 158 | ||
159 | u8 ultra_enable = 0, ultra_timing = 0, dma_timing = 0; | 159 | u8 ultra_enable = 0, ultra_timing = 0, dma_timing = 0; |
@@ -287,7 +287,8 @@ static u8 __devinit ata66_svwks_svwks(ide_hwif_t *hwif) | |||
287 | */ | 287 | */ |
288 | static u8 __devinit ata66_svwks_dell(ide_hwif_t *hwif) | 288 | static u8 __devinit ata66_svwks_dell(ide_hwif_t *hwif) |
289 | { | 289 | { |
290 | struct pci_dev *dev = hwif->pci_dev; | 290 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
291 | |||
291 | if (dev->subsystem_vendor == PCI_VENDOR_ID_DELL && | 292 | if (dev->subsystem_vendor == PCI_VENDOR_ID_DELL && |
292 | dev->vendor == PCI_VENDOR_ID_SERVERWORKS && | 293 | dev->vendor == PCI_VENDOR_ID_SERVERWORKS && |
293 | (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE || | 294 | (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE || |
@@ -305,7 +306,8 @@ static u8 __devinit ata66_svwks_dell(ide_hwif_t *hwif) | |||
305 | */ | 306 | */ |
306 | static u8 __devinit ata66_svwks_cobalt(ide_hwif_t *hwif) | 307 | static u8 __devinit ata66_svwks_cobalt(ide_hwif_t *hwif) |
307 | { | 308 | { |
308 | struct pci_dev *dev = hwif->pci_dev; | 309 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
310 | |||
309 | if (dev->subsystem_vendor == PCI_VENDOR_ID_SUN && | 311 | if (dev->subsystem_vendor == PCI_VENDOR_ID_SUN && |
310 | dev->vendor == PCI_VENDOR_ID_SERVERWORKS && | 312 | dev->vendor == PCI_VENDOR_ID_SERVERWORKS && |
311 | dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) | 313 | dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) |
@@ -316,7 +318,7 @@ static u8 __devinit ata66_svwks_cobalt(ide_hwif_t *hwif) | |||
316 | 318 | ||
317 | static u8 __devinit ata66_svwks(ide_hwif_t *hwif) | 319 | static u8 __devinit ata66_svwks(ide_hwif_t *hwif) |
318 | { | 320 | { |
319 | struct pci_dev *dev = hwif->pci_dev; | 321 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
320 | 322 | ||
321 | /* Server Works */ | 323 | /* Server Works */ |
322 | if (dev->subsystem_vendor == PCI_VENDOR_ID_SERVERWORKS) | 324 | if (dev->subsystem_vendor == PCI_VENDOR_ID_SERVERWORKS) |
@@ -340,6 +342,8 @@ static u8 __devinit ata66_svwks(ide_hwif_t *hwif) | |||
340 | 342 | ||
341 | static void __devinit init_hwif_svwks (ide_hwif_t *hwif) | 343 | static void __devinit init_hwif_svwks (ide_hwif_t *hwif) |
342 | { | 344 | { |
345 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
346 | |||
343 | hwif->set_pio_mode = &svwks_set_pio_mode; | 347 | hwif->set_pio_mode = &svwks_set_pio_mode; |
344 | hwif->set_dma_mode = &svwks_set_dma_mode; | 348 | hwif->set_dma_mode = &svwks_set_dma_mode; |
345 | hwif->udma_filter = &svwks_udma_filter; | 349 | hwif->udma_filter = &svwks_udma_filter; |
@@ -347,7 +351,7 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif) | |||
347 | if (!hwif->dma_base) | 351 | if (!hwif->dma_base) |
348 | return; | 352 | return; |
349 | 353 | ||
350 | if (hwif->pci_dev->device != PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) { | 354 | if (dev->device != PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) { |
351 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) | 355 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) |
352 | hwif->cbl = ata66_svwks(hwif); | 356 | hwif->cbl = ata66_svwks(hwif); |
353 | } | 357 | } |
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c index b60a5e8860cd..85902074b1fc 100644 --- a/drivers/ide/pci/sgiioc4.c +++ b/drivers/ide/pci/sgiioc4.c | |||
@@ -159,6 +159,7 @@ sgiioc4_clearirq(ide_drive_t * drive) | |||
159 | } | 159 | } |
160 | 160 | ||
161 | if (intr_reg & 0x02) { | 161 | if (intr_reg & 0x02) { |
162 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
162 | /* Error when transferring DMA data on PCI bus */ | 163 | /* Error when transferring DMA data on PCI bus */ |
163 | u32 pci_err_addr_low, pci_err_addr_high, | 164 | u32 pci_err_addr_low, pci_err_addr_high, |
164 | pci_stat_cmd_reg; | 165 | pci_stat_cmd_reg; |
@@ -167,7 +168,7 @@ sgiioc4_clearirq(ide_drive_t * drive) | |||
167 | readl((void __iomem *)hwif->io_ports[IDE_IRQ_OFFSET]); | 168 | readl((void __iomem *)hwif->io_ports[IDE_IRQ_OFFSET]); |
168 | pci_err_addr_high = | 169 | pci_err_addr_high = |
169 | readl((void __iomem *)(hwif->io_ports[IDE_IRQ_OFFSET] + 4)); | 170 | readl((void __iomem *)(hwif->io_ports[IDE_IRQ_OFFSET] + 4)); |
170 | pci_read_config_dword(hwif->pci_dev, PCI_COMMAND, | 171 | pci_read_config_dword(dev, PCI_COMMAND, |
171 | &pci_stat_cmd_reg); | 172 | &pci_stat_cmd_reg); |
172 | printk(KERN_ERR | 173 | printk(KERN_ERR |
173 | "%s(%s) : PCI Bus Error when doing DMA:" | 174 | "%s(%s) : PCI Bus Error when doing DMA:" |
@@ -178,8 +179,7 @@ sgiioc4_clearirq(ide_drive_t * drive) | |||
178 | __FUNCTION__, drive->name, | 179 | __FUNCTION__, drive->name, |
179 | pci_err_addr_high, pci_err_addr_low); | 180 | pci_err_addr_high, pci_err_addr_low); |
180 | /* Clear the PCI Error indicator */ | 181 | /* Clear the PCI Error indicator */ |
181 | pci_write_config_dword(hwif->pci_dev, PCI_COMMAND, | 182 | pci_write_config_dword(dev, PCI_COMMAND, 0x00000146); |
182 | 0x00000146); | ||
183 | } | 183 | } |
184 | 184 | ||
185 | /* Clear the Interrupt, Error bits on the IOC4 */ | 185 | /* Clear the Interrupt, Error bits on the IOC4 */ |
@@ -334,6 +334,7 @@ sgiioc4_INB(unsigned long port) | |||
334 | static int __devinit | 334 | static int __devinit |
335 | ide_dma_sgiioc4(ide_hwif_t * hwif, unsigned long dma_base) | 335 | ide_dma_sgiioc4(ide_hwif_t * hwif, unsigned long dma_base) |
336 | { | 336 | { |
337 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
337 | void __iomem *virt_dma_base; | 338 | void __iomem *virt_dma_base; |
338 | int num_ports = sizeof (ioc4_dma_regs_t); | 339 | int num_ports = sizeof (ioc4_dma_regs_t); |
339 | void *pad; | 340 | void *pad; |
@@ -359,7 +360,7 @@ ide_dma_sgiioc4(ide_hwif_t * hwif, unsigned long dma_base) | |||
359 | } | 360 | } |
360 | hwif->dma_base = (unsigned long) virt_dma_base; | 361 | hwif->dma_base = (unsigned long) virt_dma_base; |
361 | 362 | ||
362 | hwif->dmatable_cpu = pci_alloc_consistent(hwif->pci_dev, | 363 | hwif->dmatable_cpu = pci_alloc_consistent(dev, |
363 | IOC4_PRD_ENTRIES * IOC4_PRD_BYTES, | 364 | IOC4_PRD_ENTRIES * IOC4_PRD_BYTES, |
364 | &hwif->dmatable_dma); | 365 | &hwif->dmatable_dma); |
365 | 366 | ||
@@ -368,7 +369,7 @@ ide_dma_sgiioc4(ide_hwif_t * hwif, unsigned long dma_base) | |||
368 | 369 | ||
369 | hwif->sg_max_nents = IOC4_PRD_ENTRIES; | 370 | hwif->sg_max_nents = IOC4_PRD_ENTRIES; |
370 | 371 | ||
371 | pad = pci_alloc_consistent(hwif->pci_dev, IOC4_IDE_CACHELINE_SIZE, | 372 | pad = pci_alloc_consistent(dev, IOC4_IDE_CACHELINE_SIZE, |
372 | (dma_addr_t *) &(hwif->dma_status)); | 373 | (dma_addr_t *) &(hwif->dma_status)); |
373 | 374 | ||
374 | if (pad) { | 375 | if (pad) { |
@@ -376,8 +377,7 @@ ide_dma_sgiioc4(ide_hwif_t * hwif, unsigned long dma_base) | |||
376 | return 0; | 377 | return 0; |
377 | } | 378 | } |
378 | 379 | ||
379 | pci_free_consistent(hwif->pci_dev, | 380 | pci_free_consistent(dev, IOC4_PRD_ENTRIES * IOC4_PRD_BYTES, |
380 | IOC4_PRD_ENTRIES * IOC4_PRD_BYTES, | ||
381 | hwif->dmatable_cpu, hwif->dmatable_dma); | 381 | hwif->dmatable_cpu, hwif->dmatable_dma); |
382 | printk(KERN_INFO | 382 | printk(KERN_INFO |
383 | "%s() -- Error! Unable to allocate DMA Maps for drive %s\n", | 383 | "%s() -- Error! Unable to allocate DMA Maps for drive %s\n", |
@@ -640,7 +640,7 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) | |||
640 | hw.dev = &dev->dev; | 640 | hw.dev = &dev->dev; |
641 | ide_init_port_hw(hwif, &hw); | 641 | ide_init_port_hw(hwif, &hw); |
642 | 642 | ||
643 | hwif->pci_dev = dev; | 643 | hwif->dev = &dev->dev; |
644 | hwif->channel = 0; /* Single Channel chip */ | 644 | hwif->channel = 0; /* Single Channel chip */ |
645 | 645 | ||
646 | /* The IOC4 uses MMIO rather than Port IO. */ | 646 | /* The IOC4 uses MMIO rather than Port IO. */ |
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index 908f37b4e0ee..391eea88c760 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c | |||
@@ -79,7 +79,7 @@ static int pdev_is_sata(struct pci_dev *pdev) | |||
79 | 79 | ||
80 | static inline int is_sata(ide_hwif_t *hwif) | 80 | static inline int is_sata(ide_hwif_t *hwif) |
81 | { | 81 | { |
82 | return pdev_is_sata(hwif->pci_dev); | 82 | return pdev_is_sata(to_pci_dev(hwif->dev)); |
83 | } | 83 | } |
84 | 84 | ||
85 | /** | 85 | /** |
@@ -140,13 +140,14 @@ static inline unsigned long siimage_seldev(ide_drive_t *drive, int r) | |||
140 | static u8 sil_pata_udma_filter(ide_drive_t *drive) | 140 | static u8 sil_pata_udma_filter(ide_drive_t *drive) |
141 | { | 141 | { |
142 | ide_hwif_t *hwif = drive->hwif; | 142 | ide_hwif_t *hwif = drive->hwif; |
143 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
143 | unsigned long base = (unsigned long) hwif->hwif_data; | 144 | unsigned long base = (unsigned long) hwif->hwif_data; |
144 | u8 mask = 0, scsc = 0; | 145 | u8 mask = 0, scsc = 0; |
145 | 146 | ||
146 | if (hwif->mmio) | 147 | if (hwif->mmio) |
147 | scsc = hwif->INB(base + 0x4A); | 148 | scsc = hwif->INB(base + 0x4A); |
148 | else | 149 | else |
149 | pci_read_config_byte(hwif->pci_dev, 0x8A, &scsc); | 150 | pci_read_config_byte(dev, 0x8A, &scsc); |
150 | 151 | ||
151 | if ((scsc & 0x30) == 0x10) /* 133 */ | 152 | if ((scsc & 0x30) == 0x10) /* 133 */ |
152 | mask = ATA_UDMA6; | 153 | mask = ATA_UDMA6; |
@@ -219,19 +220,21 @@ static void sil_set_pio_mode(ide_drive_t *drive, u8 pio) | |||
219 | mode |= (unit ? 0x10 : 0x01); | 220 | mode |= (unit ? 0x10 : 0x01); |
220 | hwif->OUTB(mode, base + addr_mask); | 221 | hwif->OUTB(mode, base + addr_mask); |
221 | } else { | 222 | } else { |
222 | pci_write_config_word(hwif->pci_dev, addr, speedp); | 223 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
223 | pci_write_config_word(hwif->pci_dev, tfaddr, speedt); | 224 | |
224 | pci_read_config_word(hwif->pci_dev, tfaddr-2, &speedp); | 225 | pci_write_config_word(dev, addr, speedp); |
226 | pci_write_config_word(dev, tfaddr, speedt); | ||
227 | pci_read_config_word(dev, tfaddr - 2, &speedp); | ||
225 | speedp &= ~0x200; | 228 | speedp &= ~0x200; |
226 | /* Set IORDY for mode 3 or 4 */ | 229 | /* Set IORDY for mode 3 or 4 */ |
227 | if (pio > 2) | 230 | if (pio > 2) |
228 | speedp |= 0x200; | 231 | speedp |= 0x200; |
229 | pci_write_config_word(hwif->pci_dev, tfaddr-2, speedp); | 232 | pci_write_config_word(dev, tfaddr - 2, speedp); |
230 | 233 | ||
231 | pci_read_config_byte(hwif->pci_dev, addr_mask, &mode); | 234 | pci_read_config_byte(dev, addr_mask, &mode); |
232 | mode &= ~(unit ? 0x30 : 0x03); | 235 | mode &= ~(unit ? 0x30 : 0x03); |
233 | mode |= (unit ? 0x10 : 0x01); | 236 | mode |= (unit ? 0x10 : 0x01); |
234 | pci_write_config_byte(hwif->pci_dev, addr_mask, mode); | 237 | pci_write_config_byte(dev, addr_mask, mode); |
235 | } | 238 | } |
236 | } | 239 | } |
237 | 240 | ||
@@ -250,6 +253,7 @@ static void sil_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
250 | u16 dma[] = { 0x2208, 0x10C2, 0x10C1 }; | 253 | u16 dma[] = { 0x2208, 0x10C2, 0x10C1 }; |
251 | 254 | ||
252 | ide_hwif_t *hwif = HWIF(drive); | 255 | ide_hwif_t *hwif = HWIF(drive); |
256 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
253 | u16 ultra = 0, multi = 0; | 257 | u16 ultra = 0, multi = 0; |
254 | u8 mode = 0, unit = drive->select.b.unit; | 258 | u8 mode = 0, unit = drive->select.b.unit; |
255 | unsigned long base = (unsigned long)hwif->hwif_data; | 259 | unsigned long base = (unsigned long)hwif->hwif_data; |
@@ -266,10 +270,10 @@ static void sil_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
266 | multi = hwif->INW(ma); | 270 | multi = hwif->INW(ma); |
267 | ultra = hwif->INW(ua); | 271 | ultra = hwif->INW(ua); |
268 | } else { | 272 | } else { |
269 | pci_read_config_byte(hwif->pci_dev, 0x8A, &scsc); | 273 | pci_read_config_byte(dev, 0x8A, &scsc); |
270 | pci_read_config_byte(hwif->pci_dev, addr_mask, &mode); | 274 | pci_read_config_byte(dev, addr_mask, &mode); |
271 | pci_read_config_word(hwif->pci_dev, ma, &multi); | 275 | pci_read_config_word(dev, ma, &multi); |
272 | pci_read_config_word(hwif->pci_dev, ua, &ultra); | 276 | pci_read_config_word(dev, ua, &ultra); |
273 | } | 277 | } |
274 | 278 | ||
275 | mode &= ~((unit) ? 0x30 : 0x03); | 279 | mode &= ~((unit) ? 0x30 : 0x03); |
@@ -293,9 +297,9 @@ static void sil_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
293 | hwif->OUTW(multi, ma); | 297 | hwif->OUTW(multi, ma); |
294 | hwif->OUTW(ultra, ua); | 298 | hwif->OUTW(ultra, ua); |
295 | } else { | 299 | } else { |
296 | pci_write_config_byte(hwif->pci_dev, addr_mask, mode); | 300 | pci_write_config_byte(dev, addr_mask, mode); |
297 | pci_write_config_word(hwif->pci_dev, ma, multi); | 301 | pci_write_config_word(dev, ma, multi); |
298 | pci_write_config_word(hwif->pci_dev, ua, ultra); | 302 | pci_write_config_word(dev, ua, ultra); |
299 | } | 303 | } |
300 | } | 304 | } |
301 | 305 | ||
@@ -303,6 +307,7 @@ static void sil_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
303 | static int siimage_io_ide_dma_test_irq (ide_drive_t *drive) | 307 | static int siimage_io_ide_dma_test_irq (ide_drive_t *drive) |
304 | { | 308 | { |
305 | ide_hwif_t *hwif = HWIF(drive); | 309 | ide_hwif_t *hwif = HWIF(drive); |
310 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
306 | u8 dma_altstat = 0; | 311 | u8 dma_altstat = 0; |
307 | unsigned long addr = siimage_selreg(hwif, 1); | 312 | unsigned long addr = siimage_selreg(hwif, 1); |
308 | 313 | ||
@@ -311,7 +316,7 @@ static int siimage_io_ide_dma_test_irq (ide_drive_t *drive) | |||
311 | return 1; | 316 | return 1; |
312 | 317 | ||
313 | /* return 1 if Device INTR asserted */ | 318 | /* return 1 if Device INTR asserted */ |
314 | pci_read_config_byte(hwif->pci_dev, addr, &dma_altstat); | 319 | pci_read_config_byte(dev, addr, &dma_altstat); |
315 | if (dma_altstat & 8) | 320 | if (dma_altstat & 8) |
316 | return 0; //return 1; | 321 | return 0; //return 1; |
317 | return 0; | 322 | return 0; |
@@ -377,13 +382,14 @@ static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive) | |||
377 | static int sil_sata_busproc(ide_drive_t * drive, int state) | 382 | static int sil_sata_busproc(ide_drive_t * drive, int state) |
378 | { | 383 | { |
379 | ide_hwif_t *hwif = HWIF(drive); | 384 | ide_hwif_t *hwif = HWIF(drive); |
385 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
380 | u32 stat_config = 0; | 386 | u32 stat_config = 0; |
381 | unsigned long addr = siimage_selreg(hwif, 0); | 387 | unsigned long addr = siimage_selreg(hwif, 0); |
382 | 388 | ||
383 | if (hwif->mmio) | 389 | if (hwif->mmio) |
384 | stat_config = readl((void __iomem *)addr); | 390 | stat_config = readl((void __iomem *)addr); |
385 | else | 391 | else |
386 | pci_read_config_dword(hwif->pci_dev, addr, &stat_config); | 392 | pci_read_config_dword(dev, addr, &stat_config); |
387 | 393 | ||
388 | switch (state) { | 394 | switch (state) { |
389 | case BUSSTATE_ON: | 395 | case BUSSTATE_ON: |
@@ -643,7 +649,7 @@ static unsigned int __devinit init_chipset_siimage(struct pci_dev *dev, const ch | |||
643 | 649 | ||
644 | static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif) | 650 | static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif) |
645 | { | 651 | { |
646 | struct pci_dev *dev = hwif->pci_dev; | 652 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
647 | void *addr = pci_get_drvdata(dev); | 653 | void *addr = pci_get_drvdata(dev); |
648 | u8 ch = hwif->channel; | 654 | u8 ch = hwif->channel; |
649 | hw_regs_t hw; | 655 | hw_regs_t hw; |
@@ -756,12 +762,14 @@ static void __devinit sil_quirkproc(ide_drive_t *drive) | |||
756 | 762 | ||
757 | static void __devinit init_iops_siimage(ide_hwif_t *hwif) | 763 | static void __devinit init_iops_siimage(ide_hwif_t *hwif) |
758 | { | 764 | { |
765 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
766 | |||
759 | hwif->hwif_data = NULL; | 767 | hwif->hwif_data = NULL; |
760 | 768 | ||
761 | /* Pessimal until we finish probing */ | 769 | /* Pessimal until we finish probing */ |
762 | hwif->rqsize = 15; | 770 | hwif->rqsize = 15; |
763 | 771 | ||
764 | if (pci_get_drvdata(hwif->pci_dev) == NULL) | 772 | if (pci_get_drvdata(dev) == NULL) |
765 | return; | 773 | return; |
766 | 774 | ||
767 | init_mmio_iops_siimage(hwif); | 775 | init_mmio_iops_siimage(hwif); |
@@ -777,11 +785,12 @@ static void __devinit init_iops_siimage(ide_hwif_t *hwif) | |||
777 | 785 | ||
778 | static u8 __devinit ata66_siimage(ide_hwif_t *hwif) | 786 | static u8 __devinit ata66_siimage(ide_hwif_t *hwif) |
779 | { | 787 | { |
788 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
780 | unsigned long addr = siimage_selreg(hwif, 0); | 789 | unsigned long addr = siimage_selreg(hwif, 0); |
781 | u8 ata66 = 0; | 790 | u8 ata66 = 0; |
782 | 791 | ||
783 | if (pci_get_drvdata(hwif->pci_dev) == NULL) | 792 | if (pci_get_drvdata(dev) == NULL) |
784 | pci_read_config_byte(hwif->pci_dev, addr, &ata66); | 793 | pci_read_config_byte(dev, addr, &ata66); |
785 | else | 794 | else |
786 | ata66 = hwif->INB(addr); | 795 | ata66 = hwif->INB(addr); |
787 | 796 | ||
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c index 85d36996e6af..9fb4ba4ee318 100644 --- a/drivers/ide/pci/sis5513.c +++ b/drivers/ide/pci/sis5513.c | |||
@@ -197,7 +197,7 @@ static char* chipset_capability[] = { | |||
197 | 197 | ||
198 | static u8 sis_ata133_get_base(ide_drive_t *drive) | 198 | static u8 sis_ata133_get_base(ide_drive_t *drive) |
199 | { | 199 | { |
200 | struct pci_dev *dev = drive->hwif->pci_dev; | 200 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
201 | u32 reg54 = 0; | 201 | u32 reg54 = 0; |
202 | 202 | ||
203 | pci_read_config_dword(dev, 0x54, ®54); | 203 | pci_read_config_dword(dev, 0x54, ®54); |
@@ -207,7 +207,7 @@ static u8 sis_ata133_get_base(ide_drive_t *drive) | |||
207 | 207 | ||
208 | static void sis_ata16_program_timings(ide_drive_t *drive, const u8 mode) | 208 | static void sis_ata16_program_timings(ide_drive_t *drive, const u8 mode) |
209 | { | 209 | { |
210 | struct pci_dev *dev = drive->hwif->pci_dev; | 210 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
211 | u16 t1 = 0; | 211 | u16 t1 = 0; |
212 | u8 drive_pci = 0x40 + drive->dn * 2; | 212 | u8 drive_pci = 0x40 + drive->dn * 2; |
213 | 213 | ||
@@ -230,7 +230,7 @@ static void sis_ata16_program_timings(ide_drive_t *drive, const u8 mode) | |||
230 | 230 | ||
231 | static void sis_ata100_program_timings(ide_drive_t *drive, const u8 mode) | 231 | static void sis_ata100_program_timings(ide_drive_t *drive, const u8 mode) |
232 | { | 232 | { |
233 | struct pci_dev *dev = drive->hwif->pci_dev; | 233 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
234 | u8 t1, drive_pci = 0x40 + drive->dn * 2; | 234 | u8 t1, drive_pci = 0x40 + drive->dn * 2; |
235 | 235 | ||
236 | /* timing bits: 7:4 active 3:0 recovery */ | 236 | /* timing bits: 7:4 active 3:0 recovery */ |
@@ -253,7 +253,7 @@ static void sis_ata100_program_timings(ide_drive_t *drive, const u8 mode) | |||
253 | 253 | ||
254 | static void sis_ata133_program_timings(ide_drive_t *drive, const u8 mode) | 254 | static void sis_ata133_program_timings(ide_drive_t *drive, const u8 mode) |
255 | { | 255 | { |
256 | struct pci_dev *dev = drive->hwif->pci_dev; | 256 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
257 | u32 t1 = 0; | 257 | u32 t1 = 0; |
258 | u8 drive_pci = sis_ata133_get_base(drive), clk, idx; | 258 | u8 drive_pci = sis_ata133_get_base(drive), clk, idx; |
259 | 259 | ||
@@ -286,7 +286,7 @@ static void sis_program_timings(ide_drive_t *drive, const u8 mode) | |||
286 | static void config_drive_art_rwp (ide_drive_t *drive) | 286 | static void config_drive_art_rwp (ide_drive_t *drive) |
287 | { | 287 | { |
288 | ide_hwif_t *hwif = HWIF(drive); | 288 | ide_hwif_t *hwif = HWIF(drive); |
289 | struct pci_dev *dev = hwif->pci_dev; | 289 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
290 | u8 reg4bh = 0; | 290 | u8 reg4bh = 0; |
291 | u8 rw_prefetch = 0; | 291 | u8 rw_prefetch = 0; |
292 | 292 | ||
@@ -307,7 +307,7 @@ static void sis_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
307 | 307 | ||
308 | static void sis_ata133_program_udma_timings(ide_drive_t *drive, const u8 mode) | 308 | static void sis_ata133_program_udma_timings(ide_drive_t *drive, const u8 mode) |
309 | { | 309 | { |
310 | struct pci_dev *dev = drive->hwif->pci_dev; | 310 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
311 | u32 regdw = 0; | 311 | u32 regdw = 0; |
312 | u8 drive_pci = sis_ata133_get_base(drive), clk, idx; | 312 | u8 drive_pci = sis_ata133_get_base(drive), clk, idx; |
313 | 313 | ||
@@ -326,7 +326,7 @@ static void sis_ata133_program_udma_timings(ide_drive_t *drive, const u8 mode) | |||
326 | 326 | ||
327 | static void sis_ata33_program_udma_timings(ide_drive_t *drive, const u8 mode) | 327 | static void sis_ata33_program_udma_timings(ide_drive_t *drive, const u8 mode) |
328 | { | 328 | { |
329 | struct pci_dev *dev = drive->hwif->pci_dev; | 329 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
330 | u8 drive_pci = 0x40 + drive->dn * 2, reg = 0, i = chipset_family; | 330 | u8 drive_pci = 0x40 + drive->dn * 2, reg = 0, i = chipset_family; |
331 | 331 | ||
332 | pci_read_config_byte(dev, drive_pci + 1, ®); | 332 | pci_read_config_byte(dev, drive_pci + 1, ®); |
@@ -359,7 +359,7 @@ static void sis_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
359 | 359 | ||
360 | static u8 sis5513_ata133_udma_filter(ide_drive_t *drive) | 360 | static u8 sis5513_ata133_udma_filter(ide_drive_t *drive) |
361 | { | 361 | { |
362 | struct pci_dev *dev = drive->hwif->pci_dev; | 362 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
363 | u32 regdw = 0; | 363 | u32 regdw = 0; |
364 | u8 drive_pci = sis_ata133_get_base(drive); | 364 | u8 drive_pci = sis_ata133_get_base(drive); |
365 | 365 | ||
@@ -530,7 +530,7 @@ static const struct sis_laptop sis_laptop[] = { | |||
530 | 530 | ||
531 | static u8 __devinit ata66_sis5513(ide_hwif_t *hwif) | 531 | static u8 __devinit ata66_sis5513(ide_hwif_t *hwif) |
532 | { | 532 | { |
533 | struct pci_dev *pdev = hwif->pci_dev; | 533 | struct pci_dev *pdev = to_pci_dev(hwif->dev); |
534 | const struct sis_laptop *lap = &sis_laptop[0]; | 534 | const struct sis_laptop *lap = &sis_laptop[0]; |
535 | u8 ata66 = 0; | 535 | u8 ata66 = 0; |
536 | 536 | ||
@@ -545,12 +545,12 @@ static u8 __devinit ata66_sis5513(ide_hwif_t *hwif) | |||
545 | if (chipset_family >= ATA_133) { | 545 | if (chipset_family >= ATA_133) { |
546 | u16 regw = 0; | 546 | u16 regw = 0; |
547 | u16 reg_addr = hwif->channel ? 0x52: 0x50; | 547 | u16 reg_addr = hwif->channel ? 0x52: 0x50; |
548 | pci_read_config_word(hwif->pci_dev, reg_addr, ®w); | 548 | pci_read_config_word(pdev, reg_addr, ®w); |
549 | ata66 = (regw & 0x8000) ? 0 : 1; | 549 | ata66 = (regw & 0x8000) ? 0 : 1; |
550 | } else if (chipset_family >= ATA_66) { | 550 | } else if (chipset_family >= ATA_66) { |
551 | u8 reg48h = 0; | 551 | u8 reg48h = 0; |
552 | u8 mask = hwif->channel ? 0x20 : 0x10; | 552 | u8 mask = hwif->channel ? 0x20 : 0x10; |
553 | pci_read_config_byte(hwif->pci_dev, 0x48, ®48h); | 553 | pci_read_config_byte(pdev, 0x48, ®48h); |
554 | ata66 = (reg48h & mask) ? 0 : 1; | 554 | ata66 = (reg48h & mask) ? 0 : 1; |
555 | } | 555 | } |
556 | 556 | ||
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c index c7a125b66c29..38a79688abc5 100644 --- a/drivers/ide/pci/sl82c105.c +++ b/drivers/ide/pci/sl82c105.c | |||
@@ -78,7 +78,7 @@ static unsigned int get_pio_timings(ide_drive_t *drive, u8 pio) | |||
78 | */ | 78 | */ |
79 | static void sl82c105_set_pio_mode(ide_drive_t *drive, const u8 pio) | 79 | static void sl82c105_set_pio_mode(ide_drive_t *drive, const u8 pio) |
80 | { | 80 | { |
81 | struct pci_dev *dev = HWIF(drive)->pci_dev; | 81 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
82 | int reg = 0x44 + drive->dn * 4; | 82 | int reg = 0x44 + drive->dn * 4; |
83 | u16 drv_ctrl; | 83 | u16 drv_ctrl; |
84 | 84 | ||
@@ -147,7 +147,7 @@ static inline void sl82c105_reset_host(struct pci_dev *dev) | |||
147 | static void sl82c105_dma_lost_irq(ide_drive_t *drive) | 147 | static void sl82c105_dma_lost_irq(ide_drive_t *drive) |
148 | { | 148 | { |
149 | ide_hwif_t *hwif = HWIF(drive); | 149 | ide_hwif_t *hwif = HWIF(drive); |
150 | struct pci_dev *dev = hwif->pci_dev; | 150 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
151 | u32 val, mask = hwif->channel ? CTRL_IDE_IRQB : CTRL_IDE_IRQA; | 151 | u32 val, mask = hwif->channel ? CTRL_IDE_IRQB : CTRL_IDE_IRQA; |
152 | u8 dma_cmd; | 152 | u8 dma_cmd; |
153 | 153 | ||
@@ -184,7 +184,7 @@ static void sl82c105_dma_lost_irq(ide_drive_t *drive) | |||
184 | static void sl82c105_dma_start(ide_drive_t *drive) | 184 | static void sl82c105_dma_start(ide_drive_t *drive) |
185 | { | 185 | { |
186 | ide_hwif_t *hwif = HWIF(drive); | 186 | ide_hwif_t *hwif = HWIF(drive); |
187 | struct pci_dev *dev = hwif->pci_dev; | 187 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
188 | int reg = 0x44 + drive->dn * 4; | 188 | int reg = 0x44 + drive->dn * 4; |
189 | 189 | ||
190 | DBG(("%s(drive:%s)\n", __FUNCTION__, drive->name)); | 190 | DBG(("%s(drive:%s)\n", __FUNCTION__, drive->name)); |
@@ -197,15 +197,17 @@ static void sl82c105_dma_start(ide_drive_t *drive) | |||
197 | 197 | ||
198 | static void sl82c105_dma_timeout(ide_drive_t *drive) | 198 | static void sl82c105_dma_timeout(ide_drive_t *drive) |
199 | { | 199 | { |
200 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); | ||
201 | |||
200 | DBG(("sl82c105_dma_timeout(drive:%s)\n", drive->name)); | 202 | DBG(("sl82c105_dma_timeout(drive:%s)\n", drive->name)); |
201 | 203 | ||
202 | sl82c105_reset_host(HWIF(drive)->pci_dev); | 204 | sl82c105_reset_host(dev); |
203 | ide_dma_timeout(drive); | 205 | ide_dma_timeout(drive); |
204 | } | 206 | } |
205 | 207 | ||
206 | static int sl82c105_dma_end(ide_drive_t *drive) | 208 | static int sl82c105_dma_end(ide_drive_t *drive) |
207 | { | 209 | { |
208 | struct pci_dev *dev = HWIF(drive)->pci_dev; | 210 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
209 | int reg = 0x44 + drive->dn * 4; | 211 | int reg = 0x44 + drive->dn * 4; |
210 | int ret; | 212 | int ret; |
211 | 213 | ||
@@ -224,7 +226,7 @@ static int sl82c105_dma_end(ide_drive_t *drive) | |||
224 | */ | 226 | */ |
225 | static void sl82c105_resetproc(ide_drive_t *drive) | 227 | static void sl82c105_resetproc(ide_drive_t *drive) |
226 | { | 228 | { |
227 | struct pci_dev *dev = HWIF(drive)->pci_dev; | 229 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
228 | u32 val; | 230 | u32 val; |
229 | 231 | ||
230 | DBG(("sl82c105_resetproc(drive:%s)\n", drive->name)); | 232 | DBG(("sl82c105_resetproc(drive:%s)\n", drive->name)); |
@@ -293,6 +295,7 @@ static unsigned int __devinit init_chipset_sl82c105(struct pci_dev *dev, const c | |||
293 | */ | 295 | */ |
294 | static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif) | 296 | static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif) |
295 | { | 297 | { |
298 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
296 | unsigned int rev; | 299 | unsigned int rev; |
297 | 300 | ||
298 | DBG(("init_hwif_sl82c105(hwif: ide%d)\n", hwif->index)); | 301 | DBG(("init_hwif_sl82c105(hwif: ide%d)\n", hwif->index)); |
@@ -304,7 +307,7 @@ static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif) | |||
304 | if (!hwif->dma_base) | 307 | if (!hwif->dma_base) |
305 | return; | 308 | return; |
306 | 309 | ||
307 | rev = sl82c105_bridge_revision(hwif->pci_dev); | 310 | rev = sl82c105_bridge_revision(dev); |
308 | if (rev <= 5) { | 311 | if (rev <= 5) { |
309 | /* | 312 | /* |
310 | * Never ever EVER under any circumstances enable | 313 | * Never ever EVER under any circumstances enable |
diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c index dbbb46819a2d..c6a3b9f65ff4 100644 --- a/drivers/ide/pci/slc90e66.c +++ b/drivers/ide/pci/slc90e66.c | |||
@@ -26,7 +26,7 @@ static DEFINE_SPINLOCK(slc90e66_lock); | |||
26 | static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio) | 26 | static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio) |
27 | { | 27 | { |
28 | ide_hwif_t *hwif = HWIF(drive); | 28 | ide_hwif_t *hwif = HWIF(drive); |
29 | struct pci_dev *dev = hwif->pci_dev; | 29 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
30 | int is_slave = drive->dn & 1; | 30 | int is_slave = drive->dn & 1; |
31 | int master_port = hwif->channel ? 0x42 : 0x40; | 31 | int master_port = hwif->channel ? 0x42 : 0x40; |
32 | int slave_port = 0x44; | 32 | int slave_port = 0x44; |
@@ -79,7 +79,7 @@ static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
79 | static void slc90e66_set_dma_mode(ide_drive_t *drive, const u8 speed) | 79 | static void slc90e66_set_dma_mode(ide_drive_t *drive, const u8 speed) |
80 | { | 80 | { |
81 | ide_hwif_t *hwif = HWIF(drive); | 81 | ide_hwif_t *hwif = HWIF(drive); |
82 | struct pci_dev *dev = hwif->pci_dev; | 82 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
83 | u8 maslave = hwif->channel ? 0x42 : 0x40; | 83 | u8 maslave = hwif->channel ? 0x42 : 0x40; |
84 | int sitre = 0, a_speed = 7 << (drive->dn * 4); | 84 | int sitre = 0, a_speed = 7 << (drive->dn * 4); |
85 | int u_speed = 0, u_flag = 1 << drive->dn; | 85 | int u_speed = 0, u_flag = 1 << drive->dn; |
@@ -122,13 +122,14 @@ static void slc90e66_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
122 | 122 | ||
123 | static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif) | 123 | static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif) |
124 | { | 124 | { |
125 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
125 | u8 reg47 = 0; | 126 | u8 reg47 = 0; |
126 | u8 mask = hwif->channel ? 0x01 : 0x02; /* bit0:Primary */ | 127 | u8 mask = hwif->channel ? 0x01 : 0x02; /* bit0:Primary */ |
127 | 128 | ||
128 | hwif->set_pio_mode = &slc90e66_set_pio_mode; | 129 | hwif->set_pio_mode = &slc90e66_set_pio_mode; |
129 | hwif->set_dma_mode = &slc90e66_set_dma_mode; | 130 | hwif->set_dma_mode = &slc90e66_set_dma_mode; |
130 | 131 | ||
131 | pci_read_config_byte(hwif->pci_dev, 0x47, ®47); | 132 | pci_read_config_byte(dev, 0x47, ®47); |
132 | 133 | ||
133 | if (hwif->dma_base == 0) | 134 | if (hwif->dma_base == 0) |
134 | return; | 135 | return; |
diff --git a/drivers/ide/pci/tc86c001.c b/drivers/ide/pci/tc86c001.c index e1faf6c2fe16..ea84b9ea7800 100644 --- a/drivers/ide/pci/tc86c001.c +++ b/drivers/ide/pci/tc86c001.c | |||
@@ -164,7 +164,8 @@ static int tc86c001_busproc(ide_drive_t *drive, int state) | |||
164 | 164 | ||
165 | static void __devinit init_hwif_tc86c001(ide_hwif_t *hwif) | 165 | static void __devinit init_hwif_tc86c001(ide_hwif_t *hwif) |
166 | { | 166 | { |
167 | unsigned long sc_base = pci_resource_start(hwif->pci_dev, 5); | 167 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
168 | unsigned long sc_base = pci_resource_start(dev, 5); | ||
168 | u16 scr1 = inw(sc_base + 0x00); | 169 | u16 scr1 = inw(sc_base + 0x00); |
169 | 170 | ||
170 | /* System Control 1 Register bit 15 (Soft Reset) set */ | 171 | /* System Control 1 Register bit 15 (Soft Reset) set */ |
diff --git a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c index ae52a96a1cf9..ca49cd7f9555 100644 --- a/drivers/ide/pci/triflex.c +++ b/drivers/ide/pci/triflex.c | |||
@@ -43,7 +43,7 @@ | |||
43 | static void triflex_set_mode(ide_drive_t *drive, const u8 speed) | 43 | static void triflex_set_mode(ide_drive_t *drive, const u8 speed) |
44 | { | 44 | { |
45 | ide_hwif_t *hwif = HWIF(drive); | 45 | ide_hwif_t *hwif = HWIF(drive); |
46 | struct pci_dev *dev = hwif->pci_dev; | 46 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
47 | u8 channel_offset = hwif->channel ? 0x74 : 0x70; | 47 | u8 channel_offset = hwif->channel ? 0x74 : 0x70; |
48 | u16 timing = 0; | 48 | u16 timing = 0; |
49 | u32 triflex_timings = 0; | 49 | u32 triflex_timings = 0; |
diff --git a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c index 7b0338890699..0a29d508168f 100644 --- a/drivers/ide/pci/trm290.c +++ b/drivers/ide/pci/trm290.c | |||
@@ -245,7 +245,7 @@ static void trm290_dma_host_set(ide_drive_t *drive, int on) | |||
245 | 245 | ||
246 | static void __devinit init_hwif_trm290(ide_hwif_t *hwif) | 246 | static void __devinit init_hwif_trm290(ide_hwif_t *hwif) |
247 | { | 247 | { |
248 | struct pci_dev *dev = hwif->pci_dev; | 248 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
249 | unsigned int cfg_base = pci_resource_start(dev, 4); | 249 | unsigned int cfg_base = pci_resource_start(dev, 4); |
250 | unsigned long flags; | 250 | unsigned long flags; |
251 | u8 reg = 0; | 251 | u8 reg = 0; |
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index 4b32c90f4896..37de25b16b34 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c | |||
@@ -121,8 +121,8 @@ struct via82cxxx_dev | |||
121 | 121 | ||
122 | static void via_set_speed(ide_hwif_t *hwif, u8 dn, struct ide_timing *timing) | 122 | static void via_set_speed(ide_hwif_t *hwif, u8 dn, struct ide_timing *timing) |
123 | { | 123 | { |
124 | struct pci_dev *dev = hwif->pci_dev; | 124 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
125 | struct via82cxxx_dev *vdev = pci_get_drvdata(hwif->pci_dev); | 125 | struct via82cxxx_dev *vdev = pci_get_drvdata(dev); |
126 | u8 t; | 126 | u8 t; |
127 | 127 | ||
128 | if (~vdev->via_config->flags & VIA_BAD_AST) { | 128 | if (~vdev->via_config->flags & VIA_BAD_AST) { |
@@ -159,8 +159,10 @@ static void via_set_speed(ide_hwif_t *hwif, u8 dn, struct ide_timing *timing) | |||
159 | 159 | ||
160 | static void via_set_drive(ide_drive_t *drive, const u8 speed) | 160 | static void via_set_drive(ide_drive_t *drive, const u8 speed) |
161 | { | 161 | { |
162 | ide_drive_t *peer = HWIF(drive)->drives + (~drive->dn & 1); | 162 | ide_hwif_t *hwif = drive->hwif; |
163 | struct via82cxxx_dev *vdev = pci_get_drvdata(drive->hwif->pci_dev); | 163 | ide_drive_t *peer = hwif->drives + (~drive->dn & 1); |
164 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
165 | struct via82cxxx_dev *vdev = pci_get_drvdata(dev); | ||
164 | struct ide_timing t, p; | 166 | struct ide_timing t, p; |
165 | unsigned int T, UT; | 167 | unsigned int T, UT; |
166 | 168 | ||
@@ -408,7 +410,7 @@ static int via_cable_override(struct pci_dev *pdev) | |||
408 | 410 | ||
409 | static u8 __devinit via82cxxx_cable_detect(ide_hwif_t *hwif) | 411 | static u8 __devinit via82cxxx_cable_detect(ide_hwif_t *hwif) |
410 | { | 412 | { |
411 | struct pci_dev *pdev = hwif->pci_dev; | 413 | struct pci_dev *pdev = to_pci_dev(hwif->dev); |
412 | struct via82cxxx_dev *vdev = pci_get_drvdata(pdev); | 414 | struct via82cxxx_dev *vdev = pci_get_drvdata(pdev); |
413 | 415 | ||
414 | if (via_cable_override(pdev)) | 416 | if (via_cable_override(pdev)) |
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index 1d6af8824219..b17e097650b1 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
@@ -1200,7 +1200,7 @@ pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match) | |||
1200 | base = ioremap(macio_resource_start(mdev, 0), 0x400); | 1200 | base = ioremap(macio_resource_start(mdev, 0), 0x400); |
1201 | regbase = (unsigned long) base; | 1201 | regbase = (unsigned long) base; |
1202 | 1202 | ||
1203 | hwif->pci_dev = mdev->bus->pdev; | 1203 | hwif->dev = &mdev->bus->pdev->dev; |
1204 | 1204 | ||
1205 | pmif->mdev = mdev; | 1205 | pmif->mdev = mdev; |
1206 | pmif->node = mdev->ofdev.node; | 1206 | pmif->node = mdev->ofdev.node; |
@@ -1315,7 +1315,7 @@ pmac_ide_pci_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1315 | return -ENXIO; | 1315 | return -ENXIO; |
1316 | } | 1316 | } |
1317 | 1317 | ||
1318 | hwif->pci_dev = pdev; | 1318 | hwif->dev = &pdev->dev; |
1319 | pmif->mdev = NULL; | 1319 | pmif->mdev = NULL; |
1320 | pmif->node = np; | 1320 | pmif->node = np; |
1321 | 1321 | ||
@@ -1725,10 +1725,12 @@ pmac_ide_dma_lost_irq (ide_drive_t *drive) | |||
1725 | static void __devinit | 1725 | static void __devinit |
1726 | pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) | 1726 | pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) |
1727 | { | 1727 | { |
1728 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
1729 | |||
1728 | /* We won't need pci_dev if we switch to generic consistent | 1730 | /* We won't need pci_dev if we switch to generic consistent |
1729 | * DMA routines ... | 1731 | * DMA routines ... |
1730 | */ | 1732 | */ |
1731 | if (hwif->pci_dev == NULL) | 1733 | if (dev == NULL) |
1732 | return; | 1734 | return; |
1733 | /* | 1735 | /* |
1734 | * Allocate space for the DBDMA commands. | 1736 | * Allocate space for the DBDMA commands. |
@@ -1736,7 +1738,7 @@ pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) | |||
1736 | * aligning the start address to a multiple of 16 bytes. | 1738 | * aligning the start address to a multiple of 16 bytes. |
1737 | */ | 1739 | */ |
1738 | pmif->dma_table_cpu = (struct dbdma_cmd*)pci_alloc_consistent( | 1740 | pmif->dma_table_cpu = (struct dbdma_cmd*)pci_alloc_consistent( |
1739 | hwif->pci_dev, | 1741 | dev, |
1740 | (MAX_DCMDS + 2) * sizeof(struct dbdma_cmd), | 1742 | (MAX_DCMDS + 2) * sizeof(struct dbdma_cmd), |
1741 | &hwif->dmatable_dma); | 1743 | &hwif->dmatable_dma); |
1742 | if (pmif->dma_table_cpu == NULL) { | 1744 | if (pmif->dma_table_cpu == NULL) { |
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index 0a4b3a6857e1..6b41d6c2433e 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c | |||
@@ -162,8 +162,8 @@ static void ide_pci_clear_simplex(unsigned long dma_base, const char *name) | |||
162 | 162 | ||
163 | static unsigned long ide_get_or_set_dma_base(const struct ide_port_info *d, ide_hwif_t *hwif) | 163 | static unsigned long ide_get_or_set_dma_base(const struct ide_port_info *d, ide_hwif_t *hwif) |
164 | { | 164 | { |
165 | unsigned long dma_base = 0; | 165 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
166 | struct pci_dev *dev = hwif->pci_dev; | 166 | unsigned long dma_base = 0; |
167 | u8 dma_stat = 0; | 167 | u8 dma_stat = 0; |
168 | 168 | ||
169 | if (hwif->mmio) | 169 | if (hwif->mmio) |
@@ -391,7 +391,7 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, const struct ide_port | |||
391 | 391 | ||
392 | hwif->noprobe = oldnoprobe; | 392 | hwif->noprobe = oldnoprobe; |
393 | 393 | ||
394 | hwif->pci_dev = dev; | 394 | hwif->dev = &dev->dev; |
395 | hwif->cds = d; | 395 | hwif->cds = d; |
396 | hwif->channel = port; | 396 | hwif->channel = port; |
397 | 397 | ||
diff --git a/include/linux/ide.h b/include/linux/ide.h index af352cc41db5..ae965a3de9e4 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -503,7 +503,8 @@ typedef struct hwif_s { | |||
503 | 503 | ||
504 | hwif_chipset_t chipset; /* sub-module for tuning.. */ | 504 | hwif_chipset_t chipset; /* sub-module for tuning.. */ |
505 | 505 | ||
506 | struct pci_dev *pci_dev; /* for pci chipsets */ | 506 | struct device *dev; |
507 | |||
507 | const struct ide_port_info *cds; /* chipset device struct */ | 508 | const struct ide_port_info *cds; /* chipset device struct */ |
508 | 509 | ||
509 | ide_ack_intr_t *ack_intr; | 510 | ide_ack_intr_t *ack_intr; |
@@ -1299,7 +1300,7 @@ static inline void ide_dump_identify(u8 *id) | |||
1299 | 1300 | ||
1300 | static inline int hwif_to_node(ide_hwif_t *hwif) | 1301 | static inline int hwif_to_node(ide_hwif_t *hwif) |
1301 | { | 1302 | { |
1302 | struct pci_dev *dev = hwif->pci_dev; | 1303 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
1303 | return dev ? pcibus_to_node(dev->bus) : -1; | 1304 | return dev ? pcibus_to_node(dev->bus) : -1; |
1304 | } | 1305 | } |
1305 | 1306 | ||