diff mbox series

[03/24] wd33c93: use SCSI status

Message ID 20191021095322.137969-4-hare@suse.de (mailing list archive)
State Changes Requested
Headers show
Series scsi: Revamp result values | expand

Commit Message

Hannes Reinecke Oct. 21, 2019, 9:53 a.m. UTC
Use standard SCSI status and drop usage of the linux-specific ones.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/wd33c93.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

Comments

Finn Thain Oct. 21, 2019, 11:16 p.m. UTC | #1
On Mon, 21 Oct 2019, Hannes Reinecke wrote:

> Use standard SCSI status and drop usage of the linux-specific ones.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>  drivers/scsi/wd33c93.c | 21 ++++++++-------------
>  1 file changed, 8 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/scsi/wd33c93.c b/drivers/scsi/wd33c93.c
> index f81046f0e68a..98e04a7b9d63 100644
> --- a/drivers/scsi/wd33c93.c
> +++ b/drivers/scsi/wd33c93.c
> @@ -1176,10 +1176,8 @@ wd33c93_intr(struct Scsi_Host *instance)
>  			if (cmd->SCp.Status == ILLEGAL_STATUS_BYTE)
>  				cmd->SCp.Status = lun;
>  			if (cmd->cmnd[0] == REQUEST_SENSE
> -			    && cmd->SCp.Status != GOOD)
> -				cmd->result =
> -				    (cmd->
> -				     result & 0x00ffff) | (DID_ERROR << 16);
> +			    && cmd->SCp.Status != SAM_STAT_GOOD)
> +				set_host_byte(cmd, DID_ERROR);

This isn't obviously equivalent. Perhaps the set_host_byte() changes 
should be done in a separate patch to the SAM_STAT_FOO changes (?)

>  			else
>  				cmd->result =
>  				    cmd->SCp.Status | (cmd->SCp.Message << 8);
> @@ -1262,9 +1260,8 @@ wd33c93_intr(struct Scsi_Host *instance)
>  		    hostdata->connected = NULL;
>  		hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xff));
>  		hostdata->state = S_UNCONNECTED;
> -		if (cmd->cmnd[0] == REQUEST_SENSE && cmd->SCp.Status != GOOD)
> -			cmd->result =
> -			    (cmd->result & 0x00ffff) | (DID_ERROR << 16);
> +		if (cmd->cmnd[0] == REQUEST_SENSE && cmd->SCp.Status != SAM_STAT_GOOD)
> +			set_host_byte(cmd, DID_ERROR);

Same.

>  		else
>  			cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8);
>  		cmd->scsi_done(cmd);
> @@ -1294,12 +1291,10 @@ wd33c93_intr(struct Scsi_Host *instance)
>  			hostdata->connected = NULL;
>  			hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xff));
>  			hostdata->state = S_UNCONNECTED;
> -			DB(DB_INTR, printk(":%d", cmd->SCp.Status))
> -			    if (cmd->cmnd[0] == REQUEST_SENSE
> -				&& cmd->SCp.Status != GOOD)
> -				cmd->result =
> -				    (cmd->
> -				     result & 0x00ffff) | (DID_ERROR << 16);
> +			DB(DB_INTR, printk(":%d", cmd->SCp.Status));
> +			if (cmd->cmnd[0] == REQUEST_SENSE
> +			    && cmd->SCp.Status != SAM_STAT_GOOD)
> +				set_host_byte(cmd->result, DID_ERROR);

Same.
Hannes Reinecke Oct. 22, 2019, 5:59 a.m. UTC | #2
On 10/22/19 1:16 AM, Finn Thain wrote:
> On Mon, 21 Oct 2019, Hannes Reinecke wrote:
> 
>> Use standard SCSI status and drop usage of the linux-specific ones.
>>
>> Signed-off-by: Hannes Reinecke <hare@suse.de>
>> ---
>>  drivers/scsi/wd33c93.c | 21 ++++++++-------------
>>  1 file changed, 8 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/scsi/wd33c93.c b/drivers/scsi/wd33c93.c
>> index f81046f0e68a..98e04a7b9d63 100644
>> --- a/drivers/scsi/wd33c93.c
>> +++ b/drivers/scsi/wd33c93.c
>> @@ -1176,10 +1176,8 @@ wd33c93_intr(struct Scsi_Host *instance)
>>  			if (cmd->SCp.Status == ILLEGAL_STATUS_BYTE)
>>  				cmd->SCp.Status = lun;
>>  			if (cmd->cmnd[0] == REQUEST_SENSE
>> -			    && cmd->SCp.Status != GOOD)
>> -				cmd->result =
>> -				    (cmd->
>> -				     result & 0x00ffff) | (DID_ERROR << 16);
>> +			    && cmd->SCp.Status != SAM_STAT_GOOD)
>> +				set_host_byte(cmd, DID_ERROR);
> 
> This isn't obviously equivalent. Perhaps the set_host_byte() changes 
> should be done in a separate patch to the SAM_STAT_FOO changes (?)
> 
Yes, indeed.
Will be fixing it up in the next round.

