Re: [PATCH] hwmon: (dell-smm-hwmon) Fix index values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/13/21 9:48 AM, Pali Rohár wrote:
On Thursday 13 May 2021 17:45:46 W_Armin@xxxxxx wrote:
From: Armin Wolf <W_Armin@xxxxxx>

When support for up to 10 temp sensors and for disabling automatic BIOS
fan control was added, noone updated the index values used for
disallowing fan support and fan type calls.
Fix those values.

Do you mean this change, right?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1bb46a20e73b0bb3364cff3839c9f716ed327770

Yes, it looks like that it should have been part of that change.

Therefore I suggest to add Fixes tag:

Fixes: 1bb46a20e73b ("hwmon: (dell-smm) Support up to 10 temp sensors")

Otherwise looks good!

Reviewed-by: Pali Rohár <pali@xxxxxxxxxx>

For future development I would suggest to rewrite/drop these magic
numbers as same problem can be easily repeated in future.


The best solution would be to rewrite the driver to use
hwmon_device_register_with_info(), but that should be done
by someone with access to the hardware.

Guenter

Signed-off-by: Armin Wolf <W_Armin@xxxxxx>
---
Tested on a Dell Latitude C600.
---
  drivers/hwmon/dell-smm-hwmon.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c
index 2970892bed82..f2221ca0aa7b 100644
--- a/drivers/hwmon/dell-smm-hwmon.c
+++ b/drivers/hwmon/dell-smm-hwmon.c
@@ -838,10 +838,10 @@ static struct attribute *i8k_attrs[] = {
  static umode_t i8k_is_visible(struct kobject *kobj, struct attribute *attr,
  			      int index)
  {
-	if (disallow_fan_support && index >= 8)
+	if (disallow_fan_support && index >= 20)
  		return 0;
  	if (disallow_fan_type_call &&
-	    (index == 9 || index == 12 || index == 15))
+	    (index == 21 || index == 25 || index == 28))
  		return 0;
  	if (index >= 0 && index <= 1 &&
  	    !(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP1))
--
2.20.1





[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux