Skip to content

Commit

Permalink
Merge branches 'pm-cpuidle' and 'acpi-pm'
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
rafaeljw committed Dec 13, 2019
3 parents e8ad8d5 + d4d8140 + b9ea0ba commit 4c84515
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
12 changes: 11 additions & 1 deletion drivers/acpi/device_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1314,9 +1314,19 @@ static void acpi_dev_pm_detach(struct device *dev, bool power_off)
*/
int acpi_dev_pm_attach(struct device *dev, bool power_on)
{
/*
* Skip devices whose ACPI companions match the device IDs below,
* because they require special power management handling incompatible
* with the generic ACPI PM domain.
*/
static const struct acpi_device_id special_pm_ids[] = {
{"PNP0C0B", }, /* Generic ACPI fan */
{"INT3404", }, /* Fan */
{}
};
struct acpi_device *adev = ACPI_COMPANION(dev);

if (!adev)
if (!adev || !acpi_match_device_ids(adev, special_pm_ids))
return 0;

/*
Expand Down
3 changes: 2 additions & 1 deletion drivers/cpuidle/cpuidle.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,8 @@ u64 cpuidle_poll_time(struct cpuidle_driver *drv,
if (dev->states_usage[i].disable)
continue;

limit_ns = (u64)drv->states[i].target_residency_ns;
limit_ns = drv->states[i].target_residency_ns;
break;
}

dev->poll_limit_ns = limit_ns;
Expand Down
10 changes: 10 additions & 0 deletions drivers/cpuidle/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,13 @@ void cpuidle_driver_state_disabled(struct cpuidle_driver *drv, int idx,

mutex_lock(&cpuidle_lock);

spin_lock(&cpuidle_driver_lock);

if (!drv->cpumask) {
drv->states[idx].flags |= CPUIDLE_FLAG_UNUSABLE;
goto unlock;
}

for_each_cpu(cpu, drv->cpumask) {
struct cpuidle_device *dev = per_cpu(cpuidle_devices, cpu);

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

unlock:
spin_unlock(&cpuidle_driver_lock);

mutex_unlock(&cpuidle_lock);
}

0 comments on commit 4c84515

Please sign in to comment.