ACPI updates for 6.15-rc1

- Use the str_on_off() helper function instead of hard-coded strings in
    the ACPI power resources handling code (Thorsten Blum).
 
  - Add fan speed reporting for ACPI fans that have _FST, but otherwise
    do not support the entire ACPI 4 fan interface (Joshua Grisham).
 
  - Fix a stale comment regarding trip points in acpi_thermal_add() that
    diverged from the commented code after removing _CRT evaluation from
    acpi_thermal_get_trip_points() (xueqin Luo).
 
  - Make ACPI button driver also subscribe to system events (Mario
    Limonciello).
 
  - Use the str_yes_no() helper function instead of hard-coded strings in
    the ACPI backlight (video) driver (Thorsten Blum).
 
  - Add a missing header file include to the x86 arch CPPC code (Mario
    Limonciello).
 
  - Rework the sysfs attributes implementation in the ACPI platform-profile
    driver and improve the unregistration code in it (Nathan Chancellor,
    Kurt Borja).
 
  - Prevent the ACPI HED driver from being built as a module and change
    its initcall level to subsys_initcall to avoid initialization ordering
    issues related to it (Xiaofei Tan).
 
  - Update a maintainer email address in the ACPI PMIC entry in
    MAINTAINERS (Mika Westerberg).
 
  - Address a GCC 15's -Wunterminated-string-initialization warning in
    the core PNP subsystem code and remove some dead code from it (Kees
    Cook, David Alan Gilbert).
 -----BEGIN PGP SIGNATURE-----
 
 iQFGBAABCAAwFiEEcM8Aw/RY0dgsiRUR7l+9nS/U47UFAmfhhZYSHHJqd0Byand5
 c29ja2kubmV0AAoJEO5fvZ0v1OO1yCMH/3IbFftpA2sJg504igRgLdMzDAhTc/Y3
 x8Y37v1e1Psxyp0SQni84H4E11QWaytSXngemnp39+LgN+14KW243z6v+PBGioyI
 +cdJw7kAk8v1aX+Ujel2Z3BIz9QPFqZd6d3R0AsZkZcI/28VW7kHNRXZ6p2kYmxK
 7acx0Y1cM1k0UotzpzQ4RDaTnFNKUGJFQwdKTEJU237gsFrVh8ev2hLm9Hy4FU6R
 zGtjrU2/oBEmoCVgrXG4n6bZYP4dZwCZ8ewckIvepGuTPTHP8tYMxrELw/3A1901
 +lnN6zK6nMpvCd9cl0ongT5iFG4gsuBGanvnP7Mf51YI380jmNSLeCI=
 =/b+r
 -----END PGP SIGNATURE-----

Merge tag 'acpi-6.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPI updates from Rafael Wysocki:
 "From the functional perspective, the most significant changes here are
  the ACPI fan driver update allowing it to handle fans with
  fine-grained state checking supported, but without fine-grained
  control, and the ACPI button driver update making it subscribe to
  system event notifications (in addition to device notifications) which
  on some systems is requisite for waking up the system from sleep.

  The rest is fixes and cleanups including removal of some dead code.

  Specifics:

   - Use the str_on_off() helper function instead of hard-coded strings
     in the ACPI power resources handling code (Thorsten Blum)

   - Add fan speed reporting for ACPI fans that have _FST, but otherwise
     do not support the entire ACPI 4 fan interface (Joshua Grisham)

   - Fix a stale comment regarding trip points in acpi_thermal_add()
     that diverged from the commented code after removing _CRT
     evaluation from acpi_thermal_get_trip_points() (xueqin Luo)

   - Make ACPI button driver also subscribe to system events (Mario
     Limonciello)

   - Use the str_yes_no() helper function instead of hard-coded strings
     in the ACPI backlight (video) driver (Thorsten Blum)

   - Add a missing header file include to the x86 arch CPPC code (Mario
     Limonciello)

   - Rework the sysfs attributes implementation in the ACPI
     platform-profile driver and improve the unregistration code in it
     (Nathan Chancellor, Kurt Borja)

   - Prevent the ACPI HED driver from being built as a module and change
     its initcall level to subsys_initcall to avoid initialization
     ordering issues related to it (Xiaofei Tan)

   - Update a maintainer email address in the ACPI PMIC entry in
     MAINTAINERS (Mika Westerberg)

   - Address a GCC 15's -Wunterminated-string-initialization warning in
     the core PNP subsystem code and remove some dead code from it (Kees
     Cook, David Alan Gilbert)"

