From: Dmitry Baryshkov Date: Sat, 29 Jan 2022 18:07:50 +0000 (+0300) Subject: thermal/drivers/tsens: register thermal zones as hwmon sensors X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=8556e19d4939fbdb15aee9391f035453c5b2255a;p=linux.git thermal/drivers/tsens: register thermal zones as hwmon sensors Register thermal zones as hwmon sensors to let userspace read CPU temperatures using standard hwmon interface. Acked-by: Amit Kucheria Signed-off-by: Dmitry Baryshkov Link: https://lore.kernel.org/r/20220129180750.1882310-1-dmitry.baryshkov@linaro.org Signed-off-by: Daniel Lezcano --- diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index 99a8d9f3e03ca..154d3cb19c88d 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -18,6 +18,7 @@ #include #include #include +#include "../thermal_hwmon.h" #include "tsens.h" /** @@ -1060,6 +1061,10 @@ static int tsens_register(struct tsens_priv *priv) priv->sensor[i].tzd = tzd; if (priv->ops->enable) priv->ops->enable(priv, i); + + if (devm_thermal_add_hwmon_sysfs(tzd)) + dev_warn(priv->dev, + "Failed to add hwmon sysfs attributes\n"); } /* VER_0 require to set MIN and MAX THRESH