platform/x86: thinkpad_acpi: tpacpi_attr_group contains driver attributes not device...
authorHans de Goede <hdegoede@redhat.com>
Tue, 23 Nov 2021 21:04:21 +0000 (22:04 +0100)
committerHans de Goede <hdegoede@redhat.com>
Thu, 25 Nov 2021 15:22:50 +0000 (16:22 +0100)
Commit 79f960e29cfc ("platform/x86: thinkpad_acpi: Convert platform driver
to use dev_groups") put the debug_level, interface_version, version and the
THINKPAD_ACPI_DEBUGFACILITIES attributes in a new tpacpi_attr_group and
added those to the tpacpi_groups groups-array which is used to initialize
the driver.dev_groups member.

But before this commit these attributes were registered with
driver_create_file(), so they should be part of the groups-array which is
used to initialize the driver.groups member instead.

And also make the same change for the fan_watchdog hwmon driver attribute.

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-4-hdegoede@redhat.com
drivers/platform/x86/thinkpad_acpi.c

index 1aa292e..93c1c92 100644 (file)
@@ -8630,7 +8630,6 @@ static struct attribute *fan_attributes[] = {
        &dev_attr_pwm1.attr,
        &dev_attr_fan1_input.attr,
        &dev_attr_fan2_input.attr,
-       &driver_attr_fan_watchdog.attr,
        NULL
 };
 
@@ -8654,6 +8653,16 @@ static const struct attribute_group fan_attr_group = {
        .attrs = fan_attributes,
 };
 
+static struct attribute *fan_driver_attributes[] = {
+       &driver_attr_fan_watchdog.attr,
+       NULL
+};
+
+static const struct attribute_group fan_driver_attr_group = {
+       .is_visible = fan_attr_is_visible,
+       .attrs = fan_driver_attributes,
+};
+
 #define TPACPI_FAN_Q1  0x0001          /* Unitialized HFSP */
 #define TPACPI_FAN_2FAN        0x0002          /* EC 0x31 bit 0 selects fan2 */
 #define TPACPI_FAN_2CTL        0x0004          /* selects fan2 control */
@@ -10396,7 +10405,7 @@ static struct ibm_struct dprc_driver_data = {
 
 /* --------------------------------------------------------------------- */
 
-static struct attribute *tpacpi_attributes[] = {
+static struct attribute *tpacpi_driver_attributes[] = {
        &driver_attr_debug_level.attr,
        &driver_attr_version.attr,
        &driver_attr_interface_version.attr,
@@ -10431,11 +10440,16 @@ static umode_t tpacpi_attr_is_visible(struct kobject *kobj,
 }
 #endif
 
-static const struct attribute_group tpacpi_attr_group = {
+static const struct attribute_group tpacpi_driver_attr_group = {
 #ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES
        .is_visible = tpacpi_attr_is_visible,
 #endif
-       .attrs = tpacpi_attributes,
+       .attrs = tpacpi_driver_attributes,
+};
+
+static const struct attribute_group *tpacpi_driver_groups[] = {
+       &tpacpi_driver_attr_group,
+       NULL,
 };
 
 static const struct attribute_group *tpacpi_groups[] = {
@@ -10447,7 +10461,6 @@ static const struct attribute_group *tpacpi_groups[] = {
        &proxsensor_attr_group,
        &kbdlang_attr_group,
        &dprc_attr_group,
-       &tpacpi_attr_group,
        NULL,
 };
 
@@ -10458,6 +10471,11 @@ static const struct attribute_group *tpacpi_hwmon_groups[] = {
        NULL,
 };
 
+static const struct attribute_group *tpacpi_hwmon_driver_groups[] = {
+       &fan_driver_attr_group,
+       NULL,
+};
+
 /****************************************************************************
  ****************************************************************************
  *
@@ -10470,6 +10488,7 @@ static struct platform_driver tpacpi_pdriver = {
        .driver = {
                .name = TPACPI_DRVR_NAME,
                .pm = &tpacpi_pm,
+               .groups = tpacpi_driver_groups,
                .dev_groups = tpacpi_groups,
        },
        .shutdown = tpacpi_shutdown_handler,
@@ -10478,6 +10497,7 @@ static struct platform_driver tpacpi_pdriver = {
 static struct platform_driver tpacpi_hwmon_pdriver = {
        .driver = {
                .name = TPACPI_HWMON_DRVR_NAME,
+               .groups = tpacpi_hwmon_driver_groups,
                .dev_groups = tpacpi_hwmon_groups,
        },
 };