]> Pileus Git - ~andy/linux/commitdiff
firewire: normalize status values in packet callbacks
authorStefan Richter <stefanr@s5r6.in-berlin.de>
Sun, 18 Jul 2010 10:44:01 +0000 (12:44 +0200)
committerStefan Richter <stefanr@s5r6.in-berlin.de>
Fri, 23 Jul 2010 11:36:27 +0000 (13:36 +0200)
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>
drivers/firewire/core-card.c
drivers/firewire/core-transaction.c
include/linux/firewire.h

index 2bb5c036e80692176d3db524fbffed8add9f49f0..0c312c4bb4bd08f9bd7c716a94648c8730ebc6cc 100644 (file)
@@ -570,12 +570,12 @@ static int dummy_set_config_rom(struct fw_card *card,
 
 static void dummy_send_request(struct fw_card *card, struct fw_packet *packet)
 {
-       packet->callback(packet, card, -ENODEV);
+       packet->callback(packet, card, RCODE_CANCELLED);
 }
 
 static void dummy_send_response(struct fw_card *card, struct fw_packet *packet)
 {
-       packet->callback(packet, card, -ENODEV);
+       packet->callback(packet, card, RCODE_CANCELLED);
 }
 
 static int dummy_cancel_packet(struct fw_card *card, struct fw_packet *packet)
index 5f5a7852f7ac5afc3cd7690d6e94773106b045ed..e2e4dc624fb61898f1850310d00e37d87379a961 100644 (file)
@@ -310,7 +310,10 @@ static int allocate_tlabel(struct fw_card *card)
  * After the transaction is completed successfully or unsuccessfully, the
  * @callback will be called.  Among its parameters is the response code which
  * is either one of the rcodes per IEEE 1394 or, in case of internal errors,
- * the firewire-core specific %RCODE_SEND_ERROR.
+ * the firewire-core specific %RCODE_SEND_ERROR.  The other firewire-core
+ * specific rcodes (%RCODE_CANCELLED, %RCODE_BUSY, %RCODE_GENERATION,
+ * %RCODE_NO_ACK) denote transaction timeout, busy responder, stale request
+ * generation, or missing ACK respectively.
  *
  * Note some timing corner cases:  fw_send_request() may complete much earlier
  * than when the request packet actually hits the wire.  On the other hand,
index adc5b55e6e5f6cfcf2e0fb19d0b2b6af1fdddbd6..0c38b8e97722fdb46b5908f611002e6900119980 100644 (file)
@@ -285,10 +285,10 @@ struct fw_packet {
        u32 timestamp;
 
        /*
-        * This callback is called when the packet transmission has
-        * completed; for successful transmission, the status code is
-        * the ack received from the destination, otherwise it's a
-        * negative errno: ENOMEM, ESTALE, ETIMEDOUT, ENODEV, EIO.
+        * This callback is called when the packet transmission has completed.
+        * For successful transmission, the status code is the ack received
+        * from the destination.  Otherwise it is one of the juju-specific
+        * rcodes:  RCODE_SEND_ERROR, _CANCELLED, _BUSY, _GENERATION, _NO_ACK.
         * The callback can be called from tasklet context and thus
         * must never block.
         */