scsi: qla2xxx: Open-code qla2xxx_eh_device_reset()
authorHannes Reinecke <hare@suse.de>
Thu, 19 Aug 2021 09:19:13 +0000 (11:19 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 24 Aug 2021 02:41:41 +0000 (22:41 -0400)
Device reset and target reset will be using different calling sequences, so
open-code __qla2xxx_eh_generic_reset() in qla2xxx_eh_device_reset(), and
remove the now obsolete function __qla2xxx_eh_generic_reset().  No
functional changes.

Link: https://lore.kernel.org/r/20210819091913.94436-4-hare@suse.de
Cc: Nilesh Javali <njavali@marvell.com>
Reviewed-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qla2xxx/qla_os.c

index ffcb72c..d2e40aa 100644 (file)
@@ -1389,18 +1389,27 @@ static char *reset_errors[] = {
 };
 
 static int
-__qla2xxx_eh_generic_reset(char *name, enum nexus_wait_type type,
-    struct scsi_cmnd *cmd, int (*do_reset)(struct fc_port *, uint64_t, int))
+qla2xxx_eh_device_reset(struct scsi_cmnd *cmd)
 {
-       scsi_qla_host_t *vha = shost_priv(cmd->device->host);
-       fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
+       struct scsi_device *sdev = cmd->device;
+       scsi_qla_host_t *vha = shost_priv(sdev->host);
+       struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
+       fc_port_t *fcport = (struct fc_port *) sdev->hostdata;
+       struct qla_hw_data *ha = vha->hw;
        int err;
 
+       if (qla2x00_isp_reg_stat(ha)) {
+               ql_log(ql_log_info, vha, 0x803e,
+                   "PCI/Register disconnect, exiting.\n");
+               qla_pci_set_eeh_busy(vha);
+               return FAILED;
+       }
+
        if (!fcport) {
                return FAILED;
        }
 
-       err = fc_block_scsi_eh(cmd);
+       err = fc_block_rport(rport);
        if (err != 0)
                return err;
 
@@ -1408,8 +1417,8 @@ __qla2xxx_eh_generic_reset(char *name, enum nexus_wait_type type,
                return SUCCESS;
 
        ql_log(ql_log_info, vha, 0x8009,
-           "%s RESET ISSUED nexus=%ld:%d:%llu cmd=%p.\n", name, vha->host_no,
-           cmd->device->id, cmd->device->lun, cmd);
+           "DEVICE RESET ISSUED nexus=%ld:%d:%llu cmd=%p.\n", vha->host_no,
+           sdev->id, sdev->lun, cmd);
 
        err = 0;
        if (qla2x00_wait_for_hba_online(vha) != QLA_SUCCESS) {
@@ -1418,53 +1427,36 @@ __qla2xxx_eh_generic_reset(char *name, enum nexus_wait_type type,
                goto eh_reset_failed;
        }
        err = 2;
-       if (do_reset(fcport, cmd->device->lun, 1)
+       if (ha->isp_ops->lun_reset(fcport, sdev->lun, 1)
                != QLA_SUCCESS) {
                ql_log(ql_log_warn, vha, 0x800c,
                    "do_reset failed for cmd=%p.\n", cmd);
                goto eh_reset_failed;
        }
        err = 3;
-       if (qla2x00_eh_wait_for_pending_commands(vha, cmd->device->id,
-           cmd->device->lun, type) != QLA_SUCCESS) {
+       if (qla2x00_eh_wait_for_pending_commands(vha, sdev->id,
+           sdev->lun, WAIT_LUN) != QLA_SUCCESS) {
                ql_log(ql_log_warn, vha, 0x800d,
                    "wait for pending cmds failed for cmd=%p.\n", cmd);
                goto eh_reset_failed;
        }
 
        ql_log(ql_log_info, vha, 0x800e,
-           "%s RESET SUCCEEDED nexus:%ld:%d:%llu cmd=%p.\n", name,
-           vha->host_no, cmd->device->id, cmd->device->lun, cmd);
+           "DEVICE RESET SUCCEEDED nexus:%ld:%d:%llu cmd=%p.\n",
+           vha->host_no, sdev->id, sdev->lun, cmd);
 
        return SUCCESS;
 
 eh_reset_failed:
        ql_log(ql_log_info, vha, 0x800f,
-           "%s RESET FAILED: %s nexus=%ld:%d:%llu cmd=%p.\n", name,
-           reset_errors[err], vha->host_no, cmd->device->id, cmd->device->lun,
+           "DEVICE RESET FAILED: %s nexus=%ld:%d:%llu cmd=%p.\n",
+           reset_errors[err], vha->host_no, sdev->id, sdev->lun,
            cmd);
        vha->reset_cmd_err_cnt++;
        return FAILED;
 }
 
 static int
-qla2xxx_eh_device_reset(struct scsi_cmnd *cmd)
-{
-       scsi_qla_host_t *vha = shost_priv(cmd->device->host);
-       struct qla_hw_data *ha = vha->hw;
-
-       if (qla2x00_isp_reg_stat(ha)) {
-               ql_log(ql_log_info, vha, 0x803e,
-                   "PCI/Register disconnect, exiting.\n");
-               qla_pci_set_eeh_busy(vha);
-               return FAILED;
-       }
-
-       return __qla2xxx_eh_generic_reset("DEVICE", WAIT_LUN, cmd,
-           ha->isp_ops->lun_reset);
-}
-
-static int
 qla2xxx_eh_target_reset(struct scsi_cmnd *cmd)
 {
        struct scsi_device *sdev = cmd->device;