Merge branch 'topic/firewire' into for-linus

Pull FireWire fixes

Signed-off-by: Takashi Iwai <tiwai@suse.de>

+32 -27
+3
drivers/firewire/core-card.c
··· 668 668 void fw_core_remove_card(struct fw_card *card) 669 669 { 670 670 struct fw_card_driver dummy_driver = dummy_driver_template; 671 + unsigned long flags; 671 672 672 673 card->driver->update_phy_reg(card, 4, 673 674 PHY_LINK_ACTIVE | PHY_CONTENDER, 0); ··· 683 682 dummy_driver.stop_iso = card->driver->stop_iso; 684 683 card->driver = &dummy_driver; 685 684 685 + spin_lock_irqsave(&card->lock, flags); 686 686 fw_destroy_nodes(card); 687 + spin_unlock_irqrestore(&card->lock, flags); 687 688 688 689 /* Wait for all users, especially device workqueue jobs, to finish. */ 689 690 fw_card_put(card);
+3 -1
drivers/firewire/core-cdev.c
··· 1500 1500 { 1501 1501 struct outbound_phy_packet_event *e = 1502 1502 container_of(packet, struct outbound_phy_packet_event, p); 1503 + struct client *e_client; 1503 1504 1504 1505 switch (status) { 1505 1506 /* expected: */ ··· 1517 1516 } 1518 1517 e->phy_packet.data[0] = packet->timestamp; 1519 1518 1519 + e_client = e->client; 1520 1520 queue_event(e->client, &e->event, &e->phy_packet, 1521 1521 sizeof(e->phy_packet) + e->phy_packet.length, NULL, 0); 1522 - client_put(e->client); 1522 + client_put(e_client); 1523 1523 } 1524 1524 1525 1525 static int ioctl_send_phy_packet(struct client *client, union ioctl_arg *arg)
+3 -6
drivers/firewire/core-topology.c
··· 375 375 card->bm_retries = 0; 376 376 } 377 377 378 + /* Must be called with card->lock held */ 378 379 void fw_destroy_nodes(struct fw_card *card) 379 380 { 380 - unsigned long flags; 381 - 382 - spin_lock_irqsave(&card->lock, flags); 383 381 card->color++; 384 382 if (card->local_node != NULL) 385 383 for_each_fw_node(card, card->local_node, report_lost_node); 386 384 card->local_node = NULL; 387 - spin_unlock_irqrestore(&card->lock, flags); 388 385 } 389 386 390 387 static void move_tree(struct fw_node *node0, struct fw_node *node1, int port) ··· 507 510 struct fw_node *local_node; 508 511 unsigned long flags; 509 512 513 + spin_lock_irqsave(&card->lock, flags); 514 + 510 515 /* 511 516 * If the selfID buffer is not the immediate successor of the 512 517 * previously processed one, we cannot reliably compare the ··· 519 520 fw_destroy_nodes(card); 520 521 card->bm_retries = 0; 521 522 } 522 - 523 - spin_lock_irqsave(&card->lock, flags); 524 523 525 524 card->broadcast_channel_allocated = card->broadcast_channel_auto_allocated; 526 525 card->node_id = node_id;
+16 -14
drivers/firewire/core-transaction.c
··· 73 73 static int close_transaction(struct fw_transaction *transaction, 74 74 struct fw_card *card, int rcode) 75 75 { 76 - struct fw_transaction *t; 76 + struct fw_transaction *t = NULL, *iter; 77 77 unsigned long flags; 78 78 79 79 spin_lock_irqsave(&card->lock, flags); 80 - list_for_each_entry(t, &card->transaction_list, link) { 81 - if (t == transaction) { 82 - if (!try_cancel_split_timeout(t)) { 80 + list_for_each_entry(iter, &card->transaction_list, link) { 81 + if (iter == transaction) { 82 + if (!try_cancel_split_timeout(iter)) { 83 83 spin_unlock_irqrestore(&card->lock, flags); 84 84 goto timed_out; 85 85 } 86 - list_del_init(&t->link); 87 - card->tlabel_mask &= ~(1ULL << t->tlabel); 86 + list_del_init(&iter->link); 87 + card->tlabel_mask &= ~(1ULL << iter->tlabel); 88 + t = iter; 88 89 break; 89 90 } 90 91 } 91 92 spin_unlock_irqrestore(&card->lock, flags); 92 93 93 - if (&t->link != &card->transaction_list) { 94 + if (t) { 94 95 t->callback(card, rcode, NULL, 0, t->callback_data); 95 96 return 0; 96 97 } ··· 936 935 937 936 void fw_core_handle_response(struct fw_card *card, struct fw_packet *p) 938 937 { 939 - struct fw_transaction *t; 938 + struct fw_transaction *t = NULL, *iter; 940 939 unsigned long flags; 941 940 u32 *data; 942 941 size_t data_length; ··· 948 947 rcode = HEADER_GET_RCODE(p->header[1]); 949 948 950 949 spin_lock_irqsave(&card->lock, flags); 951 - list_for_each_entry(t, &card->transaction_list, link) { 952 - if (t->node_id == source && t->tlabel == tlabel) { 953 - if (!try_cancel_split_timeout(t)) { 950 + list_for_each_entry(iter, &card->transaction_list, link) { 951 + if (iter->node_id == source && iter->tlabel == tlabel) { 952 + if (!try_cancel_split_timeout(iter)) { 954 953 spin_unlock_irqrestore(&card->lock, flags); 955 954 goto timed_out; 956 955 } 957 - list_del_init(&t->link); 958 - card->tlabel_mask &= ~(1ULL << t->tlabel); 956 + list_del_init(&iter->link); 957 + card->tlabel_mask &= ~(1ULL << iter->tlabel); 958 + t = iter; 959 959 break; 960 960 } 961 961 } 962 962 spin_unlock_irqrestore(&card->lock, flags); 963 963 964 - if (&t->link == &card->transaction_list) { 964 + if (!t) { 965 965 timed_out: 966 966 fw_notice(card, "unsolicited response (source %x, tlabel %x)\n", 967 967 source, tlabel);
+7 -6
drivers/firewire/sbp2.c
··· 408 408 void *payload, size_t length, void *callback_data) 409 409 { 410 410 struct sbp2_logical_unit *lu = callback_data; 411 - struct sbp2_orb *orb; 411 + struct sbp2_orb *orb = NULL, *iter; 412 412 struct sbp2_status status; 413 413 unsigned long flags; 414 414 ··· 433 433 434 434 /* Lookup the orb corresponding to this status write. */ 435 435 spin_lock_irqsave(&lu->tgt->lock, flags); 436 - list_for_each_entry(orb, &lu->orb_list, link) { 436 + list_for_each_entry(iter, &lu->orb_list, link) { 437 437 if (STATUS_GET_ORB_HIGH(status) == 0 && 438 - STATUS_GET_ORB_LOW(status) == orb->request_bus) { 439 - orb->rcode = RCODE_COMPLETE; 440 - list_del(&orb->link); 438 + STATUS_GET_ORB_LOW(status) == iter->request_bus) { 439 + iter->rcode = RCODE_COMPLETE; 440 + list_del(&iter->link); 441 + orb = iter; 441 442 break; 442 443 } 443 444 } 444 445 spin_unlock_irqrestore(&lu->tgt->lock, flags); 445 446 446 - if (&orb->link != &lu->orb_list) { 447 + if (orb) { 447 448 orb->callback(orb, &status); 448 449 kref_put(&orb->kref, free_orb); /* orb callback reference */ 449 450 } else {