From: Rafael J. Wysocki Date: Fri, 13 Mar 2026 12:59:58 +0000 (+0100) Subject: ACPI: driver: Avoid using pnp.device_class for netlink handling X-Git-Tag: v7.1-rc1~215^2~1^2~2^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=76866c912ac8639965861c648fa234ab61c0e72d;p=thirdparty%2Fkernel%2Flinux.git ACPI: driver: Avoid using pnp.device_class for netlink handling Update several core ACPI device drivers that use acpi_bus_generate_netlink_event() for generating netlink messages to pass a string literal as its first argument instead of a pointer to pnp.device_class in a given struct acpi_device, which will allow them to avoid initializing the pnp.device_class field in the future. The ACPI button driver that uses different acpi_device_class() values for different button types will still pass it to acpi_bus_generate_netlink_event(), but update it to use the acpi_device_class() macro instead of open coding the pointer access path. No intentional functional impact. Signed-off-by: Rafael J. Wysocki Link: https://patch.msgid.link/7944022.EvYhyI6sBW@rafael.j.wysocki --- diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index 2b500e89169f4..41a085562c639 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c @@ -130,9 +130,9 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data) msleep(ac_sleep_before_get_state_ms); acpi_ac_get_state(ac); - acpi_bus_generate_netlink_event(adev->pnp.device_class, - dev_name(&adev->dev), event, - (u32) ac->state); + acpi_bus_generate_netlink_event(ACPI_AC_CLASS, + dev_name(&adev->dev), event, + ac->state); acpi_notifier_call_chain(ACPI_AC_CLASS, acpi_device_bid(adev), event, ac->state); power_supply_changed(ac->charger); diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c index 1f735f77fd1a4..b46c4dd65fbe1 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c @@ -413,8 +413,8 @@ static void acpi_pad_notify(acpi_handle handle, u32 event, void *data) switch (event) { case ACPI_PROCESSOR_AGGREGATOR_NOTIFY: acpi_pad_handle_notify(handle); - acpi_bus_generate_netlink_event(adev->pnp.device_class, - dev_name(&adev->dev), event, 0); + acpi_bus_generate_netlink_event(ACPI_PROCESSOR_AGGREGATOR_CLASS, + dev_name(&adev->dev), event, 0); break; default: pr_warn("Unsupported event [0x%x]\n", event); diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 1bfc4179e8859..54048438b5da7 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -1078,7 +1078,7 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data) if (event == ACPI_BATTERY_NOTIFY_INFO) acpi_battery_refresh(battery); acpi_battery_update(battery, false); - acpi_bus_generate_netlink_event(device->pnp.device_class, + acpi_bus_generate_netlink_event(ACPI_BATTERY_CLASS, dev_name(&device->dev), event, acpi_battery_present(battery)); acpi_notifier_call_chain(ACPI_BATTERY_CLASS, acpi_device_bid(device), diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index c57bd9c630571..cc17d9d843ec5 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c @@ -468,7 +468,7 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data) input_report_key(input, keycode, 0); input_sync(input); - acpi_bus_generate_netlink_event(device->pnp.device_class, + acpi_bus_generate_netlink_event(acpi_device_class(device), dev_name(&device->dev), event, ++button->pushed); } diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index 882709796b4f7..bbe2c5afb8baf 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c @@ -53,7 +53,7 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data) { struct acpi_device *device = data; struct acpi_processor *pr; - int saved; + int saved, ev_data = 0; if (device->handle != handle) return; @@ -66,33 +66,27 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data) case ACPI_PROCESSOR_NOTIFY_PERFORMANCE: saved = pr->performance_platform_limit; acpi_processor_ppc_has_changed(pr, 1); - if (saved == pr->performance_platform_limit) - break; - acpi_bus_generate_netlink_event(device->pnp.device_class, - dev_name(&device->dev), event, - pr->performance_platform_limit); + ev_data = pr->performance_platform_limit; + if (saved == ev_data) + return; + break; case ACPI_PROCESSOR_NOTIFY_POWER: acpi_processor_power_state_has_changed(pr); - acpi_bus_generate_netlink_event(device->pnp.device_class, - dev_name(&device->dev), event, 0); break; case ACPI_PROCESSOR_NOTIFY_THROTTLING: acpi_processor_tstate_has_changed(pr); - acpi_bus_generate_netlink_event(device->pnp.device_class, - dev_name(&device->dev), event, 0); break; case ACPI_PROCESSOR_NOTIFY_HIGEST_PERF_CHANGED: cpufreq_update_limits(pr->id); - acpi_bus_generate_netlink_event(device->pnp.device_class, - dev_name(&device->dev), event, 0); break; default: acpi_handle_debug(handle, "Unsupported event [0x%x]\n", event); - break; + return; } - return; + acpi_bus_generate_netlink_event(ACPI_PROCESSOR_CLASS, + dev_name(&device->dev), event, ev_data); } static int __acpi_processor_start(struct acpi_device *device); diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 6ccb364665d15..e764641a43c1a 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -340,7 +340,7 @@ static void acpi_thermal_trips_update(struct acpi_thermal *tz, u32 event) thermal_zone_for_each_trip(tz->thermal_zone, acpi_thermal_adjust_trip, &atd); acpi_queue_thermal_check(tz); - acpi_bus_generate_netlink_event(adev->pnp.device_class, + acpi_bus_generate_netlink_event(ACPI_THERMAL_CLASS, dev_name(&adev->dev), event, 0); } @@ -542,7 +542,7 @@ static void acpi_thermal_zone_device_hot(struct thermal_zone_device *thermal) { struct acpi_thermal *tz = thermal_zone_device_priv(thermal); - acpi_bus_generate_netlink_event(tz->device->pnp.device_class, + acpi_bus_generate_netlink_event(ACPI_THERMAL_CLASS, dev_name(&tz->device->dev), ACPI_THERMAL_NOTIFY_HOT, 1); } @@ -551,7 +551,7 @@ static void acpi_thermal_zone_device_critical(struct thermal_zone_device *therma { struct acpi_thermal *tz = thermal_zone_device_priv(thermal); - acpi_bus_generate_netlink_event(tz->device->pnp.device_class, + acpi_bus_generate_netlink_event(ACPI_THERMAL_CLASS, dev_name(&tz->device->dev), ACPI_THERMAL_NOTIFY_CRITICAL, 1);