Re: [PATCH 07/42] scsi: Kill DRIVER_SENSE

Douglas Gilbert
2021-04-22T15:46:24Z

On 2021-04-22 2:31 a.m., Hannes Reinecke wrote:
> On 4/21/21 11:06 PM, Bart Van Assche wrote:
>> On 4/21/21 10:47 AM, Hannes Reinecke wrote:
>>> diff --git a/drivers/scsi/megaraid/megaraid_mbox.c
>>> b/drivers/scsi/megaraid/megaraid_mbox.c
>>> index 6a5b844a8499..2b6138a7c71f 100644
>>> --- a/drivers/scsi/megaraid/megaraid_mbox.c
>>> +++ b/drivers/scsi/megaraid/megaraid_mbox.c
>>> @@ -2299,8 +2299,7 @@ megaraid_mbox_dpc(unsigned long devp)
>>>                   memcpy(scp->sense_buffer, pthru->reqsensearea,
>>>                           14);
>>> -                scp->result = DRIVER_SENSE << 24 |
>>> -                    DID_OK << 16 | CHECK_CONDITION << 1;
>>> +                scp->result = DID_OK << 16 | SAM_STAT_CHECK_CONDITION;
>>>               }
>>>               else {
>>>                   if (mbox->cmd == MBOXCMD_EXTPTHRU) {
>>> @@ -2308,9 +2307,8 @@ megaraid_mbox_dpc(unsigned long devp)
>>>                       memcpy(scp->sense_buffer,
>>>                           epthru->reqsensearea, 14);
>>> -                    scp->result = DRIVER_SENSE << 24 |
>>> -                        DID_OK << 16 |
>>> -                        CHECK_CONDITION << 1;
>>> +                    scp->result = DID_OK << 16 |
>>> +                        SAM_STAT_CHECK_CONDITION;
>>>                   } else
>>>                       scsi_build_sense(scp, 0,
>>>                                ABORTED_COMMAND, 0, 0);
>>
>> Since DID_OK == 0 I prefer to leave out the 'DID_OK << 16' expressions from
>> code that is modified.
>>
> Okay, will do.
>

If DID_OK << 16 (and the extra bitwise OR) does not generate any code
then I think it is pretty good inline documentation to show LLDs how
to build the "compound" 32 bit integer in error situations.

If there is no runtime penalty, I would prefer to keep it :-)

Doug Gilbert