lkml.org 
[lkml]   [2015]   [Sep]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 1/2] PM / sleep: Go direct_complete if driver has no callbacks
On Tue, 29 Sep 2015, Tomeu Vizoso wrote:

> If a suitable prepare callback cannot be found for a given device and
> its driver has no PM callbacks at all, assume that it can go direct to
> complete when the system goes to sleep.
>
> The reason for this is that there's lots of devices in a system that do
> no PM at all and there's no reason for them to prevent their ancestors
> to do direct_complete if they can support it.
>
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>

> +void device_check_pm_callbacks(struct device *dev)
> +{
> + dev->power.no_pm_callbacks =
> + (!dev->bus || pm_ops_is_empty(dev->bus->pm)) &&
> + (!dev->class || pm_ops_is_empty(dev->class->pm)) &&
> + (!dev->type || pm_ops_is_empty(dev->type->pm)) &&
> + (!dev->pm_domain || pm_ops_is_empty(&dev->pm_domain->ops)) &&
> + (!dev->driver || pm_ops_is_empty(dev->driver->pm));
> +}

One fairly minor point: You should lock dev->power.lock before setting
this bitfield. This is because bitfields are not SMP-safe.

Alan Stern



\
 
 \ /
  Last update: 2015-09-29 17:01    [W:0.094 / U:0.888 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site