[PATCH] nvme: hwmon: Do not create min and max values when not supported.
Zephaniah E. Loss-Cutler-Hull
zephaniah at gmail.com
Mon Oct 4 21:53:06 PDT 2021
The Mushkin Enhanced Pilot-E 2TB (MKNSSDPE2TB-D8) provides a composite
temperature, as well as the over temperature threshold and under
temperature threshold settings for the composite temperature.
However for the 5 individual sensors, no over or under temperature
thresholds appear to be available, any attempt to access them results in
an error.
At the moment, that means that reading from or writing to the _min or
_max files in sys (as lmsensors does) results in an error.
That isn't horribly user friendly, and we can detect this situation at
initialization time.
So in nvme_hwmon_is_visible, for the hwmon_temp_max/hwmon_temp_min case,
we now attempt to actually get the threshold data, and if that fails we
return 0 to indicate that the data should not be made visible.
Signed-off-by: Zephaniah E. Loss-Cutler-Hull <zephaniah at gmail.com>
---
drivers/nvme/host/hwmon.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/nvme/host/hwmon.c b/drivers/nvme/host/hwmon.c
index 0a586d712920..063f8aaddcd5 100644
--- a/drivers/nvme/host/hwmon.c
+++ b/drivers/nvme/host/hwmon.c
@@ -164,6 +164,10 @@ static umode_t nvme_hwmon_is_visible(const void *_data,
case hwmon_temp_min:
if ((!channel && data->ctrl->wctemp) ||
(channel && data->log.temp_sensor[channel - 1])) {
+ long val;
+
+ if (nvme_get_temp_thresh(data->ctrl, channel, (attr == hwmon_temp_min), &val) < 0)
+ return 0;
if (data->ctrl->quirks &
NVME_QUIRK_NO_TEMP_THRESH_CHANGE)
return 0444;
--
2.33.0
More information about the Linux-nvme
mailing list