* tag 'acpi-6.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  PNP: Expand length of fixup id string
  PNP: Remove prehistoric deadcode
  ACPI: button: Install notifier for system events as well
  ACPI: fan: Add fan speed reporting for fans with only _FST
  ACPI: HED: Always initialize before evged
  x86/ACPI: CPPC: Add missing include
  ACPI: video: Use str_yes_no() helper in acpi_video_bus_add()
  ACPI: platform_profile: Improve platform_profile_unregister()
  ACPI: platform-profile: Fix CFI violation when accessing sysfs files
  ACPI: power: Use str_on_off() helper function
  ACPI: thermal: Fix stale comment regarding trip points
  MAINTAINERS: Use my kernel.org address for ACPI PMIC work
This commit is contained in:
Linus Torvalds 2025-03-25 14:56:33 -07:00
commit 21e0ff5b10
19 changed files with 99 additions and 113 deletions

View File

@ -129,9 +129,6 @@ pnp_put_protocol
pnp_register_protocol
use this to register a new PnP protocol
pnp_unregister_protocol
use this function to remove a PnP protocol from the Plug and Play Layer
pnp_register_driver
adds a PnP driver to the Plug and Play Layer

View File

@ -356,7 +356,7 @@ ACPI PMIC DRIVERS
M: "Rafael J. Wysocki" <rafael@kernel.org>
M: Len Brown <lenb@kernel.org>
R: Andy Shevchenko <andy@kernel.org>
R: Mika Westerberg <mika.westerberg@linux.intel.com>
R: Mika Westerberg <westeri@kernel.org>
L: linux-acpi@vger.kernel.org
S: Supported
Q: https://patchwork.kernel.org/project/linux-acpi/list/

View File

@ -4,6 +4,8 @@
* Copyright (c) 2016, Intel Corporation.
*/
#include <linux/bitfield.h>
#include <acpi/cppc_acpi.h>
#include <asm/msr.h>
#include <asm/processor.h>

View File

@ -452,7 +452,7 @@ config ACPI_SBS
the modules will be called sbs and sbshc.
config ACPI_HED
tristate "Hardware Error Device"
bool "Hardware Error Device"
help
This driver supports the Hardware Error Device (PNP0C33),
which is used to report some hardware errors notified via

View File

@ -27,6 +27,7 @@
#include <linux/acpi.h>
#include <acpi/video.h>
#include <linux/uaccess.h>
#include <linux/string_choices.h>
#define ACPI_VIDEO_BUS_NAME "Video Bus"
#define ACPI_VIDEO_DEVICE_NAME "Video Device"
@ -2039,9 +2040,9 @@ static int acpi_video_bus_add(struct acpi_device *device)
pr_info("%s [%s] (multi-head: %s rom: %s post: %s)\n",
ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device),
video->flags.multihead ? "yes" : "no",
video->flags.rom ? "yes" : "no",
video->flags.post ? "yes" : "no");
str_yes_no(video->flags.multihead),
str_yes_no(video->flags.rom),
str_yes_no(video->flags.post));
mutex_lock(&video_list_lock);
list_add_tail(&video->entry, &video_bus_head);
mutex_unlock(&video_list_lock);

View File

