Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tokunori Ikegami <ikegami.t@gmail.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-nvme@lists.infradead.org
Subject: Re: [PATCH] nvme: use BIT_MASK and GENMASK for NVME definitions
Date: Thu, 14 Nov 2024 00:14:33 +0900	[thread overview]
Message-ID: <52a74c14-e95a-4065-9b38-8aae830ae239@gmail.com> (raw)
In-Reply-To: <ZzLZCzXfrLAP_RO8@infradead.org>

On 2024/11/12 13:26, Christoph Hellwig wrote:
>> -	NVME_CMBSZ_CQS		= 1 << 1,
>> -	NVME_CMBSZ_LISTS	= 1 << 2,
>> -	NVME_CMBSZ_RDS		= 1 << 3,
>> -	NVME_CMBSZ_WDS		= 1 << 4,
>> +	NVME_CMBSZ_SQS		= BIT_MASK(0),
>> +	NVME_CMBSZ_CQS		= BIT_MASK(1),
>> +	NVME_CMBSZ_LISTS	= BIT_MASK(2),
>> +	NVME_CMBSZ_RDS		= BIT_MASK(3),
>> +	NVME_CMBSZ_WDS		= BIT_MASK(4),
> Nothjing genmask here, and a lot less readable for no good reason at
> all.
Is it still no good to change BIT_MASK() to BIT()?
>>   	NVME_CMBSZ_SZ_SHIFT	= 12,
>> -	NVME_CMBSZ_SZ_MASK	= 0xfffff,
>> +	NVME_CMBSZ_SZ_MASK	= GENMASK(19, 0),
> This is using the GENMASK that you mentioned, and now I actually
> need to look up what GENMASK does to decipher the previously perfectly
> understandable code.
-       NVME_CMBSZ_SZ_SHIFT     = 12,
-       NVME_CMBSZ_SZ_MASK      = 0xfffff,
+       NVME_CMBSZ_SZ_MASK      = GENMASK(31, 12),
Is this also still not understandable?
> Could people please stop sending or suggesting cleanups that make
> the code much worse?

Sorry for bothering you. Also the changes were not considered enough but 
still seems better to use the existing bit operation macros instead of 
the current implementation. Also thinking to change to use FIELD_GET() 
and FIELD_PREP() macros. If possible to make sure let me reconfirm your 
opinion for above. Thank you.



  reply	other threads:[~2024-11-13 15:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-11 17:09 [PATCH] nvme: use BIT_MASK and GENMASK for NVME definitions Tokunori Ikegami
2024-11-12  4:26 ` Christoph Hellwig
2024-11-13 15:14   ` Tokunori Ikegami [this message]
2024-11-14  5:14     ` Christoph Hellwig
2024-11-14 14:43       ` Tokunori Ikegami
2024-11-14 15:31         ` Christoph Hellwig

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=52a74c14-e95a-4065-9b38-8aae830ae239@gmail.com \
    --to=ikegami.t@gmail.com \
    --cc=hch@infradead.org \
    --cc=linux-nvme@lists.infradead.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