diff options
Diffstat (limited to 'drivers/ieee1394/nodemgr.c')
-rw-r--r-- | drivers/ieee1394/nodemgr.c | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c index f2453668acf5..082c7fd239f5 100644 --- a/drivers/ieee1394/nodemgr.c +++ b/drivers/ieee1394/nodemgr.c | |||
@@ -743,21 +743,20 @@ static struct node_entry *nodemgr_create_node(octlet_t guid, struct csr1212_csr | |||
743 | unsigned int generation) | 743 | unsigned int generation) |
744 | { | 744 | { |
745 | struct hpsb_host *host = hi->host; | 745 | struct hpsb_host *host = hi->host; |
746 | struct node_entry *ne; | 746 | struct node_entry *ne; |
747 | |||
748 | ne = kmalloc(sizeof(struct node_entry), GFP_KERNEL); | ||
749 | if (!ne) return NULL; | ||
750 | 747 | ||
751 | memset(ne, 0, sizeof(struct node_entry)); | 748 | ne = kzalloc(sizeof(*ne), GFP_KERNEL); |
749 | if (!ne) | ||
750 | return NULL; | ||
752 | 751 | ||
753 | ne->tpool = &host->tpool[nodeid & NODE_MASK]; | 752 | ne->tpool = &host->tpool[nodeid & NODE_MASK]; |
754 | 753 | ||
755 | ne->host = host; | 754 | ne->host = host; |
756 | ne->nodeid = nodeid; | 755 | ne->nodeid = nodeid; |
757 | ne->generation = generation; | 756 | ne->generation = generation; |
758 | ne->needs_probe = 1; | 757 | ne->needs_probe = 1; |
759 | 758 | ||
760 | ne->guid = guid; | 759 | ne->guid = guid; |
761 | ne->guid_vendor_id = (guid >> 40) & 0xffffff; | 760 | ne->guid_vendor_id = (guid >> 40) & 0xffffff; |
762 | ne->guid_vendor_oui = nodemgr_find_oui_name(ne->guid_vendor_id); | 761 | ne->guid_vendor_oui = nodemgr_find_oui_name(ne->guid_vendor_id); |
763 | ne->csr = csr; | 762 | ne->csr = csr; |
@@ -787,7 +786,7 @@ static struct node_entry *nodemgr_create_node(octlet_t guid, struct csr1212_csr | |||
787 | (host->node_id == nodeid) ? "Host" : "Node", | 786 | (host->node_id == nodeid) ? "Host" : "Node", |
788 | NODE_BUS_ARGS(host, nodeid), (unsigned long long)guid); | 787 | NODE_BUS_ARGS(host, nodeid), (unsigned long long)guid); |
789 | 788 | ||
790 | return ne; | 789 | return ne; |
791 | } | 790 | } |
792 | 791 | ||
793 | 792 | ||
@@ -872,12 +871,10 @@ static struct unit_directory *nodemgr_process_unit_directory | |||
872 | struct csr1212_keyval *kv; | 871 | struct csr1212_keyval *kv; |
873 | u8 last_key_id = 0; | 872 | u8 last_key_id = 0; |
874 | 873 | ||
875 | ud = kmalloc(sizeof(struct unit_directory), GFP_KERNEL); | 874 | ud = kzalloc(sizeof(*ud), GFP_KERNEL); |
876 | if (!ud) | 875 | if (!ud) |
877 | goto unit_directory_error; | 876 | goto unit_directory_error; |
878 | 877 | ||
879 | memset (ud, 0, sizeof(struct unit_directory)); | ||
880 | |||
881 | ud->ne = ne; | 878 | ud->ne = ne; |
882 | ud->ignore_driver = ignore_drivers; | 879 | ud->ignore_driver = ignore_drivers; |
883 | ud->address = ud_kv->offset + CSR1212_CONFIG_ROM_SPACE_BASE; | 880 | ud->address = ud_kv->offset + CSR1212_CONFIG_ROM_SPACE_BASE; |
@@ -937,10 +934,10 @@ static struct unit_directory *nodemgr_process_unit_directory | |||
937 | /* Logical Unit Number */ | 934 | /* Logical Unit Number */ |
938 | if (kv->key.type == CSR1212_KV_TYPE_IMMEDIATE) { | 935 | if (kv->key.type == CSR1212_KV_TYPE_IMMEDIATE) { |
939 | if (ud->flags & UNIT_DIRECTORY_HAS_LUN) { | 936 | if (ud->flags & UNIT_DIRECTORY_HAS_LUN) { |
940 | ud_child = kmalloc(sizeof(struct unit_directory), GFP_KERNEL); | 937 | ud_child = kmalloc(sizeof(*ud_child), GFP_KERNEL); |
941 | if (!ud_child) | 938 | if (!ud_child) |
942 | goto unit_directory_error; | 939 | goto unit_directory_error; |
943 | memcpy(ud_child, ud, sizeof(struct unit_directory)); | 940 | memcpy(ud_child, ud, sizeof(*ud_child)); |
944 | nodemgr_register_device(ne, ud_child, &ne->device); | 941 | nodemgr_register_device(ne, ud_child, &ne->device); |
945 | ud_child = NULL; | 942 | ud_child = NULL; |
946 | 943 | ||
@@ -1200,7 +1197,7 @@ static void nodemgr_node_scan_one(struct host_info *hi, | |||
1200 | struct csr1212_csr *csr; | 1197 | struct csr1212_csr *csr; |
1201 | struct nodemgr_csr_info *ci; | 1198 | struct nodemgr_csr_info *ci; |
1202 | 1199 | ||
1203 | ci = kmalloc(sizeof(struct nodemgr_csr_info), GFP_KERNEL); | 1200 | ci = kmalloc(sizeof(*ci), GFP_KERNEL); |
1204 | if (!ci) | 1201 | if (!ci) |
1205 | return; | 1202 | return; |
1206 | 1203 | ||
@@ -1410,14 +1407,28 @@ static void nodemgr_node_probe(struct host_info *hi, int generation) | |||
1410 | struct hpsb_host *host = hi->host; | 1407 | struct hpsb_host *host = hi->host; |
1411 | struct class *class = &nodemgr_ne_class; | 1408 | struct class *class = &nodemgr_ne_class; |
1412 | struct class_device *cdev; | 1409 | struct class_device *cdev; |
1410 | struct node_entry *ne; | ||
1413 | 1411 | ||
1414 | /* Do some processing of the nodes we've probed. This pulls them | 1412 | /* Do some processing of the nodes we've probed. This pulls them |
1415 | * into the sysfs layer if needed, and can result in processing of | 1413 | * into the sysfs layer if needed, and can result in processing of |
1416 | * unit-directories, or just updating the node and it's | 1414 | * unit-directories, or just updating the node and it's |
1417 | * unit-directories. */ | 1415 | * unit-directories. |
1416 | * | ||
1417 | * Run updates before probes. Usually, updates are time-critical | ||
1418 | * while probes are time-consuming. (Well, those probes need some | ||
1419 | * improvement...) */ | ||
1420 | |||
1418 | down_read(&class->subsys.rwsem); | 1421 | down_read(&class->subsys.rwsem); |
1419 | list_for_each_entry(cdev, &class->children, node) | 1422 | list_for_each_entry(cdev, &class->children, node) { |
1420 | nodemgr_probe_ne(hi, container_of(cdev, struct node_entry, class_dev), generation); | 1423 | ne = container_of(cdev, struct node_entry, class_dev); |
1424 | if (!ne->needs_probe) | ||
1425 | nodemgr_probe_ne(hi, ne, generation); | ||
1426 | } | ||
1427 | list_for_each_entry(cdev, &class->children, node) { | ||
1428 | ne = container_of(cdev, struct node_entry, class_dev); | ||
1429 | if (ne->needs_probe) | ||
1430 | nodemgr_probe_ne(hi, ne, generation); | ||
1431 | } | ||
1421 | up_read(&class->subsys.rwsem); | 1432 | up_read(&class->subsys.rwsem); |
1422 | 1433 | ||
1423 | 1434 | ||
@@ -1448,7 +1459,8 @@ static int nodemgr_send_resume_packet(struct hpsb_host *host) | |||
1448 | int ret = 1; | 1459 | int ret = 1; |
1449 | 1460 | ||
1450 | packet = hpsb_make_phypacket(host, | 1461 | packet = hpsb_make_phypacket(host, |
1451 | 0x003c0000 | NODEID_TO_NODE(host->node_id) << 24); | 1462 | EXTPHYPACKET_TYPE_RESUME | |
1463 | NODEID_TO_NODE(host->node_id) << PHYPACKET_PORT_SHIFT); | ||
1452 | if (packet) { | 1464 | if (packet) { |
1453 | packet->no_waiter = 1; | 1465 | packet->no_waiter = 1; |
1454 | packet->generation = get_hpsb_generation(host); | 1466 | packet->generation = get_hpsb_generation(host); |