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