diff mbox series

[4/7] hwmon: (dell-smm) Improve temperature sensors detection

Message ID 20220215191113.16640-5-W_Armin@gmx.de (mailing list archive)
State Accepted
Headers show
Series hwmon: (dell-smm) Miscellaneous improvements | expand

Commit Message

Armin Wolf Feb. 15, 2022, 7:11 p.m. UTC
On the Dell Inspiron 3505, three temperature sensors are
available through the SMM interface. However since they
do not have an associated type, they are not detected.
Probe for those sensors in case no type was detected.
_i8k_get_temp() is used instead of i8k_get_temp()
since it is sometimes faster and the result is
easier to check (no -ENODATA) since we do not
care about the actual temp value.

Tested on a Dell Inspiron 3505.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
 drivers/hwmon/dell-smm-hwmon.c | 5 +++++
 1 file changed, 5 insertions(+)

--
2.30.2

Comments

Guenter Roeck Feb. 19, 2022, 2:51 p.m. UTC | #1
On Tue, Feb 15, 2022 at 08:11:10PM +0100, Armin Wolf wrote:
> On the Dell Inspiron 3505, three temperature sensors are
> available through the SMM interface. However since they
> do not have an associated type, they are not detected.
> Probe for those sensors in case no type was detected.
> _i8k_get_temp() is used instead of i8k_get_temp()
> since it is sometimes faster and the result is
> easier to check (no -ENODATA) since we do not
> care about the actual temp value.
> 
> Tested on a Dell Inspiron 3505.
> 
> Signed-off-by: Armin Wolf <W_Armin@gmx.de>

Applied to hwmon-next.

Thanks,
Guenter

> ---
>  drivers/hwmon/dell-smm-hwmon.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> --
> 2.30.2
> 
> diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c
> index a102034a1d38..b7016971bb2e 100644
> --- a/drivers/hwmon/dell-smm-hwmon.c
> +++ b/drivers/hwmon/dell-smm-hwmon.c
> @@ -655,6 +655,11 @@ static umode_t dell_smm_is_visible(const void *drvdata, enum hwmon_sensor_types
>  	case hwmon_temp:
>  		switch (attr) {
>  		case hwmon_temp_input:
> +			/* _i8k_get_temp() is fine since we do not care about the actual value */
> +			if (data->temp_type[channel] >= 0 || _i8k_get_temp(channel) >= 0)
> +				return 0444;
> +
> +			break;
>  		case hwmon_temp_label:
>  			if (data->temp_type[channel] >= 0)
>  				return 0444;
diff mbox series

Patch

diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c
index a102034a1d38..b7016971bb2e 100644
--- a/drivers/hwmon/dell-smm-hwmon.c
+++ b/drivers/hwmon/dell-smm-hwmon.c
@@ -655,6 +655,11 @@  static umode_t dell_smm_is_visible(const void *drvdata, enum hwmon_sensor_types
 	case hwmon_temp:
 		switch (attr) {
 		case hwmon_temp_input:
+			/* _i8k_get_temp() is fine since we do not care about the actual value */
+			if (data->temp_type[channel] >= 0 || _i8k_get_temp(channel) >= 0)
+				return 0444;
+
+			break;
 		case hwmon_temp_label:
 			if (data->temp_type[channel] >= 0)
 				return 0444;