Skip to content

Commit 4c84515

Browse files
committed
Merge branches 'pm-cpuidle' and 'acpi-pm'
* pm-cpuidle: cpuidle: Drop unnecessary type cast in cpuidle_poll_time() cpuidle: Fix cpuidle_driver_state_disabled() cpuidle: use first valid target residency as poll time * acpi-pm: ACPI: PM: Avoid attaching ACPI PM domain to certain devices
3 parents e8ad8d5 + d4d8140 + b9ea0ba commit 4c84515

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

drivers/acpi/device_pm.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1314,9 +1314,19 @@ static void acpi_dev_pm_detach(struct device *dev, bool power_off)
13141314
*/
13151315
int acpi_dev_pm_attach(struct device *dev, bool power_on)
13161316
{
1317+
/*
1318+
* Skip devices whose ACPI companions match the device IDs below,
1319+
* because they require special power management handling incompatible
1320+
* with the generic ACPI PM domain.
1321+
*/
1322+
static const struct acpi_device_id special_pm_ids[] = {
1323+
{"PNP0C0B", }, /* Generic ACPI fan */
1324+
{"INT3404", }, /* Fan */
1325+
{}
1326+
};
13171327
struct acpi_device *adev = ACPI_COMPANION(dev);
13181328

1319-
if (!adev)
1329+
if (!adev || !acpi_match_device_ids(adev, special_pm_ids))
13201330
return 0;
13211331

13221332
/*

drivers/cpuidle/cpuidle.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,8 @@ u64 cpuidle_poll_time(struct cpuidle_driver *drv,
381381
if (dev->states_usage[i].disable)
382382
continue;
383383

384-
limit_ns = (u64)drv->states[i].target_residency_ns;
384+
limit_ns = drv->states[i].target_residency_ns;
385+
break;
385386
}
386387

387388
dev->poll_limit_ns = limit_ns;

drivers/cpuidle/driver.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,13 @@ void cpuidle_driver_state_disabled(struct cpuidle_driver *drv, int idx,
403403

404404
mutex_lock(&cpuidle_lock);
405405

406+
spin_lock(&cpuidle_driver_lock);
407+
408+
if (!drv->cpumask) {
409+
drv->states[idx].flags |= CPUIDLE_FLAG_UNUSABLE;
410+
goto unlock;
411+
}
412+
406413
for_each_cpu(cpu, drv->cpumask) {
407414
struct cpuidle_device *dev = per_cpu(cpuidle_devices, cpu);
408415

@@ -415,5 +422,8 @@ void cpuidle_driver_state_disabled(struct cpuidle_driver *drv, int idx,
415422
dev->states_usage[idx].disable &= ~CPUIDLE_STATE_DISABLED_BY_DRIVER;
416423
}
417424

425+
unlock:
426+
spin_unlock(&cpuidle_driver_lock);
427+
418428
mutex_unlock(&cpuidle_lock);
419429
}

0 commit comments

Comments
 (0)