[PATCH] nvme: use kobj_to_dev() to get device

Jens Axboe axboe at fb.com
Fri Sep 4 11:17:29 EDT 2020


On 9/4/20 9:01 AM, Xianting Tian wrote:
> We already has the interface kobj_to_dev(), which can be used to get
> 'struct device *' from kobj, so use it.

Let's please not, this is immediately obvious what it does:

struct device *dev = container_of(kobj, struct device, kobj);

while this one is totally not:

struct device *dev = kobj_to_dev(kobj);

Any sort of privte whatever_to_foo() should be removed from the tree,
imho.

-- 
Jens Axboe




More information about the Linux-nvme mailing list