PM: Do not use the syscore flag for runtime PM

The syscore device PM flag used to mark the devices (belonging to
PM domains) that should never be turned off, except for the system
core (syscore) suspend/hibernation and resume stages, need not be
accessed by the runtime PM core functions, because all of the devices
it is set for need to be marked as "irq safe" anyway and are
protected from being turned off by runtime PM by ensuring that their
usage counters are always set.

For this reason, make the syscore flag system-wide PM-specific
and simplify the code used for manipulating it, because it need not
acquire the device's power.lock any more.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
This commit is contained in:
Rafael J. Wysocki
2012-08-13 14:00:25 +02:00
parent 3cb6f10a4d
commit feb70af0e3
5 changed files with 10 additions and 22 deletions

View File

@@ -83,18 +83,3 @@ int dev_pm_put_subsys_data(struct device *dev)
return ret;
}
EXPORT_SYMBOL_GPL(dev_pm_put_subsys_data);
/**
* dev_pm_syscore_device - Set/unset the given device's power.syscore flag.
* @dev: Device whose flag is to be modified.
* @val: New value of the flag.
*/
void dev_pm_syscore_device(struct device *dev, bool val)
{
unsigned long flags;
spin_lock_irqsave(&dev->power.lock, flags);
dev->power.syscore = val;
spin_unlock_irqrestore(&dev->power.lock, flags);
}
EXPORT_SYMBOL_GPL(dev_pm_syscore_device);

View File

@@ -442,7 +442,7 @@ static int pm_genpd_poweroff(struct generic_pm_domain *genpd)
not_suspended = 0;
list_for_each_entry(pdd, &genpd->dev_list, list_node)
if (pdd->dev->driver && (!pm_runtime_suspended(pdd->dev)
|| pdd->dev->power.irq_safe || pdd->dev->power.syscore))
|| pdd->dev->power.irq_safe))
not_suspended++;
if (not_suspended > genpd->in_progress)

View File

@@ -134,7 +134,7 @@ static int rpm_check_suspend_allowed(struct device *dev)
if (dev->power.runtime_error)
retval = -EINVAL;
else if (dev->power.disable_depth > 0 || dev->power.syscore)
else if (dev->power.disable_depth > 0)
retval = -EACCES;
else if (atomic_read(&dev->power.usage_count) > 0)
retval = -EAGAIN;