@ -24,6 +24,7 @@
#define ACPI_BUTTON_CLASS "button"
#define ACPI_BUTTON_FILE_STATE "state"
#define ACPI_BUTTON_TYPE_UNKNOWN 0x00
#define ACPI_BUTTON_NOTIFY_WAKE 0x02
#define ACPI_BUTTON_NOTIFY_STATUS 0x80
#define ACPI_BUTTON_SUBCLASS_POWER "power"
@ -443,7 +444,12 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data)
struct input_dev *input;
int keycode;
if (event != ACPI_BUTTON_NOTIFY_STATUS) {
switch (event) {
case ACPI_BUTTON_NOTIFY_STATUS:
break;
case ACPI_BUTTON_NOTIFY_WAKE:
break;
default:
acpi_handle_debug(device->handle, "Unsupported event [0x%x]\n",
event);
return;
@ -629,7 +635,7 @@ static int acpi_button_add(struct acpi_device *device)
break;
default:
status = acpi_install_notify_handler(device->handle,
ACPI_DEVICE_NOTIFY, handler,
ACPI_ALL_NOTIFY, handler,
device);
break;
}

View File

@ -49,6 +49,7 @@ struct acpi_fan_fst {
struct acpi_fan {
bool acpi4;
bool has_fst;
struct acpi_fan_fif fif;
struct acpi_fan_fps *fps;
int fps_count;

View File

@ -75,15 +75,6 @@ int acpi_fan_create_attributes(struct acpi_device *device)
struct acpi_fan *fan = acpi_driver_data(device);
int i, status;
sysfs_attr_init(&fan->fine_grain_control.attr);
fan->fine_grain_control.show = show_fine_grain_control;
fan->fine_grain_control.store = NULL;
fan->fine_grain_control.attr.name = "fine_grain_control";
fan->fine_grain_control.attr.mode = 0444;
status = sysfs_create_file(&device->dev.kobj, &fan->fine_grain_control.attr);
if (status)
return status;
/* _FST is present if we are here */
sysfs_attr_init(&fan->fst_speed.attr);
fan->fst_speed.show = show_fan_speed;
@ -92,7 +83,19 @@ int acpi_fan_create_attributes(struct acpi_device *device)
fan->fst_speed.attr.mode = 0444;
status = sysfs_create_file(&device->dev.kobj, &fan->fst_speed.attr);
if (status)
goto rem_fine_grain_attr;
return status;
if (!fan->acpi4)
return 0;
sysfs_attr_init(&fan->fine_grain_control.attr);
fan->fine_grain_control.show = show_fine_grain_control;
fan->fine_grain_control.store = NULL;
fan->fine_grain_control.attr.name = "fine_grain_control";
fan->fine_grain_control.attr.mode = 0444;
status = sysfs_create_file(&device->dev.kobj, &fan->fine_grain_control.attr);
if (status)
goto rem_fst_attr;
for (i = 0; i < fan->fps_count; ++i) {
struct acpi_fan_fps *fps = &fan->fps[i];
@ -109,18 +112,18 @@ int acpi_fan_create_attributes(struct acpi_device *device)
for (j = 0; j < i; ++j)
sysfs_remove_file(&device->dev.kobj, &fan->fps[j].dev_attr.attr);
goto rem_fst_attr;
goto rem_fine_grain_attr;
}
}
return 0;
rem_fst_attr:
sysfs_remove_file(&device->dev.kobj, &fan->fst_speed.attr);
rem_fine_grain_attr:
sysfs_remove_file(&device->dev.kobj, &fan->fine_grain_control.attr);
rem_fst_attr:
sysfs_remove_file(&device->dev.kobj, &fan->fst_speed.attr);
return status;
}
@ -129,9 +132,13 @@ void acpi_fan_delete_attributes(struct acpi_device *device)
struct acpi_fan *fan = acpi_driver_data(device);
int i;
sysfs_remove_file(&device->dev.kobj, &fan->fst_speed.attr);
if (!fan->acpi4)
return;
for (i = 0; i < fan->fps_count; ++i)
sysfs_remove_file(&device->dev.kobj, &fan->fps[i].dev_attr.attr);
sysfs_remove_file(&device->dev.kobj, &fan->fst_speed.attr);
sysfs_remove_file(&device->dev.kobj, &fan->fine_grain_control.attr);
}

View File

