diff options
author | Armin Wolf <W_Armin@gmx.de> | 2022-04-26 23:31:53 +0200 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2022-05-20 10:57:05 -0700 |
commit | f44aa665ee9647a204066b287c8fc8c604440425 (patch) | |
tree | 90732c82de6be06dd629d384a2972ebe0cb359ae | |
parent | 4fc1a51c8572179abb767f56cbfc433e00e310c1 (diff) |
hwmon: (dell-smm) Cleanup init code
The default values for i8k_fan_mult and i8k_fan_max
should be assigend only if the values specified as
module params or in DMI are invalid/missing.
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20220426213154.724708-3-W_Armin@gmx.de
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r-- | drivers/hwmon/dell-smm-hwmon.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c index 202ee884de9e..f13902414615 100644 --- a/drivers/hwmon/dell-smm-hwmon.c +++ b/drivers/hwmon/dell-smm-hwmon.c @@ -1373,8 +1373,6 @@ static int __init dell_smm_probe(struct platform_device *pdev) return -ENOMEM; mutex_init(&data->i8k_mutex); - data->i8k_fan_mult = I8K_FAN_MULT; - data->i8k_fan_max = I8K_FAN_HIGH; platform_set_drvdata(pdev, data); if (dmi_check_system(i8k_blacklist_fan_support_dmi_table)) { @@ -1409,7 +1407,9 @@ static int __init dell_smm_probe(struct platform_device *pdev) fan_max = conf->fan_max; } - data->i8k_fan_max = fan_max ? : I8K_FAN_HIGH; /* Must not be 0 */ + /* All options must not be 0 */ + data->i8k_fan_mult = fan_mult ? : I8K_FAN_MULT; + data->i8k_fan_max = fan_max ? : I8K_FAN_HIGH; data->i8k_pwm_mult = DIV_ROUND_UP(255, data->i8k_fan_max); fan_control = dmi_first_match(i8k_whitelist_fan_control); @@ -1421,9 +1421,6 @@ static int __init dell_smm_probe(struct platform_device *pdev) dev_info(&pdev->dev, "enabling support for setting automatic/manual fan control\n"); } - if (fan_mult) - data->i8k_fan_mult = fan_mult; - ret = dell_smm_init_hwmon(&pdev->dev); if (ret) return ret; |