public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Christoph Hellwig <hch@lst.de>
Cc: "Martin K . Petersen" <martin.petersen@oracle.com>,
	linux-scsi@vger.kernel.org, Hannes Reinecke <hare@suse.com>,
	John Garry <john.garry@huawei.com>,
	Artur Paszkiewicz <artur.paszkiewicz@intel.com>,
	Jack Wang <jinpu.wang@cloud.ionos.com>,
	Jason Yan <yanaijie@huawei.com>
Subject: Re: [PATCH 1/3] libsas: Introduce more SAM status code aliases in enum exec_status
Date: Mon, 17 May 2021 08:45:21 -0700	[thread overview]
Message-ID: <10ff7ccc-fb76-d5a7-708e-6bfa0f2d4ace@acm.org> (raw)
In-Reply-To: <20210515064407.GB26545@lst.de>

On 5/14/21 11:44 PM, Christoph Hellwig wrote:
>> index 9271d7a49b90..9b17f7c8c314 100644
>> --- a/include/scsi/libsas.h
>> +++ b/include/scsi/libsas.h
>> @@ -477,6 +477,9 @@ enum exec_status {
>>  	/* The SAM_STAT_.. codes fit in the lower 6 bits, alias some of
>>  	 * them here to silence 'case value not in enumerated type' warnings
>>  	 */
>> +	__SAM_STAT_GOOD = SAM_STAT_GOOD,
>> +	__SAM_STAT_BUSY = SAM_STAT_BUSY,
>> +	__SAM_STAT_TASK_ABORTED = SAM_STAT_TASK_ABORTED,
>>  	__SAM_STAT_CHECK_CONDITION = SAM_STAT_CHECK_CONDITION,
> 
> I don't think the (existing) naming and comment are very helpful here.
> 
> I'd so a s/__SAM_/SAS_SAM_/

Hi Christoph,

How about changing __SAM_STAT_ into SAS_STAT_ to keep the prefix short?

> and replace the comment with something like:
> 
> 	/*
> 	 * The first 6 bytes are used to return the SAM_STAT_* codes.  To avoid
> 	 * 'case value not in enumerated type' compiler warnings every value
> 	 * returned through the exec_status enum will need an alias with
> 	 * the SAS_ prefix here.
> 	 */
> 	SAS_SAM_STAT_GOOD = SAM_STAT_GOOD,
> 	SAS_SAM_STAT_BUSY = SAM_STAT_BUSY,
> 	...

There is another issue with that comment: 7 bits are required to
represent status code 40h - TASK ABORTED. Anyway, thanks for having
taken a look. I will update the comment.

Bart.




  reply	other threads:[~2021-05-17 15:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-14 23:23 [PATCH 0/3] Introduce enums for SCSI status codes Bart Van Assche
2021-05-14 23:23 ` [PATCH 1/3] libsas: Introduce more SAM status code aliases in enum exec_status Bart Van Assche
2021-05-15  6:44   ` Christoph Hellwig
2021-05-17 15:45     ` Bart Van Assche [this message]
2021-05-14 23:23 ` [PATCH 2/3] Introduce enums for the SAM, message, host and driver status codes Bart Van Assche
2021-05-17 10:38   ` John Garry
2021-05-17 15:12     ` Bart Van Assche
2021-05-14 23:23 ` [PATCH 3/3] Change the type of the second argument of scsi_host_complete_all_commands() 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=10ff7ccc-fb76-d5a7-708e-6bfa0f2d4ace@acm.org \
    --to=bvanassche@acm.org \
    --cc=artur.paszkiewicz@intel.com \
    --cc=hare@suse.com \
    --cc=hch@lst.de \
    --cc=jinpu.wang@cloud.ionos.com \
    --cc=john.garry@huawei.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=yanaijie@huawei.com \
    /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