ACPI: PM / fan: Put fan device IDs into separate header file

The ACPI fan device IDs are shared between the fan driver and the
device power management code.  The former is modular, so it needs
to include the table of device IDs for module autoloading and the
latter needs that list to avoid attaching the generic ACPI PM domain
to fan devices (which doesn't make sense) possibly before the fan
driver module is loaded.

Unfortunately, that requires the list of fan device IDs to be
updated in two places which is prone to mistakes, so put it into
a symbol definition in a separate header file so there is only one
copy of it in case it needs to be updated again in the future.

Fixes: b9ea0bae26 ("ACPI: PM: Avoid attaching ACPI PM domain to certain devices")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Rafael J. Wysocki 2021-05-14 21:08:51 +02:00
parent f59a905b96
commit b9370dceab
3 changed files with 18 additions and 8 deletions

View File

@ -20,6 +20,7 @@
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/suspend.h> #include <linux/suspend.h>
#include "fan.h"
#include "internal.h" #include "internal.h"
/** /**
@ -1310,10 +1311,7 @@ int acpi_dev_pm_attach(struct device *dev, bool power_on)
* with the generic ACPI PM domain. * with the generic ACPI PM domain.
*/ */
static const struct acpi_device_id special_pm_ids[] = { static const struct acpi_device_id special_pm_ids[] = {
{"PNP0C0B", }, /* Generic ACPI fan */ ACPI_FAN_DEVICE_IDS,
{"INT3404", }, /* Fan */
{"INTC1044", }, /* Fan for Tiger Lake generation */
{"INTC1048", }, /* Fan for Alder Lake generation */
{} {}
}; };
struct acpi_device *adev = ACPI_COMPANION(dev); struct acpi_device *adev = ACPI_COMPANION(dev);

View File

@ -16,6 +16,8 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/sort.h> #include <linux/sort.h>
#include "fan.h"
MODULE_AUTHOR("Paul Diefenbaugh"); MODULE_AUTHOR("Paul Diefenbaugh");
MODULE_DESCRIPTION("ACPI Fan Driver"); MODULE_DESCRIPTION("ACPI Fan Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
@ -24,10 +26,7 @@ static int acpi_fan_probe(struct platform_device *pdev);
static int acpi_fan_remove(struct platform_device *pdev); static int acpi_fan_remove(struct platform_device *pdev);
static const struct acpi_device_id fan_device_ids[] = { static const struct acpi_device_id fan_device_ids[] = {
{"PNP0C0B", 0}, ACPI_FAN_DEVICE_IDS,
{"INT3404", 0},
{"INTC1044", 0},
{"INTC1048", 0},
{"", 0}, {"", 0},
}; };
MODULE_DEVICE_TABLE(acpi, fan_device_ids); MODULE_DEVICE_TABLE(acpi, fan_device_ids);

13
drivers/acpi/fan.h Normal file
View File

@ -0,0 +1,13 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* ACPI fan device IDs are shared between the fan driver and the device power
* management code.
*
* Add new device IDs before the generic ACPI fan one.
*/
#define ACPI_FAN_DEVICE_IDS \
{"INT3404", }, /* Fan */ \
{"INTC1044", }, /* Fan for Tiger Lake generation */ \
{"INTC1048", }, /* Fan for Alder Lake generation */ \
{"PNP0C0B", } /* Generic ACPI fan */