Skip to content

Commit

Permalink
scsi: fdomain: Drop last argument to fdomain_finish_cmd()
Browse files Browse the repository at this point in the history
Set the SCSI host status before calling fdomain_finish_cmd() and drop the
last argument to that function.

Link: https://lore.kernel.org/r/20210427083046.31620-36-hare@suse.de
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Hannes Reinecke authored and Martin K. Petersen committed Jun 1, 2021
1 parent a87afe2 commit b2e88c9
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions drivers/scsi/fdomain.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,10 @@ static int fdomain_select(struct Scsi_Host *sh, int target)
return 1;
}

static void fdomain_finish_cmd(struct fdomain *fd, int result)
static void fdomain_finish_cmd(struct fdomain *fd)
{
outb(0, fd->base + REG_ICTL);
fdomain_make_bus_idle(fd);
fd->cur_cmd->result = result;
fd->cur_cmd->scsi_done(fd->cur_cmd);
fd->cur_cmd = NULL;
}
Expand Down Expand Up @@ -273,7 +272,8 @@ static void fdomain_work(struct work_struct *work)
if (cmd->SCp.phase & in_arbitration) {
status = inb(fd->base + REG_ASTAT);
if (!(status & ASTAT_ARB)) {
fdomain_finish_cmd(fd, DID_BUS_BUSY << 16);
set_host_byte(cmd, DID_BUS_BUSY);
fdomain_finish_cmd(fd);
goto out;
}
cmd->SCp.phase = in_selection;
Expand All @@ -290,7 +290,8 @@ static void fdomain_work(struct work_struct *work)
if (!(status & BSTAT_BSY)) {
/* Try again, for slow devices */
if (fdomain_select(cmd->device->host, scmd_id(cmd))) {
fdomain_finish_cmd(fd, DID_NO_CONNECT << 16);
set_host_byte(cmd, DID_NO_CONNECT);
fdomain_finish_cmd(fd);
goto out;
}
/* Stop arbitration and enable parity */
Expand Down Expand Up @@ -333,7 +334,7 @@ static void fdomain_work(struct work_struct *work)
break;
case BSTAT_MSG | BSTAT_CMD | BSTAT_IO: /* MESSAGE IN */
cmd->SCp.Message = inb(fd->base + REG_SCSI_DATA);
if (!cmd->SCp.Message)
if (cmd->SCp.Message == COMMAND_COMPLETE)
++done;
break;
}
Expand All @@ -359,9 +360,10 @@ static void fdomain_work(struct work_struct *work)
fdomain_read_data(cmd);

if (done) {
fdomain_finish_cmd(fd, (cmd->SCp.Status & 0xff) |
((cmd->SCp.Message & 0xff) << 8) |
(DID_OK << 16));
set_status_byte(cmd, cmd->SCp.Status);
set_msg_byte(cmd, cmd->SCp.Message);
set_host_byte(cmd, DID_OK);
fdomain_finish_cmd(fd);
} else {
if (cmd->SCp.phase & disconnect) {
outb(ICTL_FIFO | ICTL_SEL | ICTL_REQ | FIFO_COUNT,
Expand Down Expand Up @@ -439,10 +441,10 @@ static int fdomain_abort(struct scsi_cmnd *cmd)

fdomain_make_bus_idle(fd);
fd->cur_cmd->SCp.phase |= aborted;
fd->cur_cmd->result = DID_ABORT << 16;

/* Aborts are not done well. . . */
fdomain_finish_cmd(fd, DID_ABORT << 16);
set_host_byte(fd->cur_cmd, DID_ABORT);
fdomain_finish_cmd(fd);
spin_unlock_irqrestore(sh->host_lock, flags);
return SUCCESS;
}
Expand Down

0 comments on commit b2e88c9

Please sign in to comment.