Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d38ae168bfde9195466b9d45cb1126a657c10942
Commit:     d38ae168bfde9195466b9d45cb1126a657c10942
Parent:     09f0892ec7f8068ba1d1fcef4d1fca23ec96e0dd
Author:     Mike Miller (OS Dev) <[EMAIL PROTECTED]>
AuthorDate: Tue May 8 00:29:29 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Tue May 8 11:15:09 2007 -0700

    cciss: reformat error handling
    
    Reformat some error handling code to reduce line lengths a bit.
    
    Signed-off-by: Stephen M. Cameron <[EMAIL PROTECTED]>
    Signed-off-by: Mike Miller <[EMAIL PROTECTED]>
    Cc: James Bottomley <[EMAIL PROTECTED]>
    Cc: Jens Axboe <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 drivers/block/cciss.c |  174 +++++++++++++++++++++++++------------------------
 1 files changed, 89 insertions(+), 85 deletions(-)

diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 65a725c..b00be14 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -2349,95 +2349,99 @@ static inline void complete_command(ctlr_info_t *h, 
CommandList_struct *cmd,
        if (timeout)
                status = 0;
 
-       if (cmd->err_info->CommandStatus != 0) {        /* an error has 
occurred */
-               switch (cmd->err_info->CommandStatus) {
-                       unsigned char sense_key;
-               case CMD_TARGET_STATUS:
-                       status = 0;
+       if (cmd->err_info->CommandStatus == 0)  /* no error has occurred */
+               goto after_error_processing;
 
-                       if (cmd->err_info->ScsiStatus == 0x02) {
-                               printk(KERN_WARNING "cciss: cmd %p "
-                                      "has CHECK CONDITION "
-                                      " byte 2 = 0x%x\n", cmd,
-                                      cmd->err_info->SenseInfo[2]
-                                   );
-                               /* check the sense key */
-                               sense_key = 0xf & cmd->err_info->SenseInfo[2];
-                               /* no status or recovered error */
-                               if ((sense_key == 0x0) || (sense_key == 0x1)) {
-                                       status = 1;
-                               }
-                       } else {
-                               printk(KERN_WARNING "cciss: cmd %p "
-                                      "has SCSI Status 0x%x\n",
-                                      cmd, cmd->err_info->ScsiStatus);
+       switch (cmd->err_info->CommandStatus) {
+               unsigned char sense_key;
+       case CMD_TARGET_STATUS:
+               status = 0;
+
+               if (cmd->err_info->ScsiStatus == 0x02) {
+                       printk(KERN_WARNING "cciss: cmd %p "
+                              "has CHECK CONDITION "
+                              " byte 2 = 0x%x\n", cmd,
+                              cmd->err_info->SenseInfo[2]
+                           );
+                       /* check the sense key */
+                       sense_key = 0xf & cmd->err_info->SenseInfo[2];
+                       /* no status or recovered error */
+                       if ((sense_key == 0x0) || (sense_key == 0x1)) {
+                               status = 1;
                        }
-                       break;
-               case CMD_DATA_UNDERRUN:
-                       printk(KERN_WARNING "cciss: cmd %p has"
-                              " completed with data underrun "
-                              "reported\n", cmd);
-                       break;
-               case CMD_DATA_OVERRUN:
-                       printk(KERN_WARNING "cciss: cmd %p has"
-                              " completed with data overrun "
-                              "reported\n", cmd);
-                       break;
-               case CMD_INVALID:
-                       printk(KERN_WARNING "cciss: cmd %p is "
-                              "reported invalid\n", cmd);
-                       status = 0;
-                       break;
-               case CMD_PROTOCOL_ERR:
-                       printk(KERN_WARNING "cciss: cmd %p has "
-                              "protocol error \n", cmd);
-                       status = 0;
-                       break;
-               case CMD_HARDWARE_ERR:
-                       printk(KERN_WARNING "cciss: cmd %p had "
-                              " hardware error\n", cmd);
-                       status = 0;
-                       break;
-               case CMD_CONNECTION_LOST:
-                       printk(KERN_WARNING "cciss: cmd %p had "
-                              "connection lost\n", cmd);
-                       status = 0;
-                       break;
-               case CMD_ABORTED:
-                       printk(KERN_WARNING "cciss: cmd %p was "
-                              "aborted\n", cmd);
-                       status = 0;
-                       break;
-               case CMD_ABORT_FAILED:
-                       printk(KERN_WARNING "cciss: cmd %p reports "
-                              "abort failed\n", cmd);
-                       status = 0;
-                       break;
-               case CMD_UNSOLICITED_ABORT:
-                       printk(KERN_WARNING "cciss%d: unsolicited "
-                              "abort %p\n", h->ctlr, cmd);
-                       if (cmd->retry_count < MAX_CMD_RETRIES) {
-                               retry_cmd = 1;
-                               printk(KERN_WARNING
-                                      "cciss%d: retrying %p\n", h->ctlr, cmd);
-                               cmd->retry_count++;
-                       } else
-                               printk(KERN_WARNING
-                                      "cciss%d: %p retried too "
-                                      "many times\n", h->ctlr, cmd);
-                       status = 0;
-                       break;
-               case CMD_TIMEOUT:
-                       printk(KERN_WARNING "cciss: cmd %p timedout\n", cmd);
-                       status = 0;
-                       break;
-               default:
-                       printk(KERN_WARNING "cciss: cmd %p returned "
-                              "unknown status %x\n", cmd,
-                              cmd->err_info->CommandStatus);
-                       status = 0;
+               } else {
+                       printk(KERN_WARNING "cciss: cmd %p "
+                              "has SCSI Status 0x%x\n",
+                              cmd, cmd->err_info->ScsiStatus);
                }
+               break;
+       case CMD_DATA_UNDERRUN:
+               printk(KERN_WARNING "cciss: cmd %p has"
+                      " completed with data underrun "
+                      "reported\n", cmd);
+               break;
+       case CMD_DATA_OVERRUN:
+               printk(KERN_WARNING "cciss: cmd %p has"
+                      " completed with data overrun "
+                      "reported\n", cmd);
+               break;
+       case CMD_INVALID:
+               printk(KERN_WARNING "cciss: cmd %p is "
+                      "reported invalid\n", cmd);
+               status = 0;
+               break;
+       case CMD_PROTOCOL_ERR:
+               printk(KERN_WARNING "cciss: cmd %p has "
+                      "protocol error \n", cmd);
+               status = 0;
+               break;
+       case CMD_HARDWARE_ERR:
+               printk(KERN_WARNING "cciss: cmd %p had "
+                      " hardware error\n", cmd);
+               status = 0;
+               break;
+       case CMD_CONNECTION_LOST:
+               printk(KERN_WARNING "cciss: cmd %p had "
+                      "connection lost\n", cmd);
+               status = 0;
+               break;
+       case CMD_ABORTED:
+               printk(KERN_WARNING "cciss: cmd %p was "
+                      "aborted\n", cmd);
+               status = 0;
+               break;
+       case CMD_ABORT_FAILED:
+               printk(KERN_WARNING "cciss: cmd %p reports "
+                      "abort failed\n", cmd);
+               status = 0;
+               break;
+       case CMD_UNSOLICITED_ABORT:
+               printk(KERN_WARNING "cciss%d: unsolicited "
+                      "abort %p\n", h->ctlr, cmd);
+               if (cmd->retry_count < MAX_CMD_RETRIES) {
+                       retry_cmd = 1;
+                       printk(KERN_WARNING
+                              "cciss%d: retrying %p\n", h->ctlr, cmd);
+                       cmd->retry_count++;
+               } else
+                       printk(KERN_WARNING
+                              "cciss%d: %p retried too "
+                              "many times\n", h->ctlr, cmd);
+               status = 0;
+               break;
+       case CMD_TIMEOUT:
+               printk(KERN_WARNING "cciss: cmd %p timedout\n", cmd);
+               status = 0;
+               break;
+       default:
+               printk(KERN_WARNING "cciss: cmd %p returned "
+                      "unknown status %x\n", cmd,
+                      cmd->err_info->CommandStatus);
+               status = 0;
        }
+
+after_error_processing:
+
        /* We need to return this command */
        if (retry_cmd) {
                resend_cciss_cmd(h, cmd);
-
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