@ -203,12 +203,16 @@ static const struct thermal_cooling_device_ops fan_cooling_ops = {
* --------------------------------------------------------------------------
*/
static bool acpi_fan_has_fst(struct acpi_device *device)
{
return acpi_has_method(device->handle, "_FST");
}
static bool acpi_fan_is_acpi4(struct acpi_device *device)
{
return acpi_has_method(device->handle, "_FIF") &&
acpi_has_method(device->handle, "_FPS") &&
acpi_has_method(device->handle, "_FSL") &&
acpi_has_method(device->handle, "_FST");
acpi_has_method(device->handle, "_FSL");
}
static int acpi_fan_get_fif(struct acpi_device *device)
@ -327,7 +331,12 @@ static int acpi_fan_probe(struct platform_device *pdev)
device->driver_data = fan;
platform_set_drvdata(pdev, fan);
if (acpi_fan_is_acpi4(device)) {
if (acpi_fan_has_fst(device)) {
fan->has_fst = true;
fan->acpi4 = acpi_fan_is_acpi4(device);
}
if (fan->acpi4) {
result = acpi_fan_get_fif(device);
if (result)
return result;
@ -335,7 +344,9 @@ static int acpi_fan_probe(struct platform_device *pdev)
result = acpi_fan_get_fps(device);
if (result)
return result;
}
if (fan->has_fst) {
result = devm_acpi_fan_create_hwmon(device);
if (result)
return result;
@ -343,9 +354,9 @@ static int acpi_fan_probe(struct platform_device *pdev)
result = acpi_fan_create_attributes(device);
if (result)
return result;
}
fan->acpi4 = true;
} else {
if (!fan->acpi4) {
result = acpi_device_update_power(device, NULL);
if (result) {
dev_err(&device->dev, "Failed to set initial power state\n");
@ -391,7 +402,7 @@ static int acpi_fan_probe(struct platform_device *pdev)
err_unregister:
thermal_cooling_device_unregister(cdev);
err_end:
if (fan->acpi4)
if (fan->has_fst)
acpi_fan_delete_attributes(device);
return result;
@ -401,7 +412,7 @@ static void acpi_fan_remove(struct platform_device *pdev)
{
struct acpi_fan *fan = platform_get_drvdata(pdev);
if (fan->acpi4) {
if (fan->has_fst) {
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
acpi_fan_delete_attributes(device);

View File

@ -43,6 +43,10 @@ static umode_t acpi_fan_hwmon_is_visible(const void *drvdata, enum hwmon_sensor_
case hwmon_fan_input:
return 0444;
case hwmon_fan_target:
/* Only acpi4 fans support fan control. */
if (!fan->acpi4)
return 0;
/*
* When in fine grain control mode, not every fan control value
* has an associated fan performance state.
@ -57,6 +61,10 @@ static umode_t acpi_fan_hwmon_is_visible(const void *drvdata, enum hwmon_sensor_
case hwmon_power:
switch (attr) {
case hwmon_power_input:
/* Only acpi4 fans support fan control. */
if (!fan->acpi4)
return 0;
/*
* When in fine grain control mode, not every fan control value
* has an associated fan performance state.

View File

@ -80,7 +80,12 @@ static struct acpi_driver acpi_hed_driver = {
.remove = acpi_hed_remove,
},
};
module_acpi_driver(acpi_hed_driver);
static int __init acpi_hed_driver_init(void)
{
return acpi_bus_register_driver(&acpi_hed_driver);
}
subsys_initcall(acpi_hed_driver_init);
MODULE_AUTHOR("Huang Ying");
MODULE_DESCRIPTION("ACPI Hardware Error Device Driver");

View File

@ -289,14 +289,14 @@ static int _remove_hidden_choices(struct device *dev, void *arg)
/**
* platform_profile_choices_show - Show the available profile choices for legacy sysfs interface
* @dev: The device
* @kobj: The kobject
* @attr: The attribute
* @buf: The buffer to write to
*
* Return: The number of bytes written
*/
static ssize_t platform_profile_choices_show(struct device *dev,
struct device_attribute *attr,
static ssize_t platform_profile_choices_show(struct kobject *kobj,
struct kobj_attribute *attr,
char *buf)
{
struct aggregate_choices_data data = {
@ -371,14 +371,14 @@ static int _store_and_notify(struct device *dev, void *data)
/**
* platform_profile_show - Show the current profile for legacy sysfs interface
* @dev: The device
* @kobj: The kobject
* @attr: The attribute
* @buf: The buffer to write to
*
* Return: The number of bytes written
*/
static ssize_t platform_profile_show(struct device *dev,
struct device_attribute *attr,
static ssize_t platform_profile_show(struct kobject *kobj,
struct kobj_attribute *attr,
char *buf)
{
enum platform_profile_option profile = PLATFORM_PROFILE_LAST;
@ -400,15 +400,15 @@ static ssize_t platform_profile_show(struct device *dev,
/**
* platform_profile_store - Set the profile for legacy sysfs interface
* @dev: The device
* @kobj: The kobject
* @attr: The attribute
* @buf: The buffer to read from
* @count: The number of bytes to read
*
* Return: The number of bytes read
*/
static ssize_t platform_profile_store(struct device *dev,
struct device_attribute *attr,
static ssize_t platform_profile_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t count)
{
struct aggregate_choices_data data = {
@ -442,12 +442,12 @@ static ssize_t platform_profile_store(struct device *dev,
return count;
}
static DEVICE_ATTR_RO(platform_profile_choices);
static DEVICE_ATTR_RW(platform_profile);
static struct kobj_attribute attr_platform_profile_choices = __ATTR_RO(platform_profile_choices);
static struct kobj_attribute attr_platform_profile = __ATTR_RW(platform_profile);
static struct attribute *platform_profile_attrs[] = {
&dev_attr_platform_profile_choices.attr,
&dev_attr_platform_profile.attr,
&attr_platform_profile_choices.attr,
&attr_platform_profile.attr,
NULL
};
@ -627,24 +627,23 @@ EXPORT_SYMBOL_GPL(platform_profile_register);
/**
* platform_profile_remove - Unregisters a platform profile class device
* @dev: Class device
*
* Return: 0
*/
int platform_profile_remove(struct device *dev)
void platform_profile_remove(struct device *dev)
{
struct platform_profile_handler *pprof = to_pprof_handler(dev);
int id;
struct platform_profile_handler *pprof;
if (IS_ERR_OR_NULL(dev))
return;
pprof = to_pprof_handler(dev);
guard(mutex)(&profile_lock);
id = pprof->minor;
ida_free(&platform_profile_ida, pprof->minor);
device_unregister(&pprof->dev);
ida_free(&platform_profile_ida, id);
sysfs_notify(acpi_kobj, NULL, "platform_profile");
sysfs_update_group(acpi_kobj, &platform_profile_group);
return 0;
}
EXPORT_SYMBOL_GPL(platform_profile_remove);

View File

@ -29,6 +29,7 @@
#include <linux/init.h>
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/string_choices.h>
#include <linux/pm_runtime.h>
#include <linux/sysfs.h>
#include <linux/acpi.h>
@ -197,7 +198,7 @@ static int __get_state(acpi_handle handle, u8 *state)
cur_state = sta & ACPI_POWER_RESOURCE_STATE_ON;
acpi_handle_debug(handle, "Power resource is %s\n",
cur_state ? "on" : "off");
str_on_off(cur_state));
*state = cur_state;
return 0;
@ -240,7 +241,7 @@ static int acpi_power_get_list_state(struct list_head *list, u8 *state)
break;
}
pr_debug("Power resource list is %s\n", cur_state ? "on" : "off");
pr_debug("Power resource list is %s\n", str_on_off(cur_state));
*state = cur_state;
return 0;

View File

@ -803,7 +803,7 @@ static int acpi_thermal_add(struct acpi_device *device)
acpi_thermal_aml_dependency_fix(tz);
/* Get trip points [_CRT, _PSV, etc.] (required). */
/* Get trip points [_ACi, _PSV, etc.] (required). */
acpi_thermal_get_trip_points(tz);
crit_temp = acpi_thermal_get_critical_trip(tz);

View File

@ -9,7 +9,6 @@ extern const struct attribute_group *pnp_dev_groups[];
extern const struct bus_type pnp_bus_type;
int pnp_register_protocol(struct pnp_protocol *protocol);
void pnp_unregister_protocol(struct pnp_protocol *protocol);
#define PNP_EISA_ID_MASK 0x7fffffff
void pnp_eisa_id_to_string(u32 id, char *str);
@ -21,9 +20,7 @@ int pnp_add_device(struct pnp_dev *dev);
struct pnp_id *pnp_add_id(struct pnp_dev *dev, const char *id);
int pnp_add_card(struct pnp_card *card);
void pnp_remove_card(struct pnp_card *card);
int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev);
void pnp_remove_card_device(struct pnp_dev *dev);
struct pnp_port {
resource_size_t min; /* min base number */
@ -138,7 +135,6 @@ void pnp_init_resources(struct pnp_dev *dev);
void pnp_fixup_device(struct pnp_dev *dev);
void pnp_free_options(struct pnp_dev *dev);
int __pnp_add_device(struct pnp_dev *dev);
void __pnp_remove_device(struct pnp_dev *dev);
int pnp_check_port(struct pnp_dev *dev, struct resource *res);
int pnp_check_mem(struct pnp_dev *dev, struct resource *res);

View File

@ -269,25 +269,6 @@ int pnp_add_card(struct pnp_card *card)
return 0;
}
/**
* pnp_remove_card - removes a PnP card from the PnP Layer
* @card: pointer to the card to remove
*/
void pnp_remove_card(struct pnp_card *card)
{
struct list_head *pos, *temp;
device_unregister(&card->dev);
mutex_lock(&pnp_lock);
list_del(&card->global_list);
list_del(&card->protocol_list);
mutex_unlock(&pnp_lock);
list_for_each_safe(pos, temp, &card->devices) {
struct pnp_dev *dev = card_to_pnp_dev(pos);
pnp_remove_card_device(dev);
}
}
/**
* pnp_add_card_device - adds a device to the specified card
* @card: pointer to the card to add to
@ -306,19 +287,6 @@ int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev)
return 0;
}
/**
* pnp_remove_card_device- removes a device from the specified card
* @dev: pointer to the device to remove
*/
void pnp_remove_card_device(struct pnp_dev *dev)
{
mutex_lock(&pnp_lock);
dev->card = NULL;
list_del(&dev->card_list);
mutex_unlock(&pnp_lock);
__pnp_remove_device(dev);
}
/**
* pnp_request_card_device - Searches for a PnP device under the specified card
* @clink: pointer to the card link, cannot be NULL

View File

@ -78,16 +78,6 @@ int pnp_register_protocol(struct pnp_protocol *protocol)
return ret;
}
/**
* pnp_unregister_protocol - removes a pnp protocol from the pnp layer
* @protocol: pointer to the corresponding pnp_protocol structure
*/
void pnp_unregister_protocol(struct pnp_protocol *protocol)
{
pnp_remove_protocol(protocol);
device_unregister(&protocol->dev);
}
static void pnp_free_ids(struct pnp_dev *dev)
{
struct pnp_id *id;
@ -220,12 +210,6 @@ int pnp_add_device(struct pnp_dev *dev)
return 0;
}
void __pnp_remove_device(struct pnp_dev *dev)
{
pnp_delist_device(dev);
device_unregister(&dev->dev);
}
static int __init pnp_init(void)
{
return bus_register(&pnp_bus_type);

View File

@ -50,7 +50,7 @@ struct platform_profile_ops {
struct device *platform_profile_register(struct device *dev, const char *name,
void *drvdata,
const struct platform_profile_ops *ops);
int platform_profile_remove(struct device *dev);
void platform_profile_remove(struct device *dev);
struct device *devm_platform_profile_register(struct device *dev, const char *name,
void *drvdata,
const struct platform_profile_ops *ops);

View File

@ -290,7 +290,7 @@ static inline void pnp_set_drvdata(struct pnp_dev *pdev, void *data)
}
struct pnp_fixup {
char id[7];
char id[8];
void (*quirk_function) (struct pnp_dev *dev); /* fixup function */
};