• Hans de Goede's avatar
    platform/x86: thinkpad_acpi: Register tpacpi_pdriver after subdriver init · 2f5ad08f
    Hans de Goede authored
    Commit 79f960e2 ("platform/x86: thinkpad_acpi: Convert platform driver
    to use dev_groups") introduces the use of driver.dev_groups +
    attribute_group.is_visible callbacks replacing the conditional calling of
    driver_create_file() for optional attributes.
    
    The is_visible callbacks rely on various tp_features.has_foo flags,
    which get set by the subdriver init functions.
    
    But before this fix, thinkpad_acpi_module_init() would call the
    subdriver init functions after registering the platform_device and
    the tpacpi_pdriver. Which would cause the is_visible callbacks to
    get called before the subdriver init functions, which in turn would
    cause optional attributes to not get registered at all, even when
    the feature is actually present.
    
    Fix this by moving the platform_driver_register(&tpacpi_pdriver) to after
    the subdriver init calls; and do the same for the tpacpi_hmon_pdriver.
    
    Fixes: 79f960e2 ("platform/x86: thinkpad_acpi: Convert platform driver to use dev_groups")
    Cc: Len Baker <len.baker@gmx.com>
    Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    Link: https://lore.kernel.org/r/20211123210424.266607-3-hdegoede@redhat.com
    2f5ad08f
thinkpad_acpi.c 285 KB