OSDN Git Service

platform/x86: thinkpad_acpi: Register tpacpi_pdriver after subdriver init
authorHans de Goede <hdegoede@redhat.com>
Tue, 23 Nov 2021 21:04:20 +0000 (22:04 +0100)
committerHans de Goede <hdegoede@redhat.com>
Thu, 25 Nov 2021 15:21:25 +0000 (16:21 +0100)
commit2f5ad08f3eec8d4376b62f3fe708102f6aaea056
treecaf68e511b1123e18657be6ac2c20d6c92b14483
parent910524004383863bb1d2888e510dd61fd00119d0
platform/x86: thinkpad_acpi: Register tpacpi_pdriver after subdriver init

Commit 79f960e29cfc ("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: 79f960e29cfc ("platform/x86: thinkpad_acpi: Convert platform driver to use dev_groups")
Cc: Len Baker <len.baker@gmx.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20211123210424.266607-3-hdegoede@redhat.com
drivers/platform/x86/thinkpad_acpi.c