The hwmon sysfs-attr should show up under the hwmon-classdev, not under the tpacpi_sensors_pdev. Pass the tpacpi_hwmon_groups attr-groups array to hwmon_device_register_with_groups() instead of setting tpacpi_hwmon_pdriver.driver.dev_groups to it to fix this. This also requires moving the hwmon_device_register_with_groups() call to after the subdriver init functions have run so that the is_visible() calls will work properly. Fixes: 79f960e29cfc ("platform/x86: thinkpad_acpi: Convert platform driver to use dev_groups") Cc: Len Baker <len.baker@xxxxxxx> Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx> --- drivers/platform/x86/thinkpad_acpi.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 7680bb0ee2d5..2f290ed59d92 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -10537,7 +10537,6 @@ static struct platform_driver tpacpi_hwmon_pdriver = { .driver = { .name = TPACPI_HWMON_DRVR_NAME, .groups = tpacpi_hwmon_driver_groups, - .dev_groups = tpacpi_hwmon_groups, }, }; @@ -11186,6 +11185,8 @@ static void thinkpad_acpi_module_exit(void) tpacpi_lifecycle = TPACPI_LIFE_EXITING; + if (tpacpi_hwmon) + hwmon_device_unregister(tpacpi_hwmon); if (tp_features.sensors_pdrv_registered) platform_driver_unregister(&tpacpi_hwmon_pdriver); if (tp_features.platform_drv_registered) @@ -11207,8 +11208,6 @@ static void thinkpad_acpi_module_exit(void) kfree(hotkey_keycode_map); } - if (tpacpi_hwmon) - hwmon_device_unregister(tpacpi_hwmon); if (tpacpi_sensors_pdev) platform_device_unregister(tpacpi_sensors_pdev); if (tpacpi_pdev) @@ -11287,16 +11286,7 @@ static int __init thinkpad_acpi_module_init(void) return ret; } tp_features.sensors_pdev_attrs_registered = 1; - tpacpi_hwmon = hwmon_device_register_with_groups( - &tpacpi_sensors_pdev->dev, TPACPI_NAME, NULL, NULL); - if (IS_ERR(tpacpi_hwmon)) { - ret = PTR_ERR(tpacpi_hwmon); - tpacpi_hwmon = NULL; - pr_err("unable to register hwmon device\n"); - thinkpad_acpi_module_exit(); - return ret; - } mutex_init(&tpacpi_inputdev_send_mutex); tpacpi_inputdev = input_allocate_device(); if (!tpacpi_inputdev) { @@ -11345,6 +11335,16 @@ static int __init thinkpad_acpi_module_init(void) } tp_features.sensors_pdrv_registered = 1; + tpacpi_hwmon = hwmon_device_register_with_groups( + &tpacpi_sensors_pdev->dev, TPACPI_NAME, NULL, tpacpi_hwmon_groups); + if (IS_ERR(tpacpi_hwmon)) { + ret = PTR_ERR(tpacpi_hwmon); + tpacpi_hwmon = NULL; + pr_err("unable to register hwmon device\n"); + thinkpad_acpi_module_exit(); + return ret; + } + ret = input_register_device(tpacpi_inputdev); if (ret < 0) { pr_err("unable to register input device\n"); -- 2.33.1