Skip to contentSkip to conversation

hwmon: (acpi_power_meter) Stop setting acpi_device_name/class()

PATCH Applied Rafael J. Wysocki 3 participants 3 messages Jul 6

Subsystems (2)
lore
Share & tools
lore

Rafael J. Wysocki

author maintainer
#0 lore raw

PATCH 1/1 hwmon: (acpi_power_meter) Stop setting acpi_device_name/class()

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

The driver populates acpi_device_name() and acpi_device_class() that are never read afterward, so make it stop doing that and drop the symbols defined for this purpose.

Since ACPI_POWER_METER_CLASS is also used for generating ACPI netlink events, use the "pwr_meter_resource" string literal directly instead of it for that.

No intentional functional impact.

This will facilitate the removal of device_name and device_class from struct acpi_device_pnp in the future.

---
 drivers/hwmon/acpi_power_meter.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/hwmon/acpi_power_meter.c +1 -5
index 0c9b9f4180fb..8a539e8d1334 100644
@@ -21,8 +21,6 @@
 #include <linux/platform_device.h>
 
 #define ACPI_POWER_METER_NAME		"power_meter"
-#define ACPI_POWER_METER_DEVICE_NAME	"Power Meter"
-#define ACPI_POWER_METER_CLASS		"pwr_meter_resource"
 
 #define NUM_SENSORS			17
 
@@ -877,7 +875,7 @@ static void acpi_power_meter_notify(acpi_handle handle, u32 event, void *data)
 		break;
 	}
 
-	acpi_bus_generate_netlink_event(ACPI_POWER_METER_CLASS,
+	acpi_bus_generate_netlink_event("pwr_meter_resource",
 					dev_name(&resource->acpi_dev->dev),
 					event, 0);
 }
@@ -899,8 +897,6 @@ static int acpi_power_meter_probe(struct platform_device *pdev)
 	resource->sensors_valid = 0;
 	resource->acpi_dev = device;
 	mutex_init(&resource->lock);
-	strscpy(acpi_device_name(device), ACPI_POWER_METER_DEVICE_NAME);
-	strscpy(acpi_device_class(device), ACPI_POWER_METER_CLASS);
 
 	platform_set_drvdata(pdev, resource);
 
Signature · 1 line
2.51.0
#1 lore raw
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 10 lines

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

The driver populates acpi_device_name() and acpi_device_class() that are never read afterward, so make it stop doing that and drop the symbols defined for this purpose.

Since ACPI_POWER_METER_CLASS is also used for generating ACPI netlink events, use the "pwr_meter_resource" string literal directly instead of it for that.

Quoted 6 lines

No intentional functional impact.

This will facilitate the removal of device_name and device_class from struct acpi_device_pnp in the future.

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
maintainer Applied
#2 lore raw
In reply to Rafael J. Wysocki
Quoted 10 lines · Rafael J. Wysocki

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

The driver populates acpi_device_name() and acpi_device_class() that are never read afterward, so make it stop doing that and drop the symbols defined for this purpose.

Since ACPI_POWER_METER_CLASS is also used for generating ACPI netlink events, use the "pwr_meter_resource" string literal directly instead of it for that.

Quoted 6 lines

No intentional functional impact.

This will facilitate the removal of device_name and device_class from struct acpi_device_pnp in the future.

Applied.

Thanks,
Guenter