hwmon: (cros_ec) Register the thermal devices after the hwmon ones

To guarantee consistency for the read-modify-write access in
cros_ec_hwmon_cooling_set_cur_state(), locking is necessary.
The locking will use standard hwmon device locks, which requires
the hwmon device to be ready before the fan devices are set up.

Reorder the initialization so this works.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20260711-cros_ec-hwmon-locking-v1-1-cb6d0fdbb2d3@weissschuh.net
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
Thomas Weißschuh 2026-07-11 11:59:05 +02:00 committed by Guenter Roeck
parent 2ed6f97e56
commit 9f1012119f

View File

@ -578,13 +578,17 @@ static int cros_ec_hwmon_probe(struct platform_device *pdev)
priv->fan_control_supported = cros_ec_hwmon_probe_fan_control_supported(priv->cros_ec);
priv->temp_threshold_supported = is_cros_ec_cmd_available(priv->cros_ec,
EC_CMD_THERMAL_GET_THRESHOLD, 1);
cros_ec_hwmon_register_fan_cooling_devices(dev, priv);
hwmon_dev = devm_hwmon_device_register_with_info(dev, "cros_ec", priv,
&cros_ec_hwmon_chip_info, NULL);
if (IS_ERR(hwmon_dev))
return PTR_ERR(hwmon_dev);
cros_ec_hwmon_register_fan_cooling_devices(dev, priv);
platform_set_drvdata(pdev, priv);
return PTR_ERR_OR_ZERO(hwmon_dev);
return 0;
}
static int cros_ec_hwmon_suspend(struct platform_device *pdev, pm_message_t state)