From: xiaopeitux@foxmail.com
To: cryolitia@uniontech.com, linux@roeck-us.net,
linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Pei Xiao <xiaopei01@kylinos.cn>
Subject: [PATCH v3 2/4] hwmon: (gpd-fan): Initialize EC before registering hwmon device
Date: Mon, 8 Jun 2026 09:40:11 +0800 [thread overview]
Message-ID: <tencent_BEAA4E485EAFA713FF395F57AC083EEE3507@qq.com> (raw)
In-Reply-To: <cover.1780880972.git.xiaopei01@kylinos.cn>
From: Pei Xiao <xiaopei01@kylinos.cn>
Move the gpd_init_ec() call to before devm_hwmon_device_register_with_info
in the probe function. With the previous ordering the hwmon device was
registered and exposed to userspace before the EC initialization
completes, creating a window where sysfs reads could return invalid values.
Some buggy firmware won't initialize EC properly on boot. Before its
initialization, reading RPM will always return 0, and writing PWM will have
no effect. So move gpd_init_ec to before hwmon device register.
Fixes: 0ab88e239439 ("hwmon: add GPD devices sensor driver")
Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
---
changes in v3:
1.Add v3 tag
changes in v2:
1.gpd_init_ec needed before hwmon registration, as separate bug fix.
---
drivers/hwmon/gpd-fan.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/hwmon/gpd-fan.c b/drivers/hwmon/gpd-fan.c
index 7284babd4f5c..745b3fb9e3a4 100644
--- a/drivers/hwmon/gpd-fan.c
+++ b/drivers/hwmon/gpd-fan.c
@@ -643,6 +643,7 @@ static int gpd_fan_probe(struct platform_device *pdev)
dev_set_drvdata(dev, data);
+ gpd_init_ec(data);
hwdev = devm_hwmon_device_register_with_info(dev,
DRIVER_NAME,
data,
@@ -651,9 +652,6 @@ static int gpd_fan_probe(struct platform_device *pdev)
if (IS_ERR(hwdev))
return dev_err_probe(dev, PTR_ERR(hwdev),
"Failed to register hwmon device\n");
-
- gpd_init_ec(data);
-
return 0;
}
--
2.25.1
next prev parent reply other threads:[~2026-06-08 1:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1780880972.git.xiaopei01@kylinos.cn>
2026-06-08 1:40 ` [PATCH v3 1/4] hwmon: (gpd-fan): drop global driver data and use per-device allocation xiaopeitux
2026-06-09 13:04 ` Guenter Roeck
2026-06-10 1:30 ` Pei Xiao
2026-06-09 15:46 ` Cryolitia PukNgae
2026-06-10 1:36 ` Pei Xiao
2026-06-08 1:40 ` xiaopeitux [this message]
2026-06-08 1:40 ` [PATCH v3 3/4] hwmon: (gpd-fan): upgrade log level from warn to err for platform device creation failure xiaopeitux
2026-06-08 1:40 ` [PATCH v3 4/4] hwmon: (gpd-fan): fix race condition between device removal and sysfs access xiaopeitux
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=tencent_BEAA4E485EAFA713FF395F57AC083EEE3507@qq.com \
--to=xiaopeitux@foxmail.com \
--cc=cryolitia@uniontech.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=xiaopei01@kylinos.cn \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®