scsi: pmcraid: simplify pmcraid_cancel_all a bit
authorChristoph Hellwig <hch@lst.de>
Thu, 18 Oct 2018 13:05:35 +0000 (15:05 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 7 Nov 2018 02:31:29 +0000 (21:31 -0500)
No need for a local cmd_done variable, and pass boolean values as bool
type instead of u32.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/pmcraid.c

index 4e86994e10e81f4c41a2617ce8660e97ee772e66..3ba60642024776b97610832e56274590c40bec2f 100644 (file)
@@ -2491,17 +2491,15 @@ static void pmcraid_request_sense(struct pmcraid_cmd *cmd)
 /**
  * pmcraid_cancel_all - cancel all outstanding IOARCBs as part of error recovery
  * @cmd: command that failed
- * @sense: true if request_sense is required after cancel all
+ * @need_sense: true if request_sense is required after cancel all
  *
  * This function sends a cancel all to a device to clear the queue.
  */
-static void pmcraid_cancel_all(struct pmcraid_cmd *cmd, u32 sense)
+static void pmcraid_cancel_all(struct pmcraid_cmd *cmd, bool need_sense)
 {
        struct scsi_cmnd *scsi_cmd = cmd->scsi_cmd;
        struct pmcraid_ioarcb *ioarcb = &cmd->ioa_cb->ioarcb;
        struct pmcraid_resource_entry *res = scsi_cmd->device->hostdata;
-       void (*cmd_done) (struct pmcraid_cmd *) = sense ? pmcraid_erp_done
-                                                       : pmcraid_request_sense;
 
        memset(ioarcb->cdb, 0, PMCRAID_MAX_CDB_LEN);
        ioarcb->request_flags0 = SYNC_OVERRIDE;
@@ -2519,7 +2517,8 @@ static void pmcraid_cancel_all(struct pmcraid_cmd *cmd, u32 sense)
        /* writing to IOARRIN must be protected by host_lock, as mid-layer
         * schedule queuecommand while we are doing this
         */
-       pmcraid_send_cmd(cmd, cmd_done,
+       pmcraid_send_cmd(cmd, need_sense ?
+                        pmcraid_erp_done : pmcraid_request_sense,
                         PMCRAID_REQUEST_SENSE_TIMEOUT,
                         pmcraid_timeout_handler);
 }
@@ -2612,7 +2611,7 @@ static int pmcraid_error_handler(struct pmcraid_cmd *cmd)
        struct pmcraid_ioasa *ioasa = &cmd->ioa_cb->ioasa;
        u32 ioasc = le32_to_cpu(ioasa->ioasc);
        u32 masked_ioasc = ioasc & PMCRAID_IOASC_SENSE_MASK;
-       u32 sense_copied = 0;
+       bool sense_copied = false;
 
        if (!res) {
                pmcraid_info("resource pointer is NULL\n");
@@ -2684,7 +2683,7 @@ static int pmcraid_error_handler(struct pmcraid_cmd *cmd)
                        memcpy(scsi_cmd->sense_buffer,
                               ioasa->sense_data,
                               data_size);
-                       sense_copied = 1;
+                       sense_copied = true;
                }
 
                if (RES_IS_GSCSI(res->cfg_entry))