[PATCH 2/2] nvmet: use macro definitions for setting cmic value

Max Gurtovoy mgurtovoy at nvidia.com
Thu Sep 23 12:46:20 PDT 2021


On 9/23/2021 8:20 PM, Chaitanya Kulkarni wrote:
> On 9/23/21 3:17 AM, Max Gurtovoy wrote:
>> This makes the code more readable.
>>
>> Signed-off-by: Max Gurtovoy <mgurtovoy at nvidia.com>
>> ---
>>    drivers/nvme/target/admin-cmd.c | 3 ++-
>>    include/linux/nvme.h            | 1 +
>>    2 files changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
>> index 4ee9fe134697..92d81dc5906b 100644
>> --- a/drivers/nvme/target/admin-cmd.c
>> +++ b/drivers/nvme/target/admin-cmd.c
>> @@ -380,7 +380,8 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req)
>>    	 */
>>    
>>    	/* we support multiple ports, multiples hosts and ANA: */
>> -	id->cmic = (1 << 0) | (1 << 1) | (1 << 3);
>> +	id->cmic = NVME_CTRL_CMIC_MULTI_PORT | NVME_CTRL_CMIC_MULTI_CTRL |
>> +		NVME_CTRL_CMIC_ANA;
>>    
>>    	
> So we actually had this discussion before to keep it open coded.
>
> If I remember Keith had already sent out patch for this one...

I don't understand why our code should include constants and not macros.

And if so, let's do it for all macros we have for the spec. We need one 
policy.


>
>



More information about the Linux-nvme mailing list