Skip to contentSkip to conversation

ACPI: thermal: Do not attach private data to ACPI handles

PATCH In review Rafael J. Wysocki 2 participants 2 messages Aug 8, 2023 – Aug 9, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI: thermal: Do not attach private data to ACPI handles

From: Rafael J. Wysocki <[email protected]>

The ACPI thermal driver uses acpi_bus_attach_private_data() to attach the thermal zone object to the ACPI handle of the thermal zone and acpi_bus_detach_private_data() to clean that up, but it never uses acpi_bus_get_private_data() to retrieve that object.

Drop the unneded acpi_bus_attach_private_data() and acpi_bus_detach_private_data() calls from the ACPI thermal driver and clean up the related code.

No intentional functional impact.

---
 drivers/acpi/thermal.c |   13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/acpi/thermal.c +1 -12
Index: linux-pm/drivers/acpi/thermal.c
===================================================================
@@ -742,7 +742,6 @@ static int acpi_thermal_register_thermal
 {
 	int trips = 0;
 	int result;
-	acpi_status status;
 	int i;
 
 	if (tz->trips.critical.valid)
@@ -775,24 +774,15 @@ static int acpi_thermal_register_thermal
 	if (result)
 		goto unregister_tzd;
 
-	status =  acpi_bus_attach_private_data(tz->device->handle,
-					       tz->thermal_zone);
-	if (ACPI_FAILURE(status)) {
-		result = -ENODEV;
-		goto remove_links;
-	}
-
 	result = thermal_zone_device_enable(tz->thermal_zone);
 	if (result)
-		goto acpi_bus_detach;
+		goto remove_links;
 
 	dev_info(&tz->device->dev, "registered as thermal_zone%d\n",
 		 thermal_zone_device_id(tz->thermal_zone));
 
 	return 0;
 
-acpi_bus_detach:
-	acpi_bus_detach_private_data(tz->device->handle);
 remove_links:
 	acpi_thermal_zone_sysfs_remove(tz);
 unregister_tzd:
@@ -806,7 +796,6 @@ static void acpi_thermal_unregister_ther
 	acpi_thermal_zone_sysfs_remove(tz);
 	thermal_zone_device_unregister(tz->thermal_zone);
 	tz->thermal_zone = NULL;
-	acpi_bus_detach_private_data(tz->device->handle);
 }
 
 
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

The ACPI thermal driver uses acpi_bus_attach_private_data() to attach the thermal zone object to the ACPI handle of the thermal zone and acpi_bus_detach_private_data() to clean that up, but it never uses acpi_bus_get_private_data() to retrieve that object.

Quoted 7 lines

Drop the unneded acpi_bus_attach_private_data() and acpi_bus_detach_private_data() calls from the ACPI thermal driver and clean up the related code.

No intentional functional impact.

yeah, the attached private data is used by the intel_menlow driver, and it is not needed any more after intel_menlow driver removed.

I have exactly the same patch that I planned to send after the thermal trip point patches merged, so

thanks,
rui

Quoted 53 lines

---
 drivers/acpi/thermal.c |   13 +------------

 1 file changed, 1 insertion(+), 12 deletions(-)

Index: linux-pm/drivers/acpi/thermal.c
===================================================================

drivers/acpi/thermal.c +0 -1
@@ -742,7 +742,6 @@ static int acpi_thermal_register_thermal
  {
         int trips = 0;
         int result;
-       acpi_status status;
         int i;


        if (tz->trips.critical.valid)

drivers/acpi/thermal.c +0 -0
@@ -775,24 +774,15 @@ static int acpi_thermal_register_thermal
         if (result)
                 goto unregister_tzd;


-       status =  acpi_bus_attach_private_data(tz->device->handle, -                                              tz->thermal_zone); -       if (ACPI_FAILURE(status)) {
-               result = -ENODEV;
-               goto remove_links;
-       }
-
        result = thermal_zone_device_enable(tz->thermal_zone); if (result)
-               goto acpi_bus_detach;
+               goto remove_links;

        dev_info(&tz->device->dev, "registered as thermal_zone%d\n", thermal_zone_device_id(tz->thermal_zone));
        return 0;

-acpi_bus_detach:
-       acpi_bus_detach_private_data(tz->device->handle); remove_links:
        acpi_thermal_zone_sysfs_remove(tz); unregister_tzd:

drivers/acpi/thermal.c +0 -1
@@ -806,7 +796,6 @@ static void acpi_thermal_unregister_ther
         acpi_thermal_zone_sysfs_remove(tz);
         thermal_zone_device_unregister(tz->thermal_zone);
         tz->thermal_zone = NULL;
-       acpi_bus_detach_private_data(tz->device->handle);
  }