diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ide/arm/icside.c | 13 | ||||
-rw-r--r-- | drivers/ide/arm/rapide.c | 8 | ||||
-rw-r--r-- | drivers/ide/ide-probe.c | 23 | ||||
-rw-r--r-- | drivers/ide/ide-proc.c | 2 | ||||
-rw-r--r-- | drivers/ide/ide.c | 7 | ||||
-rw-r--r-- | drivers/ide/legacy/ali14xx.c | 7 | ||||
-rw-r--r-- | drivers/ide/legacy/dtc2278.c | 7 | ||||
-rw-r--r-- | drivers/ide/legacy/ht6560b.c | 7 | ||||
-rw-r--r-- | drivers/ide/legacy/ide_platform.c | 6 | ||||
-rw-r--r-- | drivers/ide/legacy/qd65xx.c | 21 | ||||
-rw-r--r-- | drivers/ide/legacy/umc8672.c | 9 | ||||
-rw-r--r-- | drivers/ide/mips/au1xxx-ide.c | 5 | ||||
-rw-r--r-- | drivers/ide/mips/swarm.c | 5 | ||||
-rw-r--r-- | drivers/ide/pci/cs5520.c | 22 | ||||
-rw-r--r-- | drivers/ide/pci/sgiioc4.c | 8 | ||||
-rw-r--r-- | drivers/ide/ppc/pmac.c | 6 | ||||
-rw-r--r-- | drivers/ide/setup-pci.c | 67 |
17 files changed, 89 insertions, 134 deletions
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index 3af33fbf1f88..6298932c0589 100644 --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c | |||
@@ -500,6 +500,7 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec) | |||
500 | { | 500 | { |
501 | ide_hwif_t *hwif; | 501 | ide_hwif_t *hwif; |
502 | void __iomem *base; | 502 | void __iomem *base; |
503 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
503 | 504 | ||
504 | base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0); | 505 | base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0); |
505 | if (!base) | 506 | if (!base) |
@@ -523,9 +524,9 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec) | |||
523 | 524 | ||
524 | state->hwif[0] = hwif; | 525 | state->hwif[0] = hwif; |
525 | 526 | ||
526 | probe_hwif_init(hwif); | 527 | idx[0] = hwif->index; |
527 | 528 | ||
528 | ide_proc_register_port(hwif); | 529 | ide_device_add(idx); |
529 | 530 | ||
530 | return 0; | 531 | return 0; |
531 | } | 532 | } |
@@ -537,6 +538,7 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) | |||
537 | void __iomem *ioc_base, *easi_base; | 538 | void __iomem *ioc_base, *easi_base; |
538 | unsigned int sel = 0; | 539 | unsigned int sel = 0; |
539 | int ret; | 540 | int ret; |
541 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
540 | 542 | ||
541 | ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); | 543 | ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); |
542 | if (!ioc_base) { | 544 | if (!ioc_base) { |
@@ -608,11 +610,10 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) | |||
608 | icside_dma_init(mate); | 610 | icside_dma_init(mate); |
609 | } | 611 | } |
610 | 612 | ||
611 | probe_hwif_init(hwif); | 613 | idx[0] = hwif->index; |
612 | probe_hwif_init(mate); | 614 | idx[1] = mate->index; |
613 | 615 | ||
614 | ide_proc_register_port(hwif); | 616 | ide_device_add(idx); |
615 | ide_proc_register_port(mate); | ||
616 | 617 | ||
617 | return 0; | 618 | return 0; |
618 | 619 | ||
diff --git a/drivers/ide/arm/rapide.c b/drivers/ide/arm/rapide.c index 83811af11610..6d2fe21cd729 100644 --- a/drivers/ide/arm/rapide.c +++ b/drivers/ide/arm/rapide.c | |||
@@ -58,6 +58,7 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id) | |||
58 | ide_hwif_t *hwif; | 58 | ide_hwif_t *hwif; |
59 | void __iomem *base; | 59 | void __iomem *base; |
60 | int ret; | 60 | int ret; |
61 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
61 | 62 | ||
62 | ret = ecard_request_resources(ec); | 63 | ret = ecard_request_resources(ec); |
63 | if (ret) | 64 | if (ret) |
@@ -74,8 +75,11 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id) | |||
74 | hwif->hwif_data = base; | 75 | hwif->hwif_data = base; |
75 | hwif->gendev.parent = &ec->dev; | 76 | hwif->gendev.parent = &ec->dev; |
76 | hwif->noprobe = 0; | 77 | hwif->noprobe = 0; |
77 | probe_hwif_init(hwif); | 78 | |
78 | ide_proc_register_port(hwif); | 79 | idx[0] = hwif->index; |
80 | |||
81 | ide_device_add(idx); | ||
82 | |||
79 | ecard_set_drvdata(ec, hwif); | 83 | ecard_set_drvdata(ec, hwif); |
80 | goto out; | 84 | goto out; |
81 | } | 85 | } |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index c6ba439b1435..d5146c57e5b3 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -861,7 +861,7 @@ static void probe_hwif(ide_hwif_t *hwif) | |||
861 | static int hwif_init(ide_hwif_t *hwif); | 861 | static int hwif_init(ide_hwif_t *hwif); |
862 | static void hwif_register_devices(ide_hwif_t *hwif); | 862 | static void hwif_register_devices(ide_hwif_t *hwif); |
863 | 863 | ||
864 | int probe_hwif_init(ide_hwif_t *hwif) | 864 | static int probe_hwif_init(ide_hwif_t *hwif) |
865 | { | 865 | { |
866 | probe_hwif(hwif); | 866 | probe_hwif(hwif); |
867 | 867 | ||
@@ -877,8 +877,6 @@ int probe_hwif_init(ide_hwif_t *hwif) | |||
877 | return 0; | 877 | return 0; |
878 | } | 878 | } |
879 | 879 | ||
880 | EXPORT_SYMBOL(probe_hwif_init); | ||
881 | |||
882 | #if MAX_HWIFS > 1 | 880 | #if MAX_HWIFS > 1 |
883 | /* | 881 | /* |
884 | * save_match() is used to simplify logic in init_irq() below. | 882 | * save_match() is used to simplify logic in init_irq() below. |
@@ -1410,3 +1408,22 @@ int ideprobe_init (void) | |||
1410 | } | 1408 | } |
1411 | 1409 | ||
1412 | EXPORT_SYMBOL_GPL(ideprobe_init); | 1410 | EXPORT_SYMBOL_GPL(ideprobe_init); |
1411 | |||
1412 | int ide_device_add(u8 idx[4]) | ||
1413 | { | ||
1414 | int i, rc = 0; | ||
1415 | |||
1416 | for (i = 0; i < 4; i++) { | ||
1417 | if (idx[i] != 0xff) | ||
1418 | rc |= probe_hwif_init(&ide_hwifs[idx[i]]); | ||
1419 | } | ||
1420 | |||
1421 | for (i = 0; i < 4; i++) { | ||
1422 | if (idx[i] != 0xff) | ||
1423 | ide_proc_register_port(&ide_hwifs[idx[i]]); | ||
1424 | } | ||
1425 | |||
1426 | return rc; | ||
1427 | } | ||
1428 | |||
1429 | EXPORT_SYMBOL_GPL(ide_device_add); | ||
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c index fc1d8ae6a803..a4007d30da52 100644 --- a/drivers/ide/ide-proc.c +++ b/drivers/ide/ide-proc.c | |||
@@ -804,8 +804,6 @@ void ide_proc_register_port(ide_hwif_t *hwif) | |||
804 | create_proc_ide_drives(hwif); | 804 | create_proc_ide_drives(hwif); |
805 | } | 805 | } |
806 | 806 | ||
807 | EXPORT_SYMBOL_GPL(ide_proc_register_port); | ||
808 | |||
809 | #ifdef CONFIG_BLK_DEV_IDEPCI | 807 | #ifdef CONFIG_BLK_DEV_IDEPCI |
810 | void ide_pci_create_host_proc(const char *name, get_info_t *get_info) | 808 | void ide_pci_create_host_proc(const char *name, get_info_t *get_info) |
811 | { | 809 | { |
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 35f24b9b8219..15741367eb35 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
@@ -715,9 +715,10 @@ found: | |||
715 | hwif->chipset = hw->chipset; | 715 | hwif->chipset = hw->chipset; |
716 | hwif->gendev.parent = hw->dev; | 716 | hwif->gendev.parent = hw->dev; |
717 | 717 | ||
718 | if (!initializing) { | 718 | if (initializing == 0) { |
719 | probe_hwif_init(hwif); | 719 | u8 idx[4] = { index, 0xff, 0xff, 0xff }; |
720 | ide_proc_register_port(hwif); | 720 | |
721 | ide_device_add(idx); | ||
721 | } | 722 | } |
722 | 723 | ||
723 | if (hwifp) | 724 | if (hwifp) |
diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c index 2f0ef9b44033..0973c85e49b7 100644 --- a/drivers/ide/legacy/ali14xx.c +++ b/drivers/ide/legacy/ali14xx.c | |||
@@ -193,6 +193,7 @@ static int __init initRegisters (void) { | |||
193 | static int __init ali14xx_probe(void) | 193 | static int __init ali14xx_probe(void) |
194 | { | 194 | { |
195 | ide_hwif_t *hwif, *mate; | 195 | ide_hwif_t *hwif, *mate; |
196 | static u8 idx[4] = { 0, 1, 0xff, 0xff }; | ||
196 | 197 | ||
197 | printk(KERN_DEBUG "ali14xx: base=0x%03x, regOn=0x%02x.\n", | 198 | printk(KERN_DEBUG "ali14xx: base=0x%03x, regOn=0x%02x.\n", |
198 | basePort, regOn); | 199 | basePort, regOn); |
@@ -217,11 +218,7 @@ static int __init ali14xx_probe(void) | |||
217 | mate->mate = hwif; | 218 | mate->mate = hwif; |
218 | mate->channel = 1; | 219 | mate->channel = 1; |
219 | 220 | ||
220 | probe_hwif_init(hwif); | 221 | ide_device_add(idx); |
221 | probe_hwif_init(mate); | ||
222 | |||
223 | ide_proc_register_port(hwif); | ||
224 | ide_proc_register_port(mate); | ||
225 | 222 | ||
226 | return 0; | 223 | return 0; |
227 | } | 224 | } |
diff --git a/drivers/ide/legacy/dtc2278.c b/drivers/ide/legacy/dtc2278.c index f16521254867..12a7182b4ad3 100644 --- a/drivers/ide/legacy/dtc2278.c +++ b/drivers/ide/legacy/dtc2278.c | |||
@@ -94,6 +94,7 @@ static int __init dtc2278_probe(void) | |||
94 | { | 94 | { |
95 | unsigned long flags; | 95 | unsigned long flags; |
96 | ide_hwif_t *hwif, *mate; | 96 | ide_hwif_t *hwif, *mate; |
97 | static u8 idx[4] = { 0, 1, 0xff, 0xff }; | ||
97 | 98 | ||
98 | hwif = &ide_hwifs[0]; | 99 | hwif = &ide_hwifs[0]; |
99 | mate = &ide_hwifs[1]; | 100 | mate = &ide_hwifs[1]; |
@@ -134,11 +135,7 @@ static int __init dtc2278_probe(void) | |||
134 | mate->mate = hwif; | 135 | mate->mate = hwif; |
135 | mate->channel = 1; | 136 | mate->channel = 1; |
136 | 137 | ||
137 | probe_hwif_init(hwif); | 138 | ide_device_add(idx); |
138 | probe_hwif_init(mate); | ||
139 | |||
140 | ide_proc_register_port(hwif); | ||
141 | ide_proc_register_port(mate); | ||
142 | 139 | ||
143 | return 0; | 140 | return 0; |
144 | } | 141 | } |
diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c index 2e5a9cc5c0f7..7f0d433cb9d8 100644 --- a/drivers/ide/legacy/ht6560b.c +++ b/drivers/ide/legacy/ht6560b.c | |||
@@ -311,6 +311,7 @@ MODULE_PARM_DESC(probe, "probe for HT6560B chipset"); | |||
311 | int __init ht6560b_init(void) | 311 | int __init ht6560b_init(void) |
312 | { | 312 | { |
313 | ide_hwif_t *hwif, *mate; | 313 | ide_hwif_t *hwif, *mate; |
314 | static u8 idx[4] = { 0, 1, 0xff, 0xff }; | ||
314 | int t; | 315 | int t; |
315 | 316 | ||
316 | if (probe_ht6560b == 0) | 317 | if (probe_ht6560b == 0) |
@@ -359,11 +360,7 @@ int __init ht6560b_init(void) | |||
359 | mate->drives[0].drive_data = t; | 360 | mate->drives[0].drive_data = t; |
360 | mate->drives[1].drive_data = t; | 361 | mate->drives[1].drive_data = t; |
361 | 362 | ||
362 | probe_hwif_init(hwif); | 363 | ide_device_add(idx); |
363 | probe_hwif_init(mate); | ||
364 | |||
365 | ide_proc_register_port(hwif); | ||
366 | ide_proc_register_port(mate); | ||
367 | 364 | ||
368 | return 0; | 365 | return 0; |
369 | 366 | ||
diff --git a/drivers/ide/legacy/ide_platform.c b/drivers/ide/legacy/ide_platform.c index b992b2b91fe2..9a153915f3cf 100644 --- a/drivers/ide/legacy/ide_platform.c +++ b/drivers/ide/legacy/ide_platform.c | |||
@@ -83,6 +83,7 @@ static int __devinit plat_ide_probe(struct platform_device *pdev) | |||
83 | struct resource *res_base, *res_alt, *res_irq; | 83 | struct resource *res_base, *res_alt, *res_irq; |
84 | ide_hwif_t *hwif; | 84 | ide_hwif_t *hwif; |
85 | struct pata_platform_info *pdata; | 85 | struct pata_platform_info *pdata; |
86 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
86 | int ret = 0; | 87 | int ret = 0; |
87 | int mmio = 0; | 88 | int mmio = 0; |
88 | 89 | ||
@@ -130,10 +131,11 @@ static int __devinit plat_ide_probe(struct platform_device *pdev) | |||
130 | hwif->gendev.parent = &pdev->dev; | 131 | hwif->gendev.parent = &pdev->dev; |
131 | hwif->noprobe = 0; | 132 | hwif->noprobe = 0; |
132 | 133 | ||
133 | probe_hwif_init(hwif); | 134 | idx[0] = hwif->index; |
135 | |||
136 | ide_device_add(idx); | ||
134 | 137 | ||
135 | platform_set_drvdata(pdev, hwif); | 138 | platform_set_drvdata(pdev, hwif); |
136 | ide_proc_register_port(hwif); | ||
137 | 139 | ||
138 | return 0; | 140 | return 0; |
139 | 141 | ||
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c index 0c81d2d0b941..85104bc79a1d 100644 --- a/drivers/ide/legacy/qd65xx.c +++ b/drivers/ide/legacy/qd65xx.c | |||
@@ -389,6 +389,7 @@ static void __exit qd_unsetup(ide_hwif_t *hwif) | |||
389 | static int __init qd_probe(int base) | 389 | static int __init qd_probe(int base) |
390 | { | 390 | { |
391 | ide_hwif_t *hwif; | 391 | ide_hwif_t *hwif; |
392 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
392 | u8 config; | 393 | u8 config; |
393 | u8 unit; | 394 | u8 unit; |
394 | 395 | ||
@@ -419,9 +420,9 @@ static int __init qd_probe(int base) | |||
419 | 420 | ||
420 | hwif->set_pio_mode = &qd6500_set_pio_mode; | 421 | hwif->set_pio_mode = &qd6500_set_pio_mode; |
421 | 422 | ||
422 | probe_hwif_init(hwif); | 423 | idx[0] = unit; |
423 | 424 | ||
424 | ide_proc_register_port(hwif); | 425 | ide_device_add(idx); |
425 | 426 | ||
426 | return 1; | 427 | return 1; |
427 | } | 428 | } |
@@ -453,11 +454,11 @@ static int __init qd_probe(int base) | |||
453 | 454 | ||
454 | hwif->set_pio_mode = &qd6580_set_pio_mode; | 455 | hwif->set_pio_mode = &qd6580_set_pio_mode; |
455 | 456 | ||
456 | probe_hwif_init(hwif); | 457 | idx[0] = unit; |
457 | 458 | ||
458 | qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT); | 459 | ide_device_add(idx); |
459 | 460 | ||
460 | ide_proc_register_port(hwif); | 461 | qd_write_reg(QD_DEF_CONTR, QD_CONTROL_PORT); |
461 | 462 | ||
462 | return 1; | 463 | return 1; |
463 | } else { | 464 | } else { |
@@ -474,19 +475,17 @@ static int __init qd_probe(int base) | |||
474 | 475 | ||
475 | hwif->set_pio_mode = &qd6580_set_pio_mode; | 476 | hwif->set_pio_mode = &qd6580_set_pio_mode; |
476 | 477 | ||
477 | probe_hwif_init(hwif); | ||
478 | |||
479 | qd_setup(mate, base, config | (control << 8), | 478 | qd_setup(mate, base, config | (control << 8), |
480 | QD6580_DEF_DATA2, QD6580_DEF_DATA2); | 479 | QD6580_DEF_DATA2, QD6580_DEF_DATA2); |
481 | 480 | ||
482 | mate->set_pio_mode = &qd6580_set_pio_mode; | 481 | mate->set_pio_mode = &qd6580_set_pio_mode; |
483 | 482 | ||
484 | probe_hwif_init(mate); | 483 | idx[0] = 0; |
484 | idx[1] = 1; | ||
485 | 485 | ||
486 | qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT); | 486 | ide_device_add(idx); |
487 | 487 | ||
488 | ide_proc_register_port(hwif); | 488 | qd_write_reg(QD_DEF_CONTR, QD_CONTROL_PORT); |
489 | ide_proc_register_port(mate); | ||
490 | 489 | ||
491 | return 0; /* no other qd65xx possible */ | 490 | return 0; /* no other qd65xx possible */ |
492 | } | 491 | } |
diff --git a/drivers/ide/legacy/umc8672.c b/drivers/ide/legacy/umc8672.c index 1151c92dd531..79577b916874 100644 --- a/drivers/ide/legacy/umc8672.c +++ b/drivers/ide/legacy/umc8672.c | |||
@@ -124,8 +124,9 @@ static void umc_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
124 | 124 | ||
125 | static int __init umc8672_probe(void) | 125 | static int __init umc8672_probe(void) |
126 | { | 126 | { |
127 | unsigned long flags; | ||
128 | ide_hwif_t *hwif, *mate; | 127 | ide_hwif_t *hwif, *mate; |
128 | unsigned long flags; | ||
129 | static u8 idx[4] = { 0, 1, 0xff, 0xff }; | ||
129 | 130 | ||
130 | if (!request_region(0x108, 2, "umc8672")) { | 131 | if (!request_region(0x108, 2, "umc8672")) { |
131 | printk(KERN_ERR "umc8672: ports 0x108-0x109 already in use.\n"); | 132 | printk(KERN_ERR "umc8672: ports 0x108-0x109 already in use.\n"); |
@@ -158,11 +159,7 @@ static int __init umc8672_probe(void) | |||
158 | mate->mate = hwif; | 159 | mate->mate = hwif; |
159 | mate->channel = 1; | 160 | mate->channel = 1; |
160 | 161 | ||
161 | probe_hwif_init(hwif); | 162 | ide_device_add(idx); |
162 | probe_hwif_init(mate); | ||
163 | |||
164 | ide_proc_register_port(hwif); | ||
165 | ide_proc_register_port(mate); | ||
166 | 163 | ||
167 | return 0; | 164 | return 0; |
168 | } | 165 | } |
diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c index 2f322d7e881b..be43024a359c 100644 --- a/drivers/ide/mips/au1xxx-ide.c +++ b/drivers/ide/mips/au1xxx-ide.c | |||
@@ -603,6 +603,7 @@ static int au_ide_probe(struct device *dev) | |||
603 | struct resource *res; | 603 | struct resource *res; |
604 | hw_regs_t *hw; | 604 | hw_regs_t *hw; |
605 | int ret = 0; | 605 | int ret = 0; |
606 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
606 | 607 | ||
607 | #if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) | 608 | #if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) |
608 | char *mode = "MWDMA2"; | 609 | char *mode = "MWDMA2"; |
@@ -717,9 +718,9 @@ static int au_ide_probe(struct device *dev) | |||
717 | dbdma_init_done = 1; | 718 | dbdma_init_done = 1; |
718 | #endif | 719 | #endif |
719 | 720 | ||
720 | probe_hwif_init(hwif); | 721 | idx[0] = hwif->index; |
721 | 722 | ||
722 | ide_proc_register_port(hwif); | 723 | ide_device_add(idx); |
723 | 724 | ||
724 | dev_set_drvdata(dev, hwif); | 725 | dev_set_drvdata(dev, hwif); |
725 | 726 | ||
diff --git a/drivers/ide/mips/swarm.c b/drivers/ide/mips/swarm.c index c2e29571b007..6ccc51d77e88 100644 --- a/drivers/ide/mips/swarm.c +++ b/drivers/ide/mips/swarm.c | |||
@@ -71,6 +71,7 @@ static int __devinit swarm_ide_probe(struct device *dev) | |||
71 | u8 __iomem *base; | 71 | u8 __iomem *base; |
72 | phys_t offset, size; | 72 | phys_t offset, size; |
73 | int i; | 73 | int i; |
74 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
74 | 75 | ||
75 | if (!SIBYTE_HAVE_IDE) | 76 | if (!SIBYTE_HAVE_IDE) |
76 | return -ENODEV; | 77 | return -ENODEV; |
@@ -128,9 +129,9 @@ static int __devinit swarm_ide_probe(struct device *dev) | |||
128 | memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports)); | 129 | memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports)); |
129 | hwif->irq = hwif->hw.irq; | 130 | hwif->irq = hwif->hw.irq; |
130 | 131 | ||
131 | probe_hwif_init(hwif); | 132 | idx[0] = hwif->index; |
132 | 133 | ||
133 | ide_proc_register_port(hwif); | 134 | ide_device_add(idx); |
134 | 135 | ||
135 | dev_set_drvdata(dev, hwif); | 136 | dev_set_drvdata(dev, hwif); |
136 | 137 | ||
diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c index aa98e817d385..a9e1cafee69e 100644 --- a/drivers/ide/pci/cs5520.c +++ b/drivers/ide/pci/cs5520.c | |||
@@ -154,9 +154,8 @@ static ide_pci_device_t cyrix_chipsets[] __devinitdata = { | |||
154 | 154 | ||
155 | static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 155 | static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
156 | { | 156 | { |
157 | ide_hwif_t *hwif = NULL, *mate = NULL; | ||
158 | ata_index_t index; | ||
159 | ide_pci_device_t *d = &cyrix_chipsets[id->driver_data]; | 157 | ide_pci_device_t *d = &cyrix_chipsets[id->driver_data]; |
158 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
160 | 159 | ||
161 | ide_setup_pci_noise(dev, d); | 160 | ide_setup_pci_noise(dev, d); |
162 | 161 | ||
@@ -172,29 +171,14 @@ static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_devic | |||
172 | return -ENODEV; | 171 | return -ENODEV; |
173 | } | 172 | } |
174 | 173 | ||
175 | index.all = 0xf0f0; | ||
176 | |||
177 | /* | 174 | /* |
178 | * Now the chipset is configured we can let the core | 175 | * Now the chipset is configured we can let the core |
179 | * do all the device setup for us | 176 | * do all the device setup for us |
180 | */ | 177 | */ |
181 | 178 | ||
182 | ide_pci_setup_ports(dev, d, 14, &index); | 179 | ide_pci_setup_ports(dev, d, 14, &idx[0]); |
183 | |||
184 | if ((index.b.low & 0xf0) != 0xf0) | ||
185 | hwif = &ide_hwifs[index.b.low]; | ||
186 | if ((index.b.high & 0xf0) != 0xf0) | ||
187 | mate = &ide_hwifs[index.b.high]; | ||
188 | |||
189 | if (hwif) | ||
190 | probe_hwif_init(hwif); | ||
191 | if (mate) | ||
192 | probe_hwif_init(mate); | ||
193 | 180 | ||
194 | if (hwif) | 181 | ide_device_add(idx); |
195 | ide_proc_register_port(hwif); | ||
196 | if (mate) | ||
197 | ide_proc_register_port(mate); | ||
198 | 182 | ||
199 | return 0; | 183 | return 0; |
200 | } | 184 | } |
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c index 5af74ea1d46e..f6d4b4136a89 100644 --- a/drivers/ide/pci/sgiioc4.c +++ b/drivers/ide/pci/sgiioc4.c | |||
@@ -614,6 +614,7 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) | |||
614 | void __iomem *virt_base; | 614 | void __iomem *virt_base; |
615 | ide_hwif_t *hwif; | 615 | ide_hwif_t *hwif; |
616 | int h; | 616 | int h; |
617 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
617 | 618 | ||
618 | /* | 619 | /* |
619 | * Find an empty HWIF; if none available, return -ENOMEM. | 620 | * Find an empty HWIF; if none available, return -ENOMEM. |
@@ -679,11 +680,10 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) | |||
679 | 680 | ||
680 | ide_init_sgiioc4(hwif); | 681 | ide_init_sgiioc4(hwif); |
681 | 682 | ||
682 | if (probe_hwif_init(hwif)) | 683 | idx[0] = hwif->index; |
683 | return -EIO; | ||
684 | 684 | ||
685 | /* Create /proc/ide entries */ | 685 | if (ide_device_add(idx)) |
686 | ide_proc_register_port(hwif); | 686 | return -EIO; |
687 | 687 | ||
688 | return 0; | 688 | return 0; |
689 | } | 689 | } |
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index c55479356768..959afe47c374 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
@@ -1039,6 +1039,7 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) | |||
1039 | { | 1039 | { |
1040 | struct device_node *np = pmif->node; | 1040 | struct device_node *np = pmif->node; |
1041 | const int *bidp; | 1041 | const int *bidp; |
1042 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
1042 | 1043 | ||
1043 | pmif->cable_80 = 0; | 1044 | pmif->cable_80 = 0; |
1044 | pmif->broken_dma = pmif->broken_dma_warn = 0; | 1045 | pmif->broken_dma = pmif->broken_dma_warn = 0; |
@@ -1163,10 +1164,9 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) | |||
1163 | pmac_ide_setup_dma(pmif, hwif); | 1164 | pmac_ide_setup_dma(pmif, hwif); |
1164 | #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ | 1165 | #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ |
1165 | 1166 | ||
1166 | /* We probe the hwif now */ | 1167 | idx[0] = hwif->index; |
1167 | probe_hwif_init(hwif); | ||
1168 | 1168 | ||
1169 | ide_proc_register_port(hwif); | 1169 | ide_device_add(idx); |
1170 | 1170 | ||
1171 | return 0; | 1171 | return 0; |
1172 | } | 1172 | } |
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index 4e9de2043113..252cb8c5931a 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c | |||
@@ -512,7 +512,7 @@ out: | |||
512 | * @dev: PCI device | 512 | * @dev: PCI device |
513 | * @d: IDE pci device info | 513 | * @d: IDE pci device info |
514 | * @pciirq: IRQ line | 514 | * @pciirq: IRQ line |
515 | * @index: ata index to update | 515 | * @idx: ATA index table to update |
516 | * | 516 | * |
517 | * Scan the interfaces attached to this device and do any | 517 | * Scan the interfaces attached to this device and do any |
518 | * necessary per port setup. Attach the devices and ask the | 518 | * necessary per port setup. Attach the devices and ask the |
@@ -522,15 +522,13 @@ out: | |||
522 | * but is also used directly as a helper function by some controllers | 522 | * but is also used directly as a helper function by some controllers |
523 | * where the chipset setup is not the default PCI IDE one. | 523 | * where the chipset setup is not the default PCI IDE one. |
524 | */ | 524 | */ |
525 | 525 | ||
526 | void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, ata_index_t *index) | 526 | void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, u8 *idx) |
527 | { | 527 | { |
528 | int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, port; | 528 | int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, port; |
529 | ide_hwif_t *hwif, *mate = NULL; | 529 | ide_hwif_t *hwif, *mate = NULL; |
530 | u8 tmp; | 530 | u8 tmp; |
531 | 531 | ||
532 | index->all = 0xf0f0; | ||
533 | |||
534 | /* | 532 | /* |
535 | * Set up the IDE ports | 533 | * Set up the IDE ports |
536 | */ | 534 | */ |
@@ -550,11 +548,7 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a | |||
550 | /* setup proper ancestral information */ | 548 | /* setup proper ancestral information */ |
551 | hwif->gendev.parent = &dev->dev; | 549 | hwif->gendev.parent = &dev->dev; |
552 | 550 | ||
553 | if (hwif->channel) { | 551 | *(idx + port) = hwif->index; |
554 | index->b.high = hwif->index; | ||
555 | } else { | ||
556 | index->b.low = hwif->index; | ||
557 | } | ||
558 | 552 | ||
559 | 553 | ||
560 | if (d->init_iops) | 554 | if (d->init_iops) |
@@ -620,9 +614,8 @@ EXPORT_SYMBOL_GPL(ide_pci_setup_ports); | |||
620 | * for all other chipsets, we just assume both interfaces are enabled. | 614 | * for all other chipsets, we just assume both interfaces are enabled. |
621 | */ | 615 | */ |
622 | static int do_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d, | 616 | static int do_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d, |
623 | ata_index_t *index, u8 noisy) | 617 | u8 *idx, u8 noisy) |
624 | { | 618 | { |
625 | static ata_index_t ata_index = { .b = { .low = 0xff, .high = 0xff } }; | ||
626 | int tried_config = 0; | 619 | int tried_config = 0; |
627 | int pciirq, ret; | 620 | int pciirq, ret; |
628 | 621 | ||
@@ -672,37 +665,21 @@ static int do_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d, | |||
672 | 665 | ||
673 | /* FIXME: silent failure can happen */ | 666 | /* FIXME: silent failure can happen */ |
674 | 667 | ||
675 | *index = ata_index; | 668 | ide_pci_setup_ports(dev, d, pciirq, idx); |
676 | ide_pci_setup_ports(dev, d, pciirq, index); | ||
677 | out: | 669 | out: |
678 | return ret; | 670 | return ret; |
679 | } | 671 | } |
680 | 672 | ||
681 | int ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d) | 673 | int ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d) |
682 | { | 674 | { |
683 | ide_hwif_t *hwif = NULL, *mate = NULL; | 675 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; |
684 | ata_index_t index_list; | ||
685 | int ret; | 676 | int ret; |
686 | 677 | ||
687 | ret = do_ide_setup_pci_device(dev, d, &index_list, 1); | 678 | ret = do_ide_setup_pci_device(dev, d, &idx[0], 1); |
688 | if (ret < 0) | ||
689 | goto out; | ||
690 | 679 | ||
691 | if ((index_list.b.low & 0xf0) != 0xf0) | 680 | if (ret >= 0) |
692 | hwif = &ide_hwifs[index_list.b.low]; | 681 | ide_device_add(idx); |
693 | if ((index_list.b.high & 0xf0) != 0xf0) | ||
694 | mate = &ide_hwifs[index_list.b.high]; | ||
695 | 682 | ||
696 | if (hwif) | ||
697 | probe_hwif_init(hwif); | ||
698 | if (mate) | ||
699 | probe_hwif_init(mate); | ||
700 | |||
701 | if (hwif) | ||
702 | ide_proc_register_port(hwif); | ||
703 | if (mate) | ||
704 | ide_proc_register_port(mate); | ||
705 | out: | ||
706 | return ret; | 683 | return ret; |
707 | } | 684 | } |
708 | 685 | ||
@@ -712,11 +689,11 @@ int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2, | |||
712 | ide_pci_device_t *d) | 689 | ide_pci_device_t *d) |
713 | { | 690 | { |
714 | struct pci_dev *pdev[] = { dev1, dev2 }; | 691 | struct pci_dev *pdev[] = { dev1, dev2 }; |
715 | ata_index_t index_list[2]; | ||
716 | int ret, i; | 692 | int ret, i; |
693 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
717 | 694 | ||
718 | for (i = 0; i < 2; i++) { | 695 | for (i = 0; i < 2; i++) { |
719 | ret = do_ide_setup_pci_device(pdev[i], d, index_list + i, !i); | 696 | ret = do_ide_setup_pci_device(pdev[i], d, &idx[i*2], !i); |
720 | /* | 697 | /* |
721 | * FIXME: Mom, mom, they stole me the helper function to undo | 698 | * FIXME: Mom, mom, they stole me the helper function to undo |
722 | * do_ide_setup_pci_device() on the first device! | 699 | * do_ide_setup_pci_device() on the first device! |
@@ -725,25 +702,7 @@ int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2, | |||
725 | goto out; | 702 | goto out; |
726 | } | 703 | } |
727 | 704 | ||
728 | for (i = 0; i < 2; i++) { | 705 | ide_device_add(idx); |
729 | u8 idx[2] = { index_list[i].b.low, index_list[i].b.high }; | ||
730 | int j; | ||
731 | |||
732 | for (j = 0; j < 2; j++) { | ||
733 | if ((idx[j] & 0xf0) != 0xf0) | ||
734 | probe_hwif_init(ide_hwifs + idx[j]); | ||
735 | } | ||
736 | } | ||
737 | |||
738 | for (i = 0; i < 2; i++) { | ||
739 | u8 idx[2] = { index_list[i].b.low, index_list[i].b.high }; | ||
740 | int j; | ||
741 | |||
742 | for (j = 0; j < 2; j++) { | ||
743 | if ((idx[j] & 0xf0) != 0xf0) | ||
744 | ide_proc_register_port(ide_hwifs + idx[j]); | ||
745 | } | ||
746 | } | ||
747 | out: | 706 | out: |
748 | return ret; | 707 | return ret; |
749 | } | 708 | } |