diff options
Diffstat (limited to 'drivers/ieee1394')
-rw-r--r-- | drivers/ieee1394/nodemgr.c | 178 |
1 files changed, 81 insertions, 97 deletions
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c index 16240a789650..b9d3f46c2b06 100644 --- a/drivers/ieee1394/nodemgr.c +++ b/drivers/ieee1394/nodemgr.c | |||
@@ -154,7 +154,7 @@ struct host_info { | |||
154 | 154 | ||
155 | static int nodemgr_bus_match(struct device * dev, struct device_driver * drv); | 155 | static int nodemgr_bus_match(struct device * dev, struct device_driver * drv); |
156 | static int nodemgr_uevent(struct device *dev, struct kobj_uevent_env *env); | 156 | static int nodemgr_uevent(struct device *dev, struct kobj_uevent_env *env); |
157 | static void nodemgr_resume_ne(struct node_entry *ne); | 157 | static void nodemgr_reactivate_ne(struct node_entry *ne); |
158 | static void nodemgr_remove_ne(struct node_entry *ne); | 158 | static void nodemgr_remove_ne(struct node_entry *ne); |
159 | static struct node_entry *find_entry_by_guid(u64 guid); | 159 | static struct node_entry *find_entry_by_guid(u64 guid); |
160 | 160 | ||
@@ -734,10 +734,10 @@ static int nodemgr_bus_match(struct device * dev, struct device_driver * drv) | |||
734 | 734 | ||
735 | static DEFINE_MUTEX(nodemgr_serialize_remove_uds); | 735 | static DEFINE_MUTEX(nodemgr_serialize_remove_uds); |
736 | 736 | ||
737 | static int __match_ne(struct device *dev, void *data) | 737 | static int match_ne(struct device *dev, void *data) |
738 | { | 738 | { |
739 | struct unit_directory *ud; | 739 | struct unit_directory *ud; |
740 | struct node_entry *ne = (struct node_entry *)data; | 740 | struct node_entry *ne = data; |
741 | 741 | ||
742 | ud = container_of(dev, struct unit_directory, unit_dev); | 742 | ud = container_of(dev, struct unit_directory, unit_dev); |
743 | return ud->ne == ne; | 743 | return ud->ne == ne; |
@@ -754,8 +754,7 @@ static void nodemgr_remove_uds(struct node_entry *ne) | |||
754 | */ | 754 | */ |
755 | mutex_lock(&nodemgr_serialize_remove_uds); | 755 | mutex_lock(&nodemgr_serialize_remove_uds); |
756 | for (;;) { | 756 | for (;;) { |
757 | dev = class_find_device(&nodemgr_ud_class, NULL, ne, | 757 | dev = class_find_device(&nodemgr_ud_class, NULL, ne, match_ne); |
758 | __match_ne); | ||
759 | if (!dev) | 758 | if (!dev) |
760 | break; | 759 | break; |
761 | ud = container_of(dev, struct unit_directory, unit_dev); | 760 | ud = container_of(dev, struct unit_directory, unit_dev); |
@@ -785,7 +784,7 @@ static void nodemgr_remove_ne(struct node_entry *ne) | |||
785 | put_device(dev); | 784 | put_device(dev); |
786 | } | 785 | } |
787 | 786 | ||
788 | static int __nodemgr_remove_host_dev(struct device *dev, void *data) | 787 | static int remove_host_dev(struct device *dev, void *data) |
789 | { | 788 | { |
790 | if (dev->bus == &ieee1394_bus_type) | 789 | if (dev->bus == &ieee1394_bus_type) |
791 | nodemgr_remove_ne(container_of(dev, struct node_entry, | 790 | nodemgr_remove_ne(container_of(dev, struct node_entry, |
@@ -795,7 +794,7 @@ static int __nodemgr_remove_host_dev(struct device *dev, void *data) | |||
795 | 794 | ||
796 | static void nodemgr_remove_host_dev(struct device *dev) | 795 | static void nodemgr_remove_host_dev(struct device *dev) |
797 | { | 796 | { |
798 | WARN_ON(device_for_each_child(dev, NULL, __nodemgr_remove_host_dev)); | 797 | device_for_each_child(dev, NULL, remove_host_dev); |
799 | sysfs_remove_link(&dev->kobj, "irm_id"); | 798 | sysfs_remove_link(&dev->kobj, "irm_id"); |
800 | sysfs_remove_link(&dev->kobj, "busmgr_id"); | 799 | sysfs_remove_link(&dev->kobj, "busmgr_id"); |
801 | sysfs_remove_link(&dev->kobj, "host_id"); | 800 | sysfs_remove_link(&dev->kobj, "host_id"); |
@@ -830,11 +829,10 @@ static void nodemgr_update_bus_options(struct node_entry *ne) | |||
830 | } | 829 | } |
831 | 830 | ||
832 | 831 | ||
833 | static struct node_entry *nodemgr_create_node(octlet_t guid, struct csr1212_csr *csr, | 832 | static struct node_entry *nodemgr_create_node(octlet_t guid, |
834 | struct host_info *hi, nodeid_t nodeid, | 833 | struct csr1212_csr *csr, struct hpsb_host *host, |
835 | unsigned int generation) | 834 | nodeid_t nodeid, unsigned int generation) |
836 | { | 835 | { |
837 | struct hpsb_host *host = hi->host; | ||
838 | struct node_entry *ne; | 836 | struct node_entry *ne; |
839 | 837 | ||
840 | ne = kzalloc(sizeof(*ne), GFP_KERNEL); | 838 | ne = kzalloc(sizeof(*ne), GFP_KERNEL); |
@@ -888,10 +886,10 @@ fail_alloc: | |||
888 | return NULL; | 886 | return NULL; |
889 | } | 887 | } |
890 | 888 | ||
891 | static int __match_ne_guid(struct device *dev, void *data) | 889 | static int match_ne_guid(struct device *dev, void *data) |
892 | { | 890 | { |
893 | struct node_entry *ne; | 891 | struct node_entry *ne; |
894 | u64 *guid = (u64 *)data; | 892 | u64 *guid = data; |
895 | 893 | ||
896 | ne = container_of(dev, struct node_entry, node_dev); | 894 | ne = container_of(dev, struct node_entry, node_dev); |
897 | return ne->guid == *guid; | 895 | return ne->guid == *guid; |
@@ -902,8 +900,7 @@ static struct node_entry *find_entry_by_guid(u64 guid) | |||
902 | struct device *dev; | 900 | struct device *dev; |
903 | struct node_entry *ne; | 901 | struct node_entry *ne; |
904 | 902 | ||
905 | dev = class_find_device(&nodemgr_ne_class, NULL, &guid, | 903 | dev = class_find_device(&nodemgr_ne_class, NULL, &guid, match_ne_guid); |
906 | __match_ne_guid); | ||
907 | if (!dev) | 904 | if (!dev) |
908 | return NULL; | 905 | return NULL; |
909 | ne = container_of(dev, struct node_entry, node_dev); | 906 | ne = container_of(dev, struct node_entry, node_dev); |
@@ -912,21 +909,21 @@ static struct node_entry *find_entry_by_guid(u64 guid) | |||
912 | return ne; | 909 | return ne; |
913 | } | 910 | } |
914 | 911 | ||
915 | struct match_nodeid_param { | 912 | struct match_nodeid_parameter { |
916 | struct hpsb_host *host; | 913 | struct hpsb_host *host; |
917 | nodeid_t nodeid; | 914 | nodeid_t nodeid; |
918 | }; | 915 | }; |
919 | 916 | ||
920 | static int __match_ne_nodeid(struct device *dev, void *data) | 917 | static int match_ne_nodeid(struct device *dev, void *data) |
921 | { | 918 | { |
922 | int found = 0; | 919 | int found = 0; |
923 | struct node_entry *ne; | 920 | struct node_entry *ne; |
924 | struct match_nodeid_param *param = (struct match_nodeid_param *)data; | 921 | struct match_nodeid_parameter *p = data; |
925 | 922 | ||
926 | if (!dev) | 923 | if (!dev) |
927 | goto ret; | 924 | goto ret; |
928 | ne = container_of(dev, struct node_entry, node_dev); | 925 | ne = container_of(dev, struct node_entry, node_dev); |
929 | if (ne->host == param->host && ne->nodeid == param->nodeid) | 926 | if (ne->host == p->host && ne->nodeid == p->nodeid) |
930 | found = 1; | 927 | found = 1; |
931 | ret: | 928 | ret: |
932 | return found; | 929 | return found; |
@@ -937,13 +934,12 @@ static struct node_entry *find_entry_by_nodeid(struct hpsb_host *host, | |||
937 | { | 934 | { |
938 | struct device *dev; | 935 | struct device *dev; |
939 | struct node_entry *ne; | 936 | struct node_entry *ne; |
940 | struct match_nodeid_param param; | 937 | struct match_nodeid_parameter p; |
941 | 938 | ||
942 | param.host = host; | 939 | p.host = host; |
943 | param.nodeid = nodeid; | 940 | p.nodeid = nodeid; |
944 | 941 | ||
945 | dev = class_find_device(&nodemgr_ne_class, NULL, ¶m, | 942 | dev = class_find_device(&nodemgr_ne_class, NULL, &p, match_ne_nodeid); |
946 | __match_ne_nodeid); | ||
947 | if (!dev) | 943 | if (!dev) |
948 | return NULL; | 944 | return NULL; |
949 | ne = container_of(dev, struct node_entry, node_dev); | 945 | ne = container_of(dev, struct node_entry, node_dev); |
@@ -990,7 +986,7 @@ fail_devreg: | |||
990 | * immediate unit directories looking for software_id and | 986 | * immediate unit directories looking for software_id and |
991 | * software_version entries, in order to get driver autoloading working. */ | 987 | * software_version entries, in order to get driver autoloading working. */ |
992 | static struct unit_directory *nodemgr_process_unit_directory | 988 | static struct unit_directory *nodemgr_process_unit_directory |
993 | (struct host_info *hi, struct node_entry *ne, struct csr1212_keyval *ud_kv, | 989 | (struct node_entry *ne, struct csr1212_keyval *ud_kv, |
994 | unsigned int *id, struct unit_directory *parent) | 990 | unsigned int *id, struct unit_directory *parent) |
995 | { | 991 | { |
996 | struct unit_directory *ud; | 992 | struct unit_directory *ud; |
@@ -1083,7 +1079,7 @@ static struct unit_directory *nodemgr_process_unit_directory | |||
1083 | nodemgr_register_device(ne, ud, &ne->device); | 1079 | nodemgr_register_device(ne, ud, &ne->device); |
1084 | 1080 | ||
1085 | /* process the child unit */ | 1081 | /* process the child unit */ |
1086 | ud_child = nodemgr_process_unit_directory(hi, ne, kv, id, ud); | 1082 | ud_child = nodemgr_process_unit_directory(ne, kv, id, ud); |
1087 | 1083 | ||
1088 | if (ud_child == NULL) | 1084 | if (ud_child == NULL) |
1089 | break; | 1085 | break; |
@@ -1137,7 +1133,7 @@ unit_directory_error: | |||
1137 | } | 1133 | } |
1138 | 1134 | ||
1139 | 1135 | ||
1140 | static void nodemgr_process_root_directory(struct host_info *hi, struct node_entry *ne) | 1136 | static void nodemgr_process_root_directory(struct node_entry *ne) |
1141 | { | 1137 | { |
1142 | unsigned int ud_id = 0; | 1138 | unsigned int ud_id = 0; |
1143 | struct csr1212_dentry *dentry; | 1139 | struct csr1212_dentry *dentry; |
@@ -1157,7 +1153,7 @@ static void nodemgr_process_root_directory(struct host_info *hi, struct node_ent | |||
1157 | break; | 1153 | break; |
1158 | 1154 | ||
1159 | case CSR1212_KV_ID_UNIT: | 1155 | case CSR1212_KV_ID_UNIT: |
1160 | nodemgr_process_unit_directory(hi, ne, kv, &ud_id, NULL); | 1156 | nodemgr_process_unit_directory(ne, kv, &ud_id, NULL); |
1161 | break; | 1157 | break; |
1162 | 1158 | ||
1163 | case CSR1212_KV_ID_DESCRIPTOR: | 1159 | case CSR1212_KV_ID_DESCRIPTOR: |
@@ -1273,8 +1269,7 @@ void hpsb_unregister_protocol(struct hpsb_protocol_driver *driver) | |||
1273 | * the to take whatever actions required. | 1269 | * the to take whatever actions required. |
1274 | */ | 1270 | */ |
1275 | static void nodemgr_update_node(struct node_entry *ne, struct csr1212_csr *csr, | 1271 | static void nodemgr_update_node(struct node_entry *ne, struct csr1212_csr *csr, |
1276 | struct host_info *hi, nodeid_t nodeid, | 1272 | nodeid_t nodeid, unsigned int generation) |
1277 | unsigned int generation) | ||
1278 | { | 1273 | { |
1279 | if (ne->nodeid != nodeid) { | 1274 | if (ne->nodeid != nodeid) { |
1280 | HPSB_DEBUG("Node changed: " NODE_BUS_FMT " -> " NODE_BUS_FMT, | 1275 | HPSB_DEBUG("Node changed: " NODE_BUS_FMT " -> " NODE_BUS_FMT, |
@@ -1306,7 +1301,7 @@ static void nodemgr_update_node(struct node_entry *ne, struct csr1212_csr *csr, | |||
1306 | } | 1301 | } |
1307 | 1302 | ||
1308 | if (ne->in_limbo) | 1303 | if (ne->in_limbo) |
1309 | nodemgr_resume_ne(ne); | 1304 | nodemgr_reactivate_ne(ne); |
1310 | 1305 | ||
1311 | /* Mark the node current */ | 1306 | /* Mark the node current */ |
1312 | ne->generation = generation; | 1307 | ne->generation = generation; |
@@ -1314,10 +1309,9 @@ static void nodemgr_update_node(struct node_entry *ne, struct csr1212_csr *csr, | |||
1314 | 1309 | ||
1315 | 1310 | ||
1316 | 1311 | ||
1317 | static void nodemgr_node_scan_one(struct host_info *hi, | 1312 | static void nodemgr_node_scan_one(struct hpsb_host *host, |
1318 | nodeid_t nodeid, int generation) | 1313 | nodeid_t nodeid, int generation) |
1319 | { | 1314 | { |
1320 | struct hpsb_host *host = hi->host; | ||
1321 | struct node_entry *ne; | 1315 | struct node_entry *ne; |
1322 | octlet_t guid; | 1316 | octlet_t guid; |
1323 | struct csr1212_csr *csr; | 1317 | struct csr1212_csr *csr; |
@@ -1373,16 +1367,15 @@ static void nodemgr_node_scan_one(struct host_info *hi, | |||
1373 | } | 1367 | } |
1374 | 1368 | ||
1375 | if (!ne) | 1369 | if (!ne) |
1376 | nodemgr_create_node(guid, csr, hi, nodeid, generation); | 1370 | nodemgr_create_node(guid, csr, host, nodeid, generation); |
1377 | else | 1371 | else |
1378 | nodemgr_update_node(ne, csr, hi, nodeid, generation); | 1372 | nodemgr_update_node(ne, csr, nodeid, generation); |
1379 | } | 1373 | } |
1380 | 1374 | ||
1381 | 1375 | ||
1382 | static void nodemgr_node_scan(struct host_info *hi, int generation) | 1376 | static void nodemgr_node_scan(struct hpsb_host *host, int generation) |
1383 | { | 1377 | { |
1384 | int count; | 1378 | int count; |
1385 | struct hpsb_host *host = hi->host; | ||
1386 | struct selfid *sid = (struct selfid *)host->topology_map; | 1379 | struct selfid *sid = (struct selfid *)host->topology_map; |
1387 | nodeid_t nodeid = LOCAL_BUS; | 1380 | nodeid_t nodeid = LOCAL_BUS; |
1388 | 1381 | ||
@@ -1395,15 +1388,15 @@ static void nodemgr_node_scan(struct host_info *hi, int generation) | |||
1395 | nodeid++; | 1388 | nodeid++; |
1396 | continue; | 1389 | continue; |
1397 | } | 1390 | } |
1398 | nodemgr_node_scan_one(hi, nodeid++, generation); | 1391 | nodemgr_node_scan_one(host, nodeid++, generation); |
1399 | } | 1392 | } |
1400 | } | 1393 | } |
1401 | 1394 | ||
1402 | static int __nodemgr_driver_suspend(struct device *dev, void *data) | 1395 | static int pause_ne(struct device *dev, void *data) |
1403 | { | 1396 | { |
1404 | struct unit_directory *ud; | 1397 | struct unit_directory *ud; |
1405 | struct device_driver *drv; | 1398 | struct device_driver *drv; |
1406 | struct node_entry *ne = (struct node_entry *)data; | 1399 | struct node_entry *ne = data; |
1407 | int error; | 1400 | int error; |
1408 | 1401 | ||
1409 | ud = container_of(dev, struct unit_directory, unit_dev); | 1402 | ud = container_of(dev, struct unit_directory, unit_dev); |
@@ -1425,11 +1418,23 @@ static int __nodemgr_driver_suspend(struct device *dev, void *data) | |||
1425 | return 0; | 1418 | return 0; |
1426 | } | 1419 | } |
1427 | 1420 | ||
1428 | static int __nodemgr_driver_resume(struct device *dev, void *data) | 1421 | static void nodemgr_pause_ne(struct node_entry *ne) |
1422 | { | ||
1423 | HPSB_DEBUG("Node suspended: ID:BUS[" NODE_BUS_FMT "] GUID[%016Lx]", | ||
1424 | NODE_BUS_ARGS(ne->host, ne->nodeid), | ||
1425 | (unsigned long long)ne->guid); | ||
1426 | |||
1427 | ne->in_limbo = 1; | ||
1428 | WARN_ON(device_create_file(&ne->device, &dev_attr_ne_in_limbo)); | ||
1429 | |||
1430 | class_for_each_device(&nodemgr_ud_class, NULL, ne, pause_ne); | ||
1431 | } | ||
1432 | |||
1433 | static int reactivate_ne(struct device *dev, void *data) | ||
1429 | { | 1434 | { |
1430 | struct unit_directory *ud; | 1435 | struct unit_directory *ud; |
1431 | struct device_driver *drv; | 1436 | struct device_driver *drv; |
1432 | struct node_entry *ne = (struct node_entry *)data; | 1437 | struct node_entry *ne = data; |
1433 | 1438 | ||
1434 | ud = container_of(dev, struct unit_directory, unit_dev); | 1439 | ud = container_of(dev, struct unit_directory, unit_dev); |
1435 | if (ud->ne == ne) { | 1440 | if (ud->ne == ne) { |
@@ -1447,37 +1452,23 @@ static int __nodemgr_driver_resume(struct device *dev, void *data) | |||
1447 | return 0; | 1452 | return 0; |
1448 | } | 1453 | } |
1449 | 1454 | ||
1450 | static void nodemgr_suspend_ne(struct node_entry *ne) | 1455 | static void nodemgr_reactivate_ne(struct node_entry *ne) |
1451 | { | ||
1452 | HPSB_DEBUG("Node suspended: ID:BUS[" NODE_BUS_FMT "] GUID[%016Lx]", | ||
1453 | NODE_BUS_ARGS(ne->host, ne->nodeid), | ||
1454 | (unsigned long long)ne->guid); | ||
1455 | |||
1456 | ne->in_limbo = 1; | ||
1457 | WARN_ON(device_create_file(&ne->device, &dev_attr_ne_in_limbo)); | ||
1458 | |||
1459 | class_for_each_device(&nodemgr_ud_class, NULL, ne, | ||
1460 | __nodemgr_driver_suspend); | ||
1461 | } | ||
1462 | |||
1463 | |||
1464 | static void nodemgr_resume_ne(struct node_entry *ne) | ||
1465 | { | 1456 | { |
1466 | ne->in_limbo = 0; | 1457 | ne->in_limbo = 0; |
1467 | device_remove_file(&ne->device, &dev_attr_ne_in_limbo); | 1458 | device_remove_file(&ne->device, &dev_attr_ne_in_limbo); |
1468 | 1459 | ||
1469 | class_for_each_device(&nodemgr_ud_class, NULL, ne, | 1460 | class_for_each_device(&nodemgr_ud_class, NULL, ne, reactivate_ne); |
1470 | __nodemgr_driver_resume); | ||
1471 | HPSB_DEBUG("Node resumed: ID:BUS[" NODE_BUS_FMT "] GUID[%016Lx]", | 1461 | HPSB_DEBUG("Node resumed: ID:BUS[" NODE_BUS_FMT "] GUID[%016Lx]", |
1472 | NODE_BUS_ARGS(ne->host, ne->nodeid), (unsigned long long)ne->guid); | 1462 | NODE_BUS_ARGS(ne->host, ne->nodeid), |
1463 | (unsigned long long)ne->guid); | ||
1473 | } | 1464 | } |
1474 | 1465 | ||
1475 | static int __nodemgr_update_pdrv(struct device *dev, void *data) | 1466 | static int update_pdrv(struct device *dev, void *data) |
1476 | { | 1467 | { |
1477 | struct unit_directory *ud; | 1468 | struct unit_directory *ud; |
1478 | struct device_driver *drv; | 1469 | struct device_driver *drv; |
1479 | struct hpsb_protocol_driver *pdrv; | 1470 | struct hpsb_protocol_driver *pdrv; |
1480 | struct node_entry *ne = (struct node_entry *)data; | 1471 | struct node_entry *ne = data; |
1481 | int error; | 1472 | int error; |
1482 | 1473 | ||
1483 | ud = container_of(dev, struct unit_directory, unit_dev); | 1474 | ud = container_of(dev, struct unit_directory, unit_dev); |
@@ -1503,8 +1494,7 @@ static int __nodemgr_update_pdrv(struct device *dev, void *data) | |||
1503 | 1494 | ||
1504 | static void nodemgr_update_pdrv(struct node_entry *ne) | 1495 | static void nodemgr_update_pdrv(struct node_entry *ne) |
1505 | { | 1496 | { |
1506 | class_for_each_device(&nodemgr_ud_class, NULL, ne, | 1497 | class_for_each_device(&nodemgr_ud_class, NULL, ne, update_pdrv); |
1507 | __nodemgr_update_pdrv); | ||
1508 | } | 1498 | } |
1509 | 1499 | ||
1510 | 1500 | ||
@@ -1535,11 +1525,12 @@ static void nodemgr_irm_write_bc(struct node_entry *ne, int generation) | |||
1535 | } | 1525 | } |
1536 | 1526 | ||
1537 | 1527 | ||
1538 | static void nodemgr_probe_ne(struct host_info *hi, struct node_entry *ne, int generation) | 1528 | static void nodemgr_probe_ne(struct hpsb_host *host, struct node_entry *ne, |
1529 | int generation) | ||
1539 | { | 1530 | { |
1540 | struct device *dev; | 1531 | struct device *dev; |
1541 | 1532 | ||
1542 | if (ne->host != hi->host || ne->in_limbo) | 1533 | if (ne->host != host || ne->in_limbo) |
1543 | return; | 1534 | return; |
1544 | 1535 | ||
1545 | dev = get_device(&ne->device); | 1536 | dev = get_device(&ne->device); |
@@ -1554,40 +1545,40 @@ static void nodemgr_probe_ne(struct host_info *hi, struct node_entry *ne, int ge | |||
1554 | * down to the drivers. Otherwise, this is a dead node and we | 1545 | * down to the drivers. Otherwise, this is a dead node and we |
1555 | * suspend it. */ | 1546 | * suspend it. */ |
1556 | if (ne->needs_probe) | 1547 | if (ne->needs_probe) |
1557 | nodemgr_process_root_directory(hi, ne); | 1548 | nodemgr_process_root_directory(ne); |
1558 | else if (ne->generation == generation) | 1549 | else if (ne->generation == generation) |
1559 | nodemgr_update_pdrv(ne); | 1550 | nodemgr_update_pdrv(ne); |
1560 | else | 1551 | else |
1561 | nodemgr_suspend_ne(ne); | 1552 | nodemgr_pause_ne(ne); |
1562 | 1553 | ||
1563 | put_device(dev); | 1554 | put_device(dev); |
1564 | } | 1555 | } |
1565 | 1556 | ||
1566 | struct probe_param { | 1557 | struct node_probe_parameter { |
1567 | struct host_info *hi; | 1558 | struct hpsb_host *host; |
1568 | int generation; | 1559 | int generation; |
1569 | bool probe_now; | 1560 | bool probe_now; |
1570 | }; | 1561 | }; |
1571 | 1562 | ||
1572 | static int node_probe(struct device *dev, void *data) | 1563 | static int node_probe(struct device *dev, void *data) |
1573 | { | 1564 | { |
1574 | struct probe_param *p = data; | 1565 | struct node_probe_parameter *p = data; |
1575 | struct node_entry *ne; | 1566 | struct node_entry *ne; |
1576 | 1567 | ||
1577 | if (p->generation != get_hpsb_generation(p->hi->host)) | 1568 | if (p->generation != get_hpsb_generation(p->host)) |
1578 | return -EAGAIN; | 1569 | return -EAGAIN; |
1579 | 1570 | ||
1580 | ne = container_of(dev, struct node_entry, node_dev); | 1571 | ne = container_of(dev, struct node_entry, node_dev); |
1581 | if (ne->needs_probe == p->probe_now) | 1572 | if (ne->needs_probe == p->probe_now) |
1582 | nodemgr_probe_ne(p->hi, ne, p->generation); | 1573 | nodemgr_probe_ne(p->host, ne, p->generation); |
1583 | return 0; | 1574 | return 0; |
1584 | } | 1575 | } |
1585 | 1576 | ||
1586 | static void nodemgr_node_probe(struct host_info *hi, int generation) | 1577 | static void nodemgr_node_probe(struct hpsb_host *host, int generation) |
1587 | { | 1578 | { |
1588 | struct probe_param p; | 1579 | struct node_probe_parameter p; |
1589 | 1580 | ||
1590 | p.hi = hi; | 1581 | p.host = host; |
1591 | p.generation = generation; | 1582 | p.generation = generation; |
1592 | /* | 1583 | /* |
1593 | * Do some processing of the nodes we've probed. This pulls them | 1584 | * Do some processing of the nodes we've probed. This pulls them |
@@ -1730,10 +1721,9 @@ static int nodemgr_check_irm_capability(struct hpsb_host *host, int cycles) | |||
1730 | return 1; | 1721 | return 1; |
1731 | } | 1722 | } |
1732 | 1723 | ||
1733 | static int nodemgr_host_thread(void *__hi) | 1724 | static int nodemgr_host_thread(void *data) |
1734 | { | 1725 | { |
1735 | struct host_info *hi = (struct host_info *)__hi; | 1726 | struct hpsb_host *host = data; |
1736 | struct hpsb_host *host = hi->host; | ||
1737 | unsigned int g, generation = 0; | 1727 | unsigned int g, generation = 0; |
1738 | int i, reset_cycles = 0; | 1728 | int i, reset_cycles = 0; |
1739 | 1729 | ||
@@ -1787,11 +1777,11 @@ static int nodemgr_host_thread(void *__hi) | |||
1787 | * entries. This does not do the sysfs stuff, since that | 1777 | * entries. This does not do the sysfs stuff, since that |
1788 | * would trigger uevents and such, which is a bad idea at | 1778 | * would trigger uevents and such, which is a bad idea at |
1789 | * this point. */ | 1779 | * this point. */ |
1790 | nodemgr_node_scan(hi, generation); | 1780 | nodemgr_node_scan(host, generation); |
1791 | 1781 | ||
1792 | /* This actually does the full probe, with sysfs | 1782 | /* This actually does the full probe, with sysfs |
1793 | * registration. */ | 1783 | * registration. */ |
1794 | nodemgr_node_probe(hi, generation); | 1784 | nodemgr_node_probe(host, generation); |
1795 | 1785 | ||
1796 | /* Update some of our sysfs symlinks */ | 1786 | /* Update some of our sysfs symlinks */ |
1797 | nodemgr_update_host_dev_links(host); | 1787 | nodemgr_update_host_dev_links(host); |
@@ -1801,22 +1791,20 @@ exit: | |||
1801 | return 0; | 1791 | return 0; |
1802 | } | 1792 | } |
1803 | 1793 | ||
1804 | struct host_iter_param { | 1794 | struct per_host_parameter { |
1805 | void *data; | 1795 | void *data; |
1806 | int (*cb)(struct hpsb_host *, void *); | 1796 | int (*cb)(struct hpsb_host *, void *); |
1807 | }; | 1797 | }; |
1808 | 1798 | ||
1809 | static int __nodemgr_for_each_host(struct device *dev, void *data) | 1799 | static int per_host(struct device *dev, void *data) |
1810 | { | 1800 | { |
1811 | struct hpsb_host *host; | 1801 | struct hpsb_host *host; |
1812 | struct host_iter_param *hip = (struct host_iter_param *)data; | 1802 | struct per_host_parameter *p = data; |
1813 | int error = 0; | ||
1814 | 1803 | ||
1815 | host = container_of(dev, struct hpsb_host, host_dev); | 1804 | host = container_of(dev, struct hpsb_host, host_dev); |
1816 | error = hip->cb(host, hip->data); | 1805 | return p->cb(host, p->data); |
1817 | |||
1818 | return error; | ||
1819 | } | 1806 | } |
1807 | |||
1820 | /** | 1808 | /** |
1821 | * nodemgr_for_each_host - call a function for each IEEE 1394 host | 1809 | * nodemgr_for_each_host - call a function for each IEEE 1394 host |
1822 | * @data: an address to supply to the callback | 1810 | * @data: an address to supply to the callback |
@@ -1831,15 +1819,11 @@ static int __nodemgr_for_each_host(struct device *dev, void *data) | |||
1831 | */ | 1819 | */ |
1832 | int nodemgr_for_each_host(void *data, int (*cb)(struct hpsb_host *, void *)) | 1820 | int nodemgr_for_each_host(void *data, int (*cb)(struct hpsb_host *, void *)) |
1833 | { | 1821 | { |
1834 | struct host_iter_param hip; | 1822 | struct per_host_parameter p; |
1835 | int error; | ||
1836 | 1823 | ||
1837 | hip.cb = cb; | 1824 | p.cb = cb; |
1838 | hip.data = data; | 1825 | p.data = data; |
1839 | error = class_for_each_device(&hpsb_host_class, NULL, &hip, | 1826 | return class_for_each_device(&hpsb_host_class, NULL, &p, per_host); |
1840 | __nodemgr_for_each_host); | ||
1841 | |||
1842 | return error; | ||
1843 | } | 1827 | } |
1844 | 1828 | ||
1845 | /* The following two convenience functions use a struct node_entry | 1829 | /* The following two convenience functions use a struct node_entry |
@@ -1893,7 +1877,7 @@ static void nodemgr_add_host(struct hpsb_host *host) | |||
1893 | return; | 1877 | return; |
1894 | } | 1878 | } |
1895 | hi->host = host; | 1879 | hi->host = host; |
1896 | hi->thread = kthread_run(nodemgr_host_thread, hi, "knodemgrd_%d", | 1880 | hi->thread = kthread_run(nodemgr_host_thread, host, "knodemgrd_%d", |
1897 | host->id); | 1881 | host->id); |
1898 | if (IS_ERR(hi->thread)) { | 1882 | if (IS_ERR(hi->thread)) { |
1899 | HPSB_ERR("NodeMgr: cannot start thread for host %d", host->id); | 1883 | HPSB_ERR("NodeMgr: cannot start thread for host %d", host->id); |