aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2010-07-18 06:44:01 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2010-07-23 07:36:27 -0400
commit18d0cdfd1a4cc9028c0ef80f94538b31541f8fe5 (patch)
treec28db7537da311e59e871aba7f6f0edaa46535b9 /drivers/firewire
parent80792d182e43bee89fce509e64fdea27e600530f (diff)
firewire: normalize status values in packet callbacks
core-transaction.c transmit_complete_callback() and close_transaction() expect packet callback status to be an ACK or RCODE, and ACKs get translated to RCODEs for transaction callbacks. An old comment on the packet callback API (been there from the initial submission of the stack) and the dummy_driver implementation of send_request/send_response deviated from this as they also included -ERRNO in the range of status values. Let's narrow status values down to ACK and RCODE to prevent surprises. RCODE_CANCELLED is chosen as the dummy_driver's RCODE as its meaning of "transaction timed out" comes closest to what happens when a transaction coincides with card removal. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire')
-rw-r--r--drivers/firewire/core-card.c4
-rw-r--r--drivers/firewire/core-transaction.c5
2 files changed, 6 insertions, 3 deletions
diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c
index 2bb5c036e806..0c312c4bb4bd 100644
--- a/drivers/firewire/core-card.c
+++ b/drivers/firewire/core-card.c
@@ -570,12 +570,12 @@ static int dummy_set_config_rom(struct fw_card *card,
570 570
571static void dummy_send_request(struct fw_card *card, struct fw_packet *packet) 571static void dummy_send_request(struct fw_card *card, struct fw_packet *packet)
572{ 572{
573 packet->callback(packet, card, -ENODEV); 573 packet->callback(packet, card, RCODE_CANCELLED);
574} 574}
575 575
576static void dummy_send_response(struct fw_card *card, struct fw_packet *packet) 576static void dummy_send_response(struct fw_card *card, struct fw_packet *packet)
577{ 577{
578 packet->callback(packet, card, -ENODEV); 578 packet->callback(packet, card, RCODE_CANCELLED);
579} 579}
580 580
581static int dummy_cancel_packet(struct fw_card *card, struct fw_packet *packet) 581static int dummy_cancel_packet(struct fw_card *card, struct fw_packet *packet)
diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c
index 5f5a7852f7ac..e2e4dc624fb6 100644
--- a/drivers/firewire/core-transaction.c
+++ b/drivers/firewire/core-transaction.c
@@ -310,7 +310,10 @@ static int allocate_tlabel(struct fw_card *card)
310 * After the transaction is completed successfully or unsuccessfully, the 310 * After the transaction is completed successfully or unsuccessfully, the
311 * @callback will be called. Among its parameters is the response code which 311 * @callback will be called. Among its parameters is the response code which
312 * is either one of the rcodes per IEEE 1394 or, in case of internal errors, 312 * is either one of the rcodes per IEEE 1394 or, in case of internal errors,
313 * the firewire-core specific %RCODE_SEND_ERROR. 313 * the firewire-core specific %RCODE_SEND_ERROR. The other firewire-core
314 * specific rcodes (%RCODE_CANCELLED, %RCODE_BUSY, %RCODE_GENERATION,
315 * %RCODE_NO_ACK) denote transaction timeout, busy responder, stale request
316 * generation, or missing ACK respectively.
314 * 317 *
315 * Note some timing corner cases: fw_send_request() may complete much earlier 318 * Note some timing corner cases: fw_send_request() may complete much earlier
316 * than when the request packet actually hits the wire. On the other hand, 319 * than when the request packet actually hits the wire. On the other hand,