[PATCH] ieee1394: reorder activities after bus reset (fixes device detection)

Units were not detected if the local IRM performed a bus reset. ("The root
node is not cycle master capable; selecting a new root node and resetting...",
often seen with iPods and other SBP-2 devices). Rearrange the order of IRM
duties and node scanning. TODO: Audit the ROM caching and parsing code for
underlying issues.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Jody McIntyre <scjody@steamballoon.com>
Cc: Ben Collins <bcollins@debian.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Jody McIntyre and committed by
Linus Torvalds
328699bf 2bab359a

+9 -10
+9 -10
drivers/ieee1394/nodemgr.c
··· 1438 1438 if (host->busmgr_id == 0xffff && host->node_count > 1) 1439 1439 { 1440 1440 u16 root_node = host->node_count - 1; 1441 - struct node_entry *ne = find_entry_by_nodeid(host, root_node | LOCAL_BUS); 1442 1441 1443 - if (ne && ne->busopt.cmc) 1442 + /* get cycle master capability flag from root node */ 1443 + if (host->is_cycmst || 1444 + (!hpsb_read(host, LOCAL_BUS | root_node, get_hpsb_generation(host), 1445 + (CSR_REGISTER_BASE + CSR_CONFIG_ROM + 2 * sizeof(quadlet_t)), 1446 + &bc, sizeof(quadlet_t)) && 1447 + be32_to_cpu(bc) & 1 << CSR_CMC_SHIFT)) 1444 1448 hpsb_send_phy_config(host, root_node, -1); 1445 1449 else { 1446 1450 HPSB_DEBUG("The root node is not cycle master capable; " ··· 1561 1557 } 1562 1558 } 1563 1559 1564 - if (!nodemgr_check_irm_capability(host, reset_cycles)) { 1560 + if (!nodemgr_check_irm_capability(host, reset_cycles) || 1561 + !nodemgr_do_irm_duties(host, reset_cycles)) { 1565 1562 reset_cycles++; 1566 1563 up(&nodemgr_serialize); 1567 1564 continue; 1568 1565 } 1566 + reset_cycles = 0; 1569 1567 1570 1568 /* Scan our nodes to get the bus options and create node 1571 1569 * entries. This does not do the sysfs stuff, since that 1572 1570 * would trigger hotplug callbacks and such, which is a 1573 1571 * bad idea at this point. */ 1574 1572 nodemgr_node_scan(hi, generation); 1575 - if (!nodemgr_do_irm_duties(host, reset_cycles)) { 1576 - reset_cycles++; 1577 - up(&nodemgr_serialize); 1578 - continue; 1579 - } 1580 - 1581 - reset_cycles = 0; 1582 1573 1583 1574 /* This actually does the full probe, with sysfs 1584 1575 * registration. */