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

Chaitanya Kulkarni chaitanyak at nvidia.com
Mon Sep 27 12:19:01 PDT 2021


>>> 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.
> 

Agree, looks good.

Reviewed-by: Chaitanya Kulkarni <kch at nvidia.com>



More information about the Linux-nvme mailing list