aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/sbp2.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/firewire/sbp2.c')
-rw-r--r--drivers/firewire/sbp2.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c
index 9f76171717e5..bfae4b309791 100644
--- a/drivers/firewire/sbp2.c
+++ b/drivers/firewire/sbp2.c
@@ -450,7 +450,7 @@ static void sbp2_status_write(struct fw_card *card, struct fw_request *request,
450 450
451 if (&orb->link != &lu->orb_list) { 451 if (&orb->link != &lu->orb_list) {
452 orb->callback(orb, &status); 452 orb->callback(orb, &status);
453 kref_put(&orb->kref, free_orb); 453 kref_put(&orb->kref, free_orb); /* orb callback reference */
454 } else { 454 } else {
455 fw_error("status write for unknown orb\n"); 455 fw_error("status write for unknown orb\n");
456 } 456 }
@@ -472,20 +472,28 @@ static void complete_transaction(struct fw_card *card, int rcode,
472 * So this callback only sets the rcode if it hasn't already 472 * So this callback only sets the rcode if it hasn't already
473 * been set and only does the cleanup if the transaction 473 * been set and only does the cleanup if the transaction
474 * failed and we didn't already get a status write. 474 * failed and we didn't already get a status write.
475 *
476 * Here we treat RCODE_CANCELLED like RCODE_COMPLETE because some
477 * OXUF936QSE firmwares occasionally respond after Split_Timeout and
478 * complete the ORB just fine. Note, we also get RCODE_CANCELLED
479 * from sbp2_cancel_orbs() if fw_cancel_transaction() == 0.
475 */ 480 */
476 spin_lock_irqsave(&card->lock, flags); 481 spin_lock_irqsave(&card->lock, flags);
477 482
478 if (orb->rcode == -1) 483 if (orb->rcode == -1)
479 orb->rcode = rcode; 484 orb->rcode = rcode;
480 if (orb->rcode != RCODE_COMPLETE) { 485
486 if (orb->rcode != RCODE_COMPLETE && orb->rcode != RCODE_CANCELLED) {
481 list_del(&orb->link); 487 list_del(&orb->link);
482 spin_unlock_irqrestore(&card->lock, flags); 488 spin_unlock_irqrestore(&card->lock, flags);
489
483 orb->callback(orb, NULL); 490 orb->callback(orb, NULL);
491 kref_put(&orb->kref, free_orb); /* orb callback reference */
484 } else { 492 } else {
485 spin_unlock_irqrestore(&card->lock, flags); 493 spin_unlock_irqrestore(&card->lock, flags);
486 } 494 }
487 495
488 kref_put(&orb->kref, free_orb); 496 kref_put(&orb->kref, free_orb); /* transaction callback reference */
489} 497}
490 498
491static void sbp2_send_orb(struct sbp2_orb *orb, struct sbp2_logical_unit *lu, 499static void sbp2_send_orb(struct sbp2_orb *orb, struct sbp2_logical_unit *lu,
@@ -501,9 +509,8 @@ static void sbp2_send_orb(struct sbp2_orb *orb, struct sbp2_logical_unit *lu,
501 list_add_tail(&orb->link, &lu->orb_list); 509 list_add_tail(&orb->link, &lu->orb_list);
502 spin_unlock_irqrestore(&device->card->lock, flags); 510 spin_unlock_irqrestore(&device->card->lock, flags);
503 511
504 /* Take a ref for the orb list and for the transaction callback. */ 512 kref_get(&orb->kref); /* transaction callback reference */
505 kref_get(&orb->kref); 513 kref_get(&orb->kref); /* orb callback reference */
506 kref_get(&orb->kref);
507 514
508 fw_send_request(device->card, &orb->t, TCODE_WRITE_BLOCK_REQUEST, 515 fw_send_request(device->card, &orb->t, TCODE_WRITE_BLOCK_REQUEST,
509 node_id, generation, device->max_speed, offset, 516 node_id, generation, device->max_speed, offset,
@@ -525,11 +532,11 @@ static int sbp2_cancel_orbs(struct sbp2_logical_unit *lu)
525 532
526 list_for_each_entry_safe(orb, next, &list, link) { 533 list_for_each_entry_safe(orb, next, &list, link) {
527 retval = 0; 534 retval = 0;
528 if (fw_cancel_transaction(device->card, &orb->t) == 0) 535 fw_cancel_transaction(device->card, &orb->t);
529 continue;
530 536
531 orb->rcode = RCODE_CANCELLED; 537 orb->rcode = RCODE_CANCELLED;
532 orb->callback(orb, NULL); 538 orb->callback(orb, NULL);
539 kref_put(&orb->kref, free_orb); /* orb callback reference */
533 } 540 }
534 541
535 return retval; 542 return retval;