lightnvm: control life of nvm_dev in driver
authorMatias Bjørling <m@bjorling.me>
Fri, 16 Sep 2016 12:25:07 +0000 (14:25 +0200)
committerJens Axboe <axboe@fb.com>
Wed, 21 Sep 2016 13:56:18 +0000 (07:56 -0600)
commitb0b4e09c1ae71c4ec33df0616b830ae050006e9b
tree67a148740845d77af662b36ec17d88f991c84d72
parentb21d5b301794ae332eaa6e177d71fe8b77d3664c
lightnvm: control life of nvm_dev in driver

LightNVM compatible device drivers does not have a method to expose
LightNVM specific sysfs entries.

To enable LightNVM sysfs entries to be exposed, lightnvm device
drivers require a struct device to attach it to. To allow both the
actual device driver and lightnvm sysfs entries to coexist, the device
driver tracks the lifetime of the nvm_dev structure.

This patch refactors NVMe and null_blk to handle the lifetime of struct
nvm_dev, which eliminates the need for struct gendisk when a lightnvm
compatible device is provided.

Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/block/null_blk.c
drivers/lightnvm/core.c
drivers/nvme/host/core.c
drivers/nvme/host/lightnvm.c
drivers/nvme/host/nvme.h
include/linux/lightnvm.h