public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Bart Van Assche <bvanassche@acm.org>
Cc: Christoph Hellwig <hch@lst.de>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	linux-scsi@vger.kernel.org, target-devel@vger.kernel.org
Subject: Re: [PATCH 5/8] scsi: remove the sense and sense_len fields from struct scsi_request
Date: Thu, 24 Feb 2022 07:53:41 +0100	[thread overview]
Message-ID: <20220224065341.GB20737@lst.de> (raw)
In-Reply-To: <424d74d5-3150-78d7-20de-40d1a16a495d@acm.org>

On Wed, Feb 23, 2022 at 03:39:58PM -0800, Bart Van Assche wrote:
> On 2/22/22 06:04, Christoph Hellwig wrote:
>> @@ -613,10 +614,10 @@ static int sg_scsi_ioctl(struct request_queue *q, fmode_t mode,
>>     	err = req->result & 0xff;	/* only 8 bit SCSI status */
>>   	if (err) {
>> -		if (req->sense_len && req->sense) {
>> -			bytes = (OMAX_SB_LEN > req->sense_len) ?
>> -				req->sense_len : OMAX_SB_LEN;
>> -			if (copy_to_user(sic->data, req->sense, bytes))
>> +		if (scmd->sense_len && scmd->sense_buffer) {
>> +			bytes = (OMAX_SB_LEN > scmd->sense_len) ?
>> +				scmd->sense_len : OMAX_SB_LEN;
>> +			if (copy_to_user(sic->data, scmd->sense_buffer, bytes))
>>   				err = -EFAULT;
>>   		}
>>   	} else {
>
> This change would be a good opportunity to remove the two superfluous 
> parentheses from the above code.

Or switch to use the min or min_t macro, yes.

>
>> diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
>> index 3e432e25645ac..47add5b32f460 100644
>> --- a/include/scsi/scsi_cmnd.h
>> +++ b/include/scsi/scsi_cmnd.h
>> @@ -112,6 +112,7 @@ struct scsi_cmnd {
>>   				   reconnects.   Probably == sector
>>   				   size */
>>   +	unsigned sense_len;
>>   	unsigned char *sense_buffer;
>>   				/* obtained by REQUEST SENSE when
>>   				 * CHECK CONDITION is received on original
>
> Isn't "unsigned int" preferred over "unsigned" in new code?

checkpatch states that, but for absolutely no reason.

  reply	other threads:[~2022-02-24  6:53 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-22 14:04 remove struct scsi_request Christoph Hellwig
2022-02-22 14:04 ` [PATCH 1/8] bsg: don't include scsi_request.h in bsg-lib.h Christoph Hellwig
2022-02-22 18:33   ` Bart Van Assche
2022-02-22 14:04 ` [PATCH 2/8] target/pscsi: remove struct pscsi_plugin_task Christoph Hellwig
2022-02-22 14:04 ` [PATCH 3/8] scsi: don't memset the entire scsi_cmnd in scsi_init_command Christoph Hellwig
2022-02-23 12:21   ` John Garry
2022-02-23 12:39     ` Christoph Hellwig
2022-02-23 12:56       ` John Garry
2022-02-23 12:58         ` Christoph Hellwig
2022-02-23 20:16           ` Bart Van Assche
2022-02-24  6:52             ` Christoph Hellwig
2022-02-23 23:03   ` Bart Van Assche
2022-02-24  8:28   ` John Garry
2022-02-24 16:27     ` Christoph Hellwig
2022-02-24 16:38       ` John Garry
2022-02-22 14:04 ` [PATCH 4/8] scsi: remove the cmd field from struct scsi_request Christoph Hellwig
2022-02-23  3:31   ` Martin K. Petersen
2022-02-23 23:36   ` Bart Van Assche
2022-02-22 14:04 ` [PATCH 5/8] scsi: remove the sense and sense_len fields " Christoph Hellwig
2022-02-23 23:39   ` Bart Van Assche
2022-02-24  6:53     ` Christoph Hellwig [this message]
2022-02-22 14:04 ` [PATCH 6/8] scsi: move the resid_len field from struct scsi_request to struct scsi_cmnd Christoph Hellwig
2022-02-23 23:41   ` Bart Van Assche
2022-02-22 14:04 ` [PATCH 7/8] scsi: move the result " Christoph Hellwig
2022-02-23 23:43   ` Bart Van Assche
2022-02-22 14:04 ` [PATCH 8/8] scsi: remove struct scsi_request Christoph Hellwig
2022-02-23 23:48   ` Bart Van Assche

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220224065341.GB20737@lst.de \
    --to=hch@lst.de \
    --cc=bvanassche@acm.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=target-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox