summaryrefslogtreecommitdiff
path: root/drivers/hwmon/dell-smm-hwmon.c
diff options
context:
space:
mode:
authorArmin Wolf <W_Armin@gmx.de>2023-11-23 03:48:15 +0300
committerGuenter Roeck <linux@roeck-us.net>2023-12-11 17:21:01 +0300
commit2615f1ee7f67a7be0c565abc4b54eb226ad0d79f (patch)
tree4374d511349fb59f170168a1b49b0d7a03e4c987 /drivers/hwmon/dell-smm-hwmon.c
parent9848fcf431906ead348bc5f8ccaad8b20ee97d93 (diff)
downloadlinux-2615f1ee7f67a7be0c565abc4b54eb226ad0d79f.tar.xz
hwmon: (dell-smm) Move DMI config handling to module init
Future SMM calling backends will not be able to probe during module init, meaning the DMI tables holding config data would have to drop their __initconst attribute. Prevent this by moving the config handling to module init. Tested-by: <serverror@serverror.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Pali Rohár <pali@kernel.org> Signed-off-by: Armin Wolf <W_Armin@gmx.de> Link: https://lore.kernel.org/r/20231123004820.50635-5-W_Armin@gmx.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/dell-smm-hwmon.c')
-rw-r--r--drivers/hwmon/dell-smm-hwmon.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c
index 1cbdfd77773e..158b366b0329 100644
--- a/drivers/hwmon/dell-smm-hwmon.c
+++ b/drivers/hwmon/dell-smm-hwmon.c
@@ -1370,7 +1370,6 @@ static const struct dmi_system_id i8k_whitelist_fan_control[] __initconst = {
static int __init dell_smm_probe(struct platform_device *pdev)
{
struct dell_smm_data *data;
- const struct dmi_system_id *id;
int ret;
data = devm_kzalloc(&pdev->dev, sizeof(struct dell_smm_data), GFP_KERNEL);
@@ -1386,21 +1385,6 @@ static int __init dell_smm_probe(struct platform_device *pdev)
strscpy(data->bios_machineid, i8k_get_dmi_data(DMI_PRODUCT_SERIAL),
sizeof(data->bios_machineid));
- /*
- * Set fan multiplier and maximal fan speed from dmi config
- * Values specified in module parameters override values from dmi
- */
- id = dmi_first_match(i8k_dmi_table);
- if (id && id->driver_data) {
- const struct i8k_config_data *conf = id->driver_data;
-
- if (!fan_mult && conf->fan_mult)
- fan_mult = conf->fan_mult;
-
- if (!fan_max && conf->fan_max)
- fan_max = conf->fan_max;
- }
-
/* All options must not be 0 */
data->i8k_fan_mult = fan_mult ? : I8K_FAN_MULT;
data->i8k_fan_max = fan_max ? : I8K_FAN_HIGH;
@@ -1429,6 +1413,7 @@ static struct platform_device *dell_smm_device;
static void __init dell_smm_init_dmi(void)
{
struct i8k_fan_control_data *control;
+ struct i8k_config_data *config;
const struct dmi_system_id *id;
if (dmi_check_system(i8k_blacklist_fan_support_dmi_table)) {
@@ -1449,6 +1434,20 @@ static void __init dell_smm_init_dmi(void)
}
}
+ /*
+ * Set fan multiplier and maximal fan speed from DMI config.
+ * Values specified in module parameters override values from DMI.
+ */
+ id = dmi_first_match(i8k_dmi_table);
+ if (id && id->driver_data) {
+ config = id->driver_data;
+ if (!fan_mult && config->fan_mult)
+ fan_mult = config->fan_mult;
+
+ if (!fan_max && config->fan_max)
+ fan_max = config->fan_max;
+ }
+
id = dmi_first_match(i8k_whitelist_fan_control);
if (id && id->driver_data) {
control = id->driver_data;