[RFC PATCH] nvme-core: add helper to get nvme_ctrl from device

Chaitanya Kulkarni chaitanyak at nvidia.com
Wed May 17 00:55:46 PDT 2023


Hi Sagi,

On 5/17/23 00:12, Sagi Grimberg wrote:
>
>> Just like we have other helpers to_nvmet_port(), to_nvmet_ns(),
>> ana_groups_to_port() and to_nvmet_ns(), add a helper to get nvme_ctr
>> from struct device.
>
> I don't think this is very useful.

it's the same pattern we have used everywhere in the nvme code,
I did not invent anything new here ...

>> Note that this removes the bunch of nvme_ctrl declaration code that is
>> needed to get the nvme_ctrl from struct device in the host/core.c.
>> Followwing is the diff :-
>
> It doesn't make it easier on my eyes...
>

I failed to understand how this is different from examples mentioned above
which are part of existing code reducing ~20 lines in current code and
future code for a variable declaration that is only accessed once ?

-ck

[1] diffstat:-

   drivers/nvme/host/core.c | 69 +++++++++++++++-------------------------
   1 file changed, 26 insertions(+), 43 deletions(-)




More information about the Linux-nvme mailing list