nvme-hwmon: rework to avoid devm allocation
authorHannes Reinecke <hare@suse.de>
Tue, 19 Jan 2021 06:43:18 +0000 (07:43 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 30 Oct 2022 08:41:17 +0000 (09:41 +0100)
commitbc17f727b005921fc3b8651daefa053200c57cf0
tree0aff2c8e107b0f3da5baba3895ec0ac2306d8744
parent191d71c6357ef6e64b07e37b1e28c44480526d5a
nvme-hwmon: rework to avoid devm allocation

[ Upstream commit ed7770f6628691c13c9423bce7eee7cff2399c12 ]

The original design to use device-managed resource allocation
doesn't really work as the NVMe controller has a vastly different
lifetime than the hwmon sysfs attributes, causing warning about
duplicate sysfs entries upon reconnection.
This patch reworks the hwmon allocation to avoid device-managed
resource allocation, and uses the NVMe controller as parent for
the sysfs attributes.

Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Tested-by: Enzo Matsumiya <ematsumiya@suse.de>
Tested-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Stable-dep-of: c94b7f9bab22 ("nvme-hwmon: kmalloc the NVME SMART log buffer")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/host/core.c
drivers/nvme/host/hwmon.c
drivers/nvme/host/nvme.h