Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e5f49c3b837ff90c8aec2c6c66c4966080aced06
Commit:     e5f49c3b837ff90c8aec2c6c66c4966080aced06
Parent:     93c4cceb963ebb133531e5e3f4f6e2da0d222656
Author:     Kristian Høgsberg <[EMAIL PROTECTED]>
AuthorDate: Fri Jan 26 00:38:34 2007 -0500
Committer:  Stefan Richter <[EMAIL PROTECTED]>
CommitDate: Fri Mar 9 22:02:47 2007 +0100

    firewire: Sanitize send error codes.
    
    Drop the negative errnos and use RCODEs for all error codes
    in the complete transaction callback.
    
    Signed-off-by: Kristian Høgsberg <[EMAIL PROTECTED]>
    Signed-off-by: Stefan Richter <[EMAIL PROTECTED]>
---
 drivers/firewire/fw-ohci.c        |   20 ++++++++++----------
 drivers/firewire/fw-transaction.c |   12 ++++++------
 drivers/firewire/fw-transaction.h |    2 ++
 3 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c
index ac6c018..58bc85d 100644
--- a/drivers/firewire/fw-ohci.c
+++ b/drivers/firewire/fw-ohci.c
@@ -376,7 +376,7 @@ at_context_setup_packet(struct at_context *ctx, struct 
list_head *list)
                                                     packet->payload_length,
                                                     DMA_TO_DEVICE);
                if (packet->payload_bus == 0) {
-                       complete_transmission(packet, -ENOMEM, list);
+                       complete_transmission(packet, RCODE_SEND_ERROR, list);
                        return;
                }
 
@@ -438,7 +438,7 @@ at_context_setup_packet(struct at_context *ctx, struct 
list_head *list)
                /* We dont return error codes from this function; all
                 * transmission errors are reported through the
                 * callback. */
-               complete_transmission(packet, -ESTALE, list);
+               complete_transmission(packet, RCODE_GENERATION, list);
        }
 }
 
@@ -484,26 +484,26 @@ static void at_context_tasklet(unsigned long data)
                switch (evt) {
                case OHCI1394_evt_timeout:
                        /* Async response transmit timed out. */
-                       complete_transmission(packet, -ETIMEDOUT, &list);
+                       complete_transmission(packet, RCODE_CANCELLED, &list);
                        break;
 
                case OHCI1394_evt_flushed:
                        /* The packet was flushed should give same
                         * error as when we try to use a stale
                         * generation count. */
-                       complete_transmission(packet, -ESTALE, &list);
+                       complete_transmission(packet,
+                                             RCODE_GENERATION, &list);
                        break;
 
                case OHCI1394_evt_missing_ack:
-                       /* This would be a higher level software
-                        * error, it is using a valid (current)
-                        * generation count, but the node is not on
-                        * the bus. */
-                       complete_transmission(packet, -ENODEV, &list);
+                       /* Using a valid (current) generation count,
+                        * but the node is not on the bus or not
+                        * sending acks. */
+                       complete_transmission(packet, RCODE_NO_ACK, &list);
                        break;
 
                default:
-                       complete_transmission(packet, -EIO, &list);
+                       complete_transmission(packet, RCODE_SEND_ERROR, &list);
                        break;
                }
        } else
diff --git a/drivers/firewire/fw-transaction.c 
b/drivers/firewire/fw-transaction.c
index 780ed2b..8387c8e 100644
--- a/drivers/firewire/fw-transaction.c
+++ b/drivers/firewire/fw-transaction.c
@@ -93,15 +93,15 @@ transmit_complete_callback(struct fw_packet *packet,
                close_transaction(t, card, RCODE_BUSY, NULL, 0);
                break;
        case ACK_DATA_ERROR:
+               close_transaction(t, card, RCODE_DATA_ERROR, NULL, 0);
+               break;
        case ACK_TYPE_ERROR:
-               close_transaction(t, card, RCODE_SEND_ERROR, NULL, 0);
+               close_transaction(t, card, RCODE_TYPE_ERROR, NULL, 0);
                break;
        default:
-               /* FIXME: In this case, status is a negative errno,
-                * corresponding to an OHCI specific transmit error
-                * code.  We should map that to an RCODE instead of
-                * just the generic RCODE_SEND_ERROR. */
-               close_transaction(t, card, RCODE_SEND_ERROR, NULL, 0);
+               /* In this case the ack is really a juju specific
+                * rcode, so just forward that to the callback. */
+               close_transaction(t, card, status, NULL, 0);
                break;
        }
 }
diff --git a/drivers/firewire/fw-transaction.h 
b/drivers/firewire/fw-transaction.h
index fb46ef7..ad7ba32 100644
--- a/drivers/firewire/fw-transaction.h
+++ b/drivers/firewire/fw-transaction.h
@@ -87,6 +87,8 @@
 #define RCODE_SEND_ERROR       0x10
 #define RCODE_CANCELLED                0x11
 #define RCODE_BUSY             0x12
+#define RCODE_GENERATION       0x13
+#define RCODE_NO_ACK           0x14
 
 #define RETRY_1        0x00
 #define RETRY_X        0x01
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to