Skip to content

Commit b9370dc

Browse files
committed
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: b9ea0ba ("ACPI: PM: Avoid attaching ACPI PM domain to certain devices") Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent f59a905 commit b9370dc

3 files changed

Lines changed: 18 additions & 8 deletions

File tree

drivers/acpi/device_pm.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <linux/pm_runtime.h>
2121
#include <linux/suspend.h>
2222

23+
#include "fan.h"
2324
#include "internal.h"
2425

2526
/**
@@ -1310,10 +1311,7 @@ int acpi_dev_pm_attach(struct device *dev, bool power_on)
13101311
* with the generic ACPI PM domain.
13111312
*/
13121313
static const struct acpi_device_id special_pm_ids[] = {
1313-
{"PNP0C0B", }, /* Generic ACPI fan */
1314-
{"INT3404", }, /* Fan */
1315-
{"INTC1044", }, /* Fan for Tiger Lake generation */
1316-
{"INTC1048", }, /* Fan for Alder Lake generation */
1314+
ACPI_FAN_DEVICE_IDS,
13171315
{}
13181316
};
13191317
struct acpi_device *adev = ACPI_COMPANION(dev);

drivers/acpi/fan.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#include <linux/platform_device.h>
1717
#include <linux/sort.h>
1818

19+
#include "fan.h"
20+
1921
MODULE_AUTHOR("Paul Diefenbaugh");
2022
MODULE_DESCRIPTION("ACPI Fan Driver");
2123
MODULE_LICENSE("GPL");
@@ -24,10 +26,7 @@ static int acpi_fan_probe(struct platform_device *pdev);
2426
static int acpi_fan_remove(struct platform_device *pdev);
2527

2628
static const struct acpi_device_id fan_device_ids[] = {
27-
{"PNP0C0B", 0},
28-
{"INT3404", 0},
29-
{"INTC1044", 0},
30-
{"INTC1048", 0},
29+
ACPI_FAN_DEVICE_IDS,
3130
{"", 0},
3231
};
3332
MODULE_DEVICE_TABLE(acpi, fan_device_ids);

drivers/acpi/fan.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
3+
/*
4+
* ACPI fan device IDs are shared between the fan driver and the device power
5+
* management code.
6+
*
7+
* Add new device IDs before the generic ACPI fan one.
8+
*/
9+
#define ACPI_FAN_DEVICE_IDS \
10+
{"INT3404", }, /* Fan */ \
11+
{"INTC1044", }, /* Fan for Tiger Lake generation */ \
12+
{"INTC1048", }, /* Fan for Alder Lake generation */ \
13+
{"PNP0C0B", } /* Generic ACPI fan */

0 commit comments

Comments
 (0)