aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/fw-transaction.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/firewire/fw-transaction.c')
-rw-r--r--drivers/firewire/fw-transaction.c71
1 files changed, 46 insertions, 25 deletions
diff --git a/drivers/firewire/fw-transaction.c b/drivers/firewire/fw-transaction.c
index d36dd512a59d..e4355de710fa 100644
--- a/drivers/firewire/fw-transaction.c
+++ b/drivers/firewire/fw-transaction.c
@@ -1,6 +1,5 @@
1/* -*- c-basic-offset: 8 -*- 1/*
2 * 2 * Core IEEE1394 transaction logic
3 * fw-transaction.c - core IEEE1394 transaction logic
4 * 3 *
5 * Copyright (C) 2004-2006 Kristian Hoegsberg <krh@bitplanet.net> 4 * Copyright (C) 2004-2006 Kristian Hoegsberg <krh@bitplanet.net>
6 * 5 *
@@ -85,21 +84,27 @@ close_transaction(struct fw_transaction *transaction,
85 return -ENOENT; 84 return -ENOENT;
86} 85}
87 86
88/* Only valid for transactions that are potentially pending (ie have 87/*
89 * been sent). */ 88 * Only valid for transactions that are potentially pending (ie have
89 * been sent).
90 */
90int 91int
91fw_cancel_transaction(struct fw_card *card, 92fw_cancel_transaction(struct fw_card *card,
92 struct fw_transaction *transaction) 93 struct fw_transaction *transaction)
93{ 94{
94 /* Cancel the packet transmission if it's still queued. That 95 /*
96 * Cancel the packet transmission if it's still queued. That
95 * will call the packet transmission callback which cancels 97 * will call the packet transmission callback which cancels
96 * the transaction. */ 98 * the transaction.
99 */
97 100
98 if (card->driver->cancel_packet(card, &transaction->packet) == 0) 101 if (card->driver->cancel_packet(card, &transaction->packet) == 0)
99 return 0; 102 return 0;
100 103
101 /* If the request packet has already been sent, we need to see 104 /*
102 * if the transaction is still pending and remove it in that case. */ 105 * If the request packet has already been sent, we need to see
106 * if the transaction is still pending and remove it in that case.
107 */
103 108
104 return close_transaction(transaction, card, RCODE_CANCELLED, NULL, 0); 109 return close_transaction(transaction, card, RCODE_CANCELLED, NULL, 0);
105} 110}
@@ -131,8 +136,10 @@ transmit_complete_callback(struct fw_packet *packet,
131 close_transaction(t, card, RCODE_TYPE_ERROR, NULL, 0); 136 close_transaction(t, card, RCODE_TYPE_ERROR, NULL, 0);
132 break; 137 break;
133 default: 138 default:
134 /* In this case the ack is really a juju specific 139 /*
135 * rcode, so just forward that to the callback. */ 140 * In this case the ack is really a juju specific
141 * rcode, so just forward that to the callback.
142 */
136 close_transaction(t, card, status, NULL, 0); 143 close_transaction(t, card, status, NULL, 0);
137 break; 144 break;
138 } 145 }
@@ -243,13 +250,17 @@ fw_send_request(struct fw_card *card, struct fw_transaction *t,
243 unsigned long flags; 250 unsigned long flags;
244 int tlabel, source; 251 int tlabel, source;
245 252
246 /* Bump the flush timer up 100ms first of all so we 253 /*
247 * don't race with a flush timer callback. */ 254 * Bump the flush timer up 100ms first of all so we
255 * don't race with a flush timer callback.
256 */
248 257
249 mod_timer(&card->flush_timer, jiffies + DIV_ROUND_UP(HZ, 10)); 258 mod_timer(&card->flush_timer, jiffies + DIV_ROUND_UP(HZ, 10));
250 259
251 /* Allocate tlabel from the bitmap and put the transaction on 260 /*
252 * the list while holding the card spinlock. */ 261 * Allocate tlabel from the bitmap and put the transaction on
262 * the list while holding the card spinlock.
263 */
253 264
254 spin_lock_irqsave(&card->lock, flags); 265 spin_lock_irqsave(&card->lock, flags);
255 266
@@ -336,9 +347,11 @@ void fw_flush_transactions(struct fw_card *card)
336 list_for_each_entry_safe(t, next, &list, link) { 347 list_for_each_entry_safe(t, next, &list, link) {
337 card->driver->cancel_packet(card, &t->packet); 348 card->driver->cancel_packet(card, &t->packet);
338 349
339 /* At this point cancel_packet will never call the 350 /*
351 * At this point cancel_packet will never call the
340 * transaction callback, since we just took all the 352 * transaction callback, since we just took all the
341 * transactions out of the list. So do it here.*/ 353 * transactions out of the list. So do it here.
354 */
342 t->callback(card, RCODE_CANCELLED, NULL, 0, t->callback_data); 355 t->callback(card, RCODE_CANCELLED, NULL, 0, t->callback_data);
343 } 356 }
344} 357}
@@ -587,9 +600,11 @@ allocate_request(struct fw_packet *p)
587void 600void
588fw_send_response(struct fw_card *card, struct fw_request *request, int rcode) 601fw_send_response(struct fw_card *card, struct fw_request *request, int rcode)
589{ 602{
590 /* Broadcast packets are reported as ACK_COMPLETE, so this 603 /*
604 * Broadcast packets are reported as ACK_COMPLETE, so this
591 * check is sufficient to ensure we don't send response to 605 * check is sufficient to ensure we don't send response to
592 * broadcast packets or posted writes. */ 606 * broadcast packets or posted writes.
607 */
593 if (request->ack != ACK_PENDING) 608 if (request->ack != ACK_PENDING)
594 return; 609 return;
595 610
@@ -639,11 +654,13 @@ fw_core_handle_request(struct fw_card *card, struct fw_packet *p)
639 offset, request->length); 654 offset, request->length);
640 spin_unlock_irqrestore(&address_handler_lock, flags); 655 spin_unlock_irqrestore(&address_handler_lock, flags);
641 656
642 /* FIXME: lookup the fw_node corresponding to the sender of 657 /*
658 * FIXME: lookup the fw_node corresponding to the sender of
643 * this request and pass that to the address handler instead 659 * this request and pass that to the address handler instead
644 * of the node ID. We may also want to move the address 660 * of the node ID. We may also want to move the address
645 * allocations to fw_node so we only do this callback if the 661 * allocations to fw_node so we only do this callback if the
646 * upper layers registered it for this node. */ 662 * upper layers registered it for this node.
663 */
647 664
648 if (handler == NULL) 665 if (handler == NULL)
649 fw_send_response(card, request, RCODE_ADDRESS_ERROR); 666 fw_send_response(card, request, RCODE_ADDRESS_ERROR);
@@ -687,8 +704,10 @@ fw_core_handle_response(struct fw_card *card, struct fw_packet *p)
687 return; 704 return;
688 } 705 }
689 706
690 /* FIXME: sanity check packet, is length correct, does tcodes 707 /*
691 * and addresses match. */ 708 * FIXME: sanity check packet, is length correct, does tcodes
709 * and addresses match.
710 */
692 711
693 switch (tcode) { 712 switch (tcode) {
694 case TCODE_READ_QUADLET_RESPONSE: 713 case TCODE_READ_QUADLET_RESPONSE:
@@ -790,11 +809,13 @@ handle_registers(struct fw_card *card, struct fw_request *request,
790 case CSR_BANDWIDTH_AVAILABLE: 809 case CSR_BANDWIDTH_AVAILABLE:
791 case CSR_CHANNELS_AVAILABLE_HI: 810 case CSR_CHANNELS_AVAILABLE_HI:
792 case CSR_CHANNELS_AVAILABLE_LO: 811 case CSR_CHANNELS_AVAILABLE_LO:
793 /* FIXME: these are handled by the OHCI hardware and 812 /*
813 * FIXME: these are handled by the OHCI hardware and
794 * the stack never sees these request. If we add 814 * the stack never sees these request. If we add
795 * support for a new type of controller that doesn't 815 * support for a new type of controller that doesn't
796 * handle this in hardware we need to deal with these 816 * handle this in hardware we need to deal with these
797 * transactions. */ 817 * transactions.
818 */
798 BUG(); 819 BUG();
799 break; 820 break;
800 821