All of lore.kernel.org
 help / color / mirror / Atom feed
From: Armin Wolf <W_Armin@gmx.de>
To: pali@kernel.org
Cc: jdelvare@suse.com, linux@roeck-us.net, hdegoede@redhat.com,
	markgross@kernel.org, ilpo.jarvinen@linux.intel.com,
	platform-driver-x86@vger.kernel.org, linux-hwmon@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v4 4/9] hwmon: (dell-smm) Move DMI config handling to module init
Date: Thu, 23 Nov 2023 01:48:15 +0100	[thread overview]
Message-ID: <20231123004820.50635-5-W_Armin@gmx.de> (raw)
In-Reply-To: <20231123004820.50635-1-W_Armin@gmx.de>

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>
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
 drivers/hwmon/dell-smm-hwmon.c | 31 +++++++++++++++----------------
 1 file 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;
--
2.39.2


  parent reply	other threads:[~2023-11-23  0:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-23  0:48 [PATCH v4 0/9] hwmon: (dell-smm) Add support for WMI SMM interface Armin Wolf
2023-11-23  0:48 ` [PATCH v4 1/9] hwmon: (dell-smm) Prepare for multiple SMM calling backends Armin Wolf
2023-11-23  0:48 ` [PATCH v4 2/9] hwmon: (dell-smm) Move blacklist handling to module init Armin Wolf
2023-11-23  0:48 ` [PATCH v4 3/9] hwmon: (dell-smm) Move whitelist " Armin Wolf
2023-11-23  0:48 ` Armin Wolf [this message]
2023-11-23  0:48 ` [PATCH v4 5/9] hwmon: (dell-smm) Move config entries out of i8k_dmi_table Armin Wolf
2023-11-23  0:48 ` [PATCH v4 6/9] hwmon: (dell-smm) Introduce helper function for data init Armin Wolf
2023-11-23  0:48 ` [PATCH v4 7/9] hwmon: (dell-smm) Add support for WMI SMM interface Armin Wolf
2023-11-23  0:48 ` [PATCH v4 8/9] hwmon: (dell-smm) Document the " Armin Wolf
2023-11-23  0:48 ` [PATCH v4 9/9] hwmon: (dell-smm) Add Optiplex 7000 to fan control whitelist Armin Wolf
2023-11-24 19:48 ` [PATCH v4 0/9] hwmon: (dell-smm) Add support for WMI SMM interface Pali Rohár
2023-12-01  4:17 ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231123004820.50635-5-W_Armin@gmx.de \
    --to=w_armin@gmx.de \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=markgross@kernel.org \
    --cc=pali@kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.