Message ID | 1558454649-28783-5-git-send-email-akinobu.mita@gmail.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
Series | nvme: add thermal zone devices | expand |
Is there any good reason why we need to call this from the PCIe driver instead of handling it all in the core? Sure non-PCIe devices are usually external, but so are some PCIe devices, so if we really care about that we need some sort of flag anyway.
2019年5月23日(木) 2:46 Christoph Hellwig <hch@infradead.org>: > > Is there any good reason why we need to call this from the PCIe driver > instead of handling it all in the core? OK. I'll move the thermal zones registration and unregistration into the core module. Call nvme_thermal_zones_register() in nvme_init_identify(), and call nvme_thermal_zones_unregister() in nvme_stop_ctrl(). > Sure non-PCIe devices are usually external, but so are some PCIe > devices, so if we really care about that we need some sort of flag > anyway. I'm going to not use the flag in next version. If there is a demand, we'll have 'use_tz' or 'no_tz' flag in nvme_ctrl.
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 04084b9..108b022 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -2555,6 +2555,10 @@ static void nvme_reset_work(struct work_struct *work) dev->ctrl.opal_dev = NULL; } + result = nvme_thermal_zones_register(&dev->ctrl); + if (result < 0) + goto out; + if (dev->ctrl.oacs & NVME_CTRL_OACS_DBBUF_SUPP) { result = nvme_dbbuf_dma_alloc(dev); if (result) @@ -2833,6 +2837,7 @@ static void nvme_remove(struct pci_dev *pdev) flush_work(&dev->ctrl.reset_work); nvme_stop_ctrl(&dev->ctrl); nvme_remove_namespaces(&dev->ctrl); + nvme_thermal_zones_unregister(&dev->ctrl); nvme_dev_disable(dev, true, false); nvme_release_cmb(dev); nvme_free_host_mem(dev);
This enables to use thermal zone interfaces for NVMe temperature sensors. Cc: Zhang Rui <rui.zhang@intel.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: Daniel Lezcano <daniel.lezcano@linaro.org> Cc: Keith Busch <keith.busch@intel.com> Cc: Jens Axboe <axboe@fb.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Sagi Grimberg <sagi@grimberg.me> Cc: Minwoo Im <minwoo.im.dev@gmail.com> Cc: Kenneth Heitke <kenneth.heitke@intel.com> Cc: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> --- * v2 - Call nvme_thermal_zones_unregister() earlier than the last reference release drivers/nvme/host/pci.c | 5 +++++ 1 file changed, 5 insertions(+)