nvme-hwmon: rework to avoid devm allocation
authorHannes Reinecke <hare@suse.de>
Tue, 19 Jan 2021 06:43:18 +0000 (07:43 +0100)
committerChristoph Hellwig <hch@lst.de>
Wed, 10 Feb 2021 15:38:06 +0000 (16:38 +0100)
commited7770f6628691c13c9423bce7eee7cff2399c12
tree0e2c21bda36e81b9c7dbbb23b8522f9ed70c5916
parent295a39f5a56f3276bae6a0ae5c26ce06bb8aa21c
nvme-hwmon: rework to avoid devm allocation

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>
drivers/nvme/host/core.c
drivers/nvme/host/hwmon.c
drivers/nvme/host/nvme.h