>>  			else
>>  				cmd->result =
>>  				    cmd->SCp.Status | (cmd->SCp.Message << 8);
>> @@ -1262,9 +1260,8 @@ wd33c93_intr(struct Scsi_Host *instance)
>>  		    hostdata->connected = NULL;
>>  		hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xff));
>>  		hostdata->state = S_UNCONNECTED;
>> -		if (cmd->cmnd[0] == REQUEST_SENSE && cmd->SCp.Status != GOOD)
>> -			cmd->result =
>> -			    (cmd->result & 0x00ffff) | (DID_ERROR << 16);
>> +		if (cmd->cmnd[0] == REQUEST_SENSE && cmd->SCp.Status != SAM_STAT_GOOD)
>> +			set_host_byte(cmd, DID_ERROR);
> 
> Same.
> 
>>  		else
>>  			cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8);
>>  		cmd->scsi_done(cmd);
>> @@ -1294,12 +1291,10 @@ wd33c93_intr(struct Scsi_Host *instance)
>>  			hostdata->connected = NULL;
>>  			hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xff));
>>  			hostdata->state = S_UNCONNECTED;
>> -			DB(DB_INTR, printk(":%d", cmd->SCp.Status))
>> -			    if (cmd->cmnd[0] == REQUEST_SENSE
>> -				&& cmd->SCp.Status != GOOD)
>> -				cmd->result =
>> -				    (cmd->
>> -				     result & 0x00ffff) | (DID_ERROR << 16);
>> +			DB(DB_INTR, printk(":%d", cmd->SCp.Status));
>> +			if (cmd->cmnd[0] == REQUEST_SENSE
>> +			    && cmd->SCp.Status != SAM_STAT_GOOD)
>> +				set_host_byte(cmd->result, DID_ERROR);
> 
> Same.
> 
Cheers,

Hannes
diff mbox series

Patch

diff --git a/drivers/scsi/wd33c93.c b/drivers/scsi/wd33c93.c
index f81046f0e68a..98e04a7b9d63 100644
--- a/drivers/scsi/wd33c93.c
+++ b/drivers/scsi/wd33c93.c
@@ -1176,10 +1176,8 @@  wd33c93_intr(struct Scsi_Host *instance)
 			if (cmd->SCp.Status == ILLEGAL_STATUS_BYTE)
 				cmd->SCp.Status = lun;
 			if (cmd->cmnd[0] == REQUEST_SENSE
-			    && cmd->SCp.Status != GOOD)
-				cmd->result =
-				    (cmd->
-				     result & 0x00ffff) | (DID_ERROR << 16);
+			    && cmd->SCp.Status != SAM_STAT_GOOD)
+				set_host_byte(cmd, DID_ERROR);
 			else
 				cmd->result =
 				    cmd->SCp.Status | (cmd->SCp.Message << 8);
@@ -1262,9 +1260,8 @@  wd33c93_intr(struct Scsi_Host *instance)
 		    hostdata->connected = NULL;
 		hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xff));
 		hostdata->state = S_UNCONNECTED;
-		if (cmd->cmnd[0] == REQUEST_SENSE && cmd->SCp.Status != GOOD)
-			cmd->result =
-			    (cmd->result & 0x00ffff) | (DID_ERROR << 16);
+		if (cmd->cmnd[0] == REQUEST_SENSE && cmd->SCp.Status != SAM_STAT_GOOD)
+			set_host_byte(cmd, DID_ERROR);
 		else
 			cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8);
 		cmd->scsi_done(cmd);
@@ -1294,12 +1291,10 @@  wd33c93_intr(struct Scsi_Host *instance)
 			hostdata->connected = NULL;
 			hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xff));
 			hostdata->state = S_UNCONNECTED;
-			DB(DB_INTR, printk(":%d", cmd->SCp.Status))
-			    if (cmd->cmnd[0] == REQUEST_SENSE
-				&& cmd->SCp.Status != GOOD)
-				cmd->result =
-				    (cmd->
-				     result & 0x00ffff) | (DID_ERROR << 16);
+			DB(DB_INTR, printk(":%d", cmd->SCp.Status));
+			if (cmd->cmnd[0] == REQUEST_SENSE
+			    && cmd->SCp.Status != SAM_STAT_GOOD)
+				set_host_byte(cmd->result, DID_ERROR);
 			else
 				cmd->result =
 				    cmd->SCp.Status | (cmd->SCp.Message << 8);