aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:55:57 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:55:57 -0400
commite0d0020788543febd10ab933bde0fa181b627f4f (patch)
tree939f6d15075cda41d0efdc4c4e3b569e480ceedf /drivers
parent6f904d015262dfa43eb1cecc00b0998b4c3543f2 (diff)
ide: fix ide_host_register() return value
Fix ide_host_register() to fail only if all ports cannot be registered. While at it: * Use host->ports[] instead of ide_hwifs[] and remove idx[]. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ide/ide-probe.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 17a104b95d54..32261282371a 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1574,19 +1574,16 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d,
1574 hw_regs_t **hws) 1574 hw_regs_t **hws)
1575{ 1575{
1576 ide_hwif_t *hwif, *mate = NULL; 1576 ide_hwif_t *hwif, *mate = NULL;
1577 u8 idx[MAX_HWIFS]; 1577 int i, j = 0;
1578 int i, rc = 0;
1579 1578
1580 for (i = 0; i < MAX_HWIFS; i++) { 1579 for (i = 0; i < MAX_HWIFS; i++) {
1581 idx[i] = host->ports[i] ? host->ports[i]->index : 0xff; 1580 hwif = host->ports[i];
1582 1581
1583 if (idx[i] == 0xff) { 1582 if (hwif == NULL) {
1584 mate = NULL; 1583 mate = NULL;
1585 continue; 1584 continue;
1586 } 1585 }
1587 1586
1588 hwif = &ide_hwifs[idx[i]];
1589
1590 ide_init_port_hw(hwif, hws[i]); 1587 ide_init_port_hw(hwif, hws[i]);
1591 ide_port_apply_params(hwif); 1588 ide_port_apply_params(hwif);
1592 1589
@@ -1608,10 +1605,10 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d,
1608 } 1605 }
1609 1606
1610 for (i = 0; i < MAX_HWIFS; i++) { 1607 for (i = 0; i < MAX_HWIFS; i++) {
1611 if (idx[i] == 0xff) 1608 hwif = host->ports[i];
1612 continue;
1613 1609
1614 hwif = &ide_hwifs[idx[i]]; 1610 if (hwif == NULL)
1611 continue;
1615 1612
1616 if (ide_probe_port(hwif) == 0) 1613 if (ide_probe_port(hwif) == 0)
1617 hwif->present = 1; 1614 hwif->present = 1;
@@ -1625,19 +1622,20 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d,
1625 } 1622 }
1626 1623
1627 for (i = 0; i < MAX_HWIFS; i++) { 1624 for (i = 0; i < MAX_HWIFS; i++) {
1628 if (idx[i] == 0xff) 1625 hwif = host->ports[i];
1629 continue;
1630 1626
1631 hwif = &ide_hwifs[idx[i]]; 1627 if (hwif == NULL)
1628 continue;
1632 1629
1633 if (hwif_init(hwif) == 0) { 1630 if (hwif_init(hwif) == 0) {
1634 printk(KERN_INFO "%s: failed to initialize IDE " 1631 printk(KERN_INFO "%s: failed to initialize IDE "
1635 "interface\n", hwif->name); 1632 "interface\n", hwif->name);
1636 hwif->present = 0; 1633 hwif->present = 0;
1637 rc = -1;
1638 continue; 1634 continue;
1639 } 1635 }
1640 1636
1637 j++;
1638
1641 if (hwif->present) 1639 if (hwif->present)
1642 ide_port_setup_devices(hwif); 1640 ide_port_setup_devices(hwif);
1643 1641
@@ -1648,10 +1646,10 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d,
1648 } 1646 }
1649 1647
1650 for (i = 0; i < MAX_HWIFS; i++) { 1648 for (i = 0; i < MAX_HWIFS; i++) {
1651 if (idx[i] == 0xff) 1649 hwif = host->ports[i];
1652 continue;
1653 1650
1654 hwif = &ide_hwifs[idx[i]]; 1651 if (hwif == NULL)
1652 continue;
1655 1653
1656 if (hwif->chipset == ide_unknown) 1654 if (hwif->chipset == ide_unknown)
1657 hwif->chipset = ide_generic; 1655 hwif->chipset = ide_generic;
@@ -1661,10 +1659,10 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d,
1661 } 1659 }
1662 1660
1663 for (i = 0; i < MAX_HWIFS; i++) { 1661 for (i = 0; i < MAX_HWIFS; i++) {
1664 if (idx[i] == 0xff) 1662 hwif = host->ports[i];
1665 continue;
1666 1663
1667 hwif = &ide_hwifs[idx[i]]; 1664 if (hwif == NULL)
1665 continue;
1668 1666
1669 ide_sysfs_register_port(hwif); 1667 ide_sysfs_register_port(hwif);
1670 ide_proc_register_port(hwif); 1668 ide_proc_register_port(hwif);
@@ -1673,7 +1671,7 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d,
1673 ide_proc_port_register_devices(hwif); 1671 ide_proc_port_register_devices(hwif);
1674 } 1672 }
1675 1673
1676 return rc; 1674 return j ? 0 : -1;
1677} 1675}
1678EXPORT_SYMBOL_GPL(ide_host_register); 1676EXPORT_SYMBOL_GPL(ide_host_register);
1